[LyX/master] Fix assertion from setCursor() in outline-down/up
Scott Kostyshak
skostysh at lyx.org
Thu Mar 26 22:42:09 UTC 2020
commit a1169188c79f9bff4e99620ae50c8675a062a818
Author: Scott Kostyshak <skostysh at lyx.org>
Date: Thu Mar 26 18:57:25 2020 -0400
Fix assertion from setCursor() in outline-down/up
The function outline() itself can change the cursor position in some
cases so we need to store the old position before calling outline().
Spotted by Kornel. For an example file that triggered the assertion,
see:
https://www.mail-archive.com/search?l=mid&q=20200326183314.09ad4c7c%40admin1-desktop
This commit amends adb7283b.
---
src/Text3.cpp | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 2f6afd5..f290ca6 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -2759,19 +2759,23 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
}
break;
- case LFUN_OUTLINE_UP:
+ case LFUN_OUTLINE_UP: {
+ pos_type const opos = cur.pos();
outline(OutlineUp, cur, this);
- setCursor(cur, cur.pit(), cur.pos());
+ setCursor(cur, cur.pit(), opos);
cur.forceBufferUpdate();
needsUpdate = true;
break;
+ }
- case LFUN_OUTLINE_DOWN:
+ case LFUN_OUTLINE_DOWN: {
+ pos_type const opos = cur.pos();
outline(OutlineDown, cur, this);
- setCursor(cur, cur.pit(), cur.pos());
+ setCursor(cur, cur.pit(), opos);
cur.forceBufferUpdate();
needsUpdate = true;
break;
+ }
case LFUN_OUTLINE_IN:
outline(OutlineIn, cur, this);
More information about the lyx-cvs
mailing list