[LyX/2.3.x] Fix limiting of absurdly large input to thesaurus (#10528)

Juergen Spitzmueller spitz at lyx.org
Sat Mar 6 07:03:58 UTC 2021


commit a44d0d26527212458b7fd51dfa143ac5339cfa9f
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Fri Mar 5 07:51:49 2021 +0100

    Fix limiting of absurdly large input to thesaurus (#10528)
    
    (cherry picked from commit 2b7fae04f32c2db8aa71c5208f289c7ff77db951)
---
 src/Text3.cpp |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/Text3.cpp b/src/Text3.cpp
index 1c99614..020529d 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -2510,8 +2510,16 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
 		docstring arg = cmd.argument();
 		if (arg.empty()) {
 			arg = cur.selectionAsString(false);
-			// FIXME
+			// Too large. We unselect if needed and try to get
+			// the first word in selection or under cursor
 			if (arg.size() > 100 || arg.empty()) {
+				if (cur.selection()) {
+					DocIterator selbeg = cur.selectionBegin();
+					cur.selection(false);
+					cur.clearSelection();
+					setCursorIntern(cur, selbeg.pit(), selbeg.pos());
+					cur.screenUpdateFlags(Update::Force);
+				}
 				// Get word or selection
 				selectWordWhenUnderCursor(cur, WHOLE_WORD);
 				arg = cur.selectionAsString(false);


More information about the lyx-cvs mailing list