]> git.lyx.org Git - features.git/commitdiff
Fix limiting of absurdly large input to thesaurus (#10528)
authorJuergen Spitzmueller <spitz@lyx.org>
Fri, 5 Mar 2021 06:51:49 +0000 (07:51 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Fri, 5 Mar 2021 06:51:49 +0000 (07:51 +0100)
src/Text3.cpp

index 9b66997397a1d088607a9563e9de196f568bdb75..3db37b8c25429f577da2a5c15d69c733e9e3d1b4 100644 (file)
@@ -2670,8 +2670,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);