Le 25/08/2024 à 21:08, T Rex a écrit :
Hi everyone,
I was trying to indent code inside the "program listing" environment and
the program closed with the key combination: shift+tab.
This is fixed in master now. The trick to have a crash is to select by
starting from the end of the inset contents. The cursor should be at the
start of the first paragraph.
Riki, this is obviously needed in stable too. In this setting, there is
a separate issue that selection drawing fails. All in all, I propose to
push the two patches below.
OK?
JMarc
From e0c655eaee64535cf60d0d4e44dbe546e697288d Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Fri, 30 Aug 2024 16:56:16 +0200
Subject: [PATCH 1/2] Fix update of cursor in tab-delete when there is a
selection
The position of the cursor should not be decreased if it is already at
the start of the paragraph. This can lead to a crash when trying to
display the caret.
(cherry picked from commit 16be88ca18719a98a555ced268431ca1040658b7)
---
src/Text.cpp | 5 ++---
status.24x | 5 ++++-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/Text.cpp b/src/Text.cpp
index 1e55600a80..e96c9a1e81 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -4594,10 +4594,9 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
int const n = (c == ' ' ? 4 : 1);
for (int i = 0; i < n
&& !par.empty() && par.getChar(0) == c; ++i) {
- if (cur.pit() == pit)
+ if (cur.pit() == pit && cur.pos() > 0)
cur.posBackward();
- if (cur.realAnchor().pit() == pit
- && cur.realAnchor().pos() > 0 )
+ if (cur.realAnchor().pit() == pit && cur.realAnchor().pos() > 0)
cur.realAnchor().backwardPos();
par.eraseChar(0, tc);
}
diff --git a/status.24x b/status.24x
index 5ad6c0e865..a785cfda3c 100644
--- a/status.24x
+++ b/status.24x
@@ -116,7 +116,10 @@ What's new
and xltable), as this is not supported by the packages. Also fix the
disabling mechanism in the table dialog.
-- Fix display of integral limits on Windows (bug 13087)
+- Fix display of integral limits on Windows (bug 13087).
+
+- Fix crash when deleting tabs in a selection (with S-BackTab) in a
+ text-only inset (ERT, Listings...).
* INTERNALS
--
2.34.1
From 835bf3c5149933e095c1f874d3e6f88ebdeeac6a Mon Sep 17 00:00:00 2001
From: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Fri, 30 Aug 2024 17:26:48 +0200
Subject: [PATCH 2/2] Avoid missing updates after some operations on selection
The logic at the end of Text::dispatch failed when needsUpdate and
singleParUpdate were true at the same time.
---
src/Text.cpp | 2 +-
status.24x | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Text.cpp b/src/Text.cpp
index e96c9a1e81..f63a6ede4b 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -6386,7 +6386,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
// FIXME: the following code should go in favor of fine grained
// update flag treatment.
- if (singleParUpdate) {
+ if (singleParUpdate && !needsUpdate) {
// Inserting characters does not change par height in general. So, try
// to update _only_ this paragraph. BufferView will detect if a full
// metrics update is needed anyway.
diff --git a/status.24x b/status.24x
index a785cfda3c..d91ab7f515 100644
--- a/status.24x
+++ b/status.24x
@@ -121,6 +121,7 @@ What's new
- Fix crash when deleting tabs in a selection (with S-BackTab) in a
text-only inset (ERT, Listings...).
+- Fix display glitches when applying some operations to a selection.
* INTERNALS
--
2.34.1
--
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel