[Libreoffice] Annoying cursor behavior on sw tables

Octavio Alvarez alvarezp at alvarezp.ods.org
Wed Dec 29 20:58:04 PST 2010


On Wed, 29 Dec 2010 05:37:31 -0800, Jan Holesovsky <kendy at suse.cz> wrote:
> On 2010-12-23 at 21:07 -0800, Octavio Alvarez wrote:
>
>> There is this really annoying behavior:
>> 0. Open Writer.
>> 1. Create a table, say 3 x 3.
>> 2. Place the cursor in a cell.
>> 3. Type some text, like asdfasdfasdfasdf.
>> 4. Using the mouse, place the cursor in the middle of the asdf-word.
>> 5. Using the keyboard go left and right and left and right...
>
> [...]
>
>>           if( IsTableMode() )
>>               return bLeft ? GoPrevCell() : GoNextCell();
>>
>> -    SwCallLink aLk( *this );        // Crsr-Moves ueberwachen, evt.
>
> From what I see, it does most of its work in a destructor, so this looks
> like a kind of 'guard' that restores/updates stuff when the SwCallLink
> instance is destructed.
>
> Either way; I'd try to revert the callnk.cxx changes from commit
> 47472e8e70c1ae3dc55a5b00ef69eaa85f651a7f, it has something to do with
> tables, and see if you still see the problem.  If not, then it might
> limit the scope of your debugging to that commit only.
>
> Hopefully I am not misleading you :-)

Indeed, reverting the commit did the trick.

Now, look at this, this blog post documents the patch: :-O

http://cedric.bosdonnat.free.fr/wordpress/?p=472

The thing is that Window::Invalidate() gets called if I move or if I type
inside a table cell, which almost any key triggers, which is wrong.
bUpdatedTable gets set to True inside SwCallLink::~SwCallLink() after
some tests. Another option would be to correct those tests, but that
would be far beyond my knowledge.

Considering the above blog post from cbos I removed the Invalidate() and
tested inserting a 1x1 table inside the cell of another 1x1 table and it
seemed to work and update correctly and open the collapsed cell if I place
the cursor inside it (by pressing Left or Right, for example). It closes
back again if I go outside the empty cell.

Now, do we really need these lines? I tested saving and loading a file
and also using the main window. It worked. I saw no side effects, and my
problem gone, but then again, I really don't know what problems am I
looking for. I also don't know when else may a problem arise...

diff --git a/sw/source/core/crsr/callnk.cxx  
b/sw/source/core/crsr/callnk.cxx
index ea998fe..cabef45 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -143,9 +143,6 @@ SwCallLink::~SwCallLink()
          }
      }

-    if ( bUpdatedTable )
-        rShell.GetWin( )->Invalidate( 0 );
-
      xub_StrLen nCmp, nAktCntnt =  
pCurCrsr->GetPoint()->nContent.GetIndex();
      USHORT nNdWhich = pCNd->GetNodeType();
      ULONG nAktNode = pCurCrsr->GetPoint()->nNode.GetIndex();

BTW, thanks for your help, Kendy, and thanks for the translations, Pascal.


More information about the LibreOffice mailing list