Hello,

This commit put LyX table handling more in line with OOWriter and MSWord wrt to multi-cell selection. The only difference with OOWriter is that the cursor is put at the beginning of the cell whereas we put it now at the end of the current cell. MSWord don't show the cursor in this case. This is just cosmetics but I think LyX current behaviour is more logical as the whole text will be deleted within the cell if you insert a character or press delete. But this just cosmetics.

Abdel.


-------- Original Message --------
Subject: r26668 - /lyx-devel/trunk/src/insets/InsetTabular.cpp
Date: Wed, 01 Oct 2008 08:18:57 -0000
From: [EMAIL PROTECTED]
Reply-To: lyx-devel@lists.lyx.org
To: [EMAIL PROTECTED]
Newsgroups: gmane.editors.lyx.cvs
Followup-To: gmane.editors.lyx.devel

Author: younes
Date: Wed Oct  1 10:18:57 2008
New Revision: 26668

URL: http://www.lyx.org/trac/changeset/26668
Log:
Modify the way multi-cell selection is done in tables:
* Always put the cursor at the end of the cell (this was set at the beginning with mouse selection). * handle LFUN_SELF_INSERT in case of multi-cell selection -> the whole cell contents will be deleted.

This commit fixes http://bugzilla.lyx.org/show_bug.cgi?id=5225

Modified:
    lyx-devel/trunk/src/insets/InsetTabular.cpp

Modified: lyx-devel/trunk/src/insets/InsetTabular.cpp
URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/insets/InsetTabular.cpp?rev=26668
==============================================================================
--- lyx-devel/trunk/src/insets/InsetTabular.cpp (original)
+++ lyx-devel/trunk/src/insets/InsetTabular.cpp Wed Oct  1 10:18:57 2008
@@ -3295,8 +3295,8 @@
                        // if this is a multicell selection, we just set the 
cursor to
                        // the beginning of the cell's text.
                        if (bvcur.selIsMultiCell()) {
-                               bvcur.pit() = 0;
-                               bvcur.pos() = 0;
+                               bvcur.pit() = bvcur.lastpit();
+                               bvcur.pos() = bvcur.lastpos();
                        }
                }
                break;
@@ -3409,6 +3409,11 @@
                        cmd = FuncRequest(LFUN_FINISHED_FORWARD);
                        cur.undispatched();
                }
+               if (cur.selIsMultiCell()) {
+                       cur.pit() = cur.lastpit();
+                       cur.pos() = cur.lastpos();
+                       return;
+               }
                break;

        case LFUN_UP_SELECT:
@@ -3431,6 +3436,11 @@
                if (sl == cur.top()) {
                        cmd = FuncRequest(LFUN_UP);
                        cur.undispatched();
+               }
+               if (cur.selIsMultiCell()) {
+                       cur.pit() = cur.lastpit();
+                       cur.pos() = cur.lastpos();
+                       return;
                }
                break;

@@ -3511,6 +3521,14 @@
                }
                else
                        cell(cur.idx())->dispatch(cur, cmd);
+               break;
+
+       case LFUN_SELF_INSERT:
+               if (cur.selIsMultiCell()) {
+                       cur.recordUndoInset(DELETE_UNDO);
+                       cutSelection(cur);
+               }
+               cell(cur.idx())->dispatch(cur, cmd);
                break;

        case LFUN_CHAR_DELETE_BACKWARD:
@@ -4126,9 +4144,18 @@
                        return;
                ++cur.idx();
        }
+
+       cur.boundary(false);
+
+       if (cur.selIsMultiCell()) {
+               cur.pit() = cur.lastpit();
+               cur.pos() = cur.lastpos();
+               resetPos(cur);
+               return;
+       }
+
        cur.pit() = 0;
        cur.pos() = 0;
-       cur.boundary(false);

        // in visual mode, place cursor at extreme left or right
        
@@ -4169,6 +4196,14 @@
                        return;
                --cur.idx();
        }
+
+       if (cur.selIsMultiCell()) {
+               cur.pit() = cur.lastpit();
+               cur.pos() = cur.lastpos();
+               resetPos(cur);
+               return;
+       }
+
        cur.pit() = cur.lastpit();
        cur.pos() = cur.lastpos();




Reply via email to