[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/master] Fix assertion from setCursor() in outline-down/up
From:       Scott Kostyshak <skostysh () lyx ! org>
Date:       2020-03-26 22:42:09
Message-ID: 20200326224209.48774280638 () lyx ! lyx ! org
[Download RAW message or body]

commit a1169188c79f9bff4e99620ae50c8675a062a818
Author: Scott Kostyshak <skostysh@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);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic