From e8f7285df35dc57e126a4f882fee77b1efd42a50 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Vigna?= Date: Mon, 17 Dec 2001 14:53:31 +0000 Subject: [PATCH] Set selection.cursor always on a ButtonPress event in insettext (fixes the crashes on opening collapsable inset put into one row). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3228 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 8 ++++---- src/insets/ChangeLog | 4 ++++ src/insets/insettext.C | 10 +++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5ff880c490..b7cf90a2fd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2001-12-17 Juergen Vigna + + * tabular.C (AppendColumn): applied John's fix + 2001-12-15 John Levon * BufferView.h: @@ -8,15 +12,11 @@ * Makefile.am: * box.h: new start of class for above -2001-12-15 John Levon - * lyxfunc.C: ignore space-only minibuffer dispatches. Show the command name when it doesn't exist * minibuffer.C: don't add empty lines to the history -2001-12-15 John Levon - * minibuffer.C: add a space on dropdown completion 2001-12-14 John Levon diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index eebc28ef2e..f79d824ece 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,5 +1,9 @@ 2001-12-17 Juergen Vigna + * insettext.C (insetButtonPress): set the selection cursor! + (insetButtonPress): clear the selection (and set with that the + selection.cursor) if we only hit an inset! + * insetert.C (read): removed piece of compatibility code only needed for 1.2.0. diff --git a/src/insets/insettext.C b/src/insets/insettext.C index e94607736a..0ee5f7979c 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -969,6 +969,9 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button) clear = true; } lt->setCursorFromCoordinates(bv, x-drawTextXOffset, y + insetAscent); + // set the selection cursor! + lt->selection.cursor = lt->cursor; + lt->cursor.x_fix(lt->cursor.x()); if (lt->selection.set()) { lt->clearSelection(); updateLocal(bv, FULL, false); @@ -989,6 +992,8 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button) } if (clear) lt = 0; + } else { + lt->clearSelection(); } showInsetCursor(bv); no_selection = false; @@ -1030,7 +1035,7 @@ void InsetText::insetMotionNotify(BufferView * bv, int x, int y, int state) return; if (the_locking_inset) { the_locking_inset->insetMotionNotify(bv, x - inset_x, - y - inset_y,state); + y - inset_y,state); return; } bool clear = false; @@ -1039,7 +1044,10 @@ void InsetText::insetMotionNotify(BufferView * bv, int x, int y, int state) clear = true; } hideInsetCursor(bv); + LyXCursor cur = lt->cursor; lt->setCursorFromCoordinates(bv, x - drawTextXOffset, y + insetAscent); + if (cur == lt->cursor) + return; lt->setSelection(bv); if (lt->toggle_cursor.par() != lt->toggle_end_cursor.par() || lt->toggle_cursor.pos() != lt->toggle_end_cursor.pos()) -- 2.39.2