On 18-May-2002 michael.schmitt wrote:

> - Create a float with two lines of text inside;
>   1. delete some text in the second line; undo with CTRL-Z;
>      press shift-cursor-right -> the wrong text is selected!
>   2. delete some text in the first line; undo with CTRL-Z
>      -> segmentation fault! (reproducible all the time)

Hi Michael!

I cannot reproduce the crash and attached is a patch for the problem
with the selection after an undo (should be applied for 1.2.0 also IMO).

           Jug

-- 
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._
Dr. Jürgen Vigna        E-Mail:  [EMAIL PROTECTED]
Mitterstrich 151/A      Tel/Fax: +39-0471-450260 / +39-0471-450253
I-39050 Steinegg        Web:     http://www.lyx.org/~jug
-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._

Real Users never use the Help key.

Index: src/undo_funcs.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/undo_funcs.C,v
retrieving revision 1.22
diff -u -p -r1.22 undo_funcs.C
--- src/undo_funcs.C    21 Mar 2002 17:25:32 -0000      1.22
+++ src/undo_funcs.C    21 May 2002 13:44:26 -0000
@@ -240,6 +240,10 @@ bool textHandleUndo(BufferView * bv, Und
                                        t = bv->text;
                                }
                                t->setCursorIntern(bv, tmppar, undo->cursor_pos);
+                               // clear any selection and set the selection cursor
+                               // for an evt. new selection.
+                               t->clearSelection();
+                               t->selection.cursor = t->cursor;
                                t->updateCounters(bv, t->cursor.row());
                                bv->fitCursor();
                        }
@@ -258,6 +262,10 @@ bool textHandleUndo(BufferView * bv, Und
                                        t = bv->text;
                                }
                                t->setCursorIntern(bv, tmppar, undo->cursor_pos);
+                               // clear any selection and set the selection cursor
+                               // for an evt. new selection.
+                               t->clearSelection();
+                               t->selection.cursor = t->cursor;
                                t->updateCounters(bv, t->cursor.row());
                        }
                }

Reply via email to