]> git.lyx.org Git - features.git/commitdiff
Restore implicit word selection for inset insertion.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Thu, 26 Apr 2018 01:48:25 +0000 (21:48 -0400)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Thu, 26 Apr 2018 01:53:54 +0000 (21:53 -0400)
Modifies 0662ffb9.

(cherry picked from commit aa2f409d871d36dc0e1c038aba900d06963d3459)

src/CutAndPaste.cpp
src/CutAndPaste.h
src/Text3.cpp

index be8142b76e317481b4de04287a1756b050d5250d..2d18abad8d2c2dc4dc2c25a16a9ee98287f03d74 100644 (file)
@@ -1070,6 +1070,12 @@ void copySelectionToStack()
 }
 
 
+void copySelectionToTemp(Cursor & cur)
+{
+       copySelectionToStack(cur, tempCut);
+}
+
+
 void copySelection(Cursor const & cur, docstring const & plaintext)
 {
        // In tablemode, because copy and paste actually use special table stack
index 43a89c33d05c521aca67a9998c16a8dcf9886388..540397dde99a004f021eece10957206083e544ba 100644 (file)
@@ -65,6 +65,8 @@ void cutSelectionToTemp(Cursor & cur, bool doclear = true, bool realcut = true);
 
 /// Push the current selection to the cut buffer and the system clipboard.
 void copySelection(Cursor const & cur);
+/// Like copySelection, but only put to temporary cut buffer
+void copySelectionToTemp(Cursor & cur);
 ///
 void copyInset(Cursor const & cur, Inset * inset, docstring const & plaintext);
 /**
index 9d75274b9e3dd3f432c947c6ad13ba0ab68615d9..e13160b2e1d44728d2c9777cbf39f69d3660cdc2 100644 (file)
@@ -89,6 +89,7 @@ using namespace lyx::support;
 namespace lyx {
 
 using cap::copySelection;
+using cap::copySelectionToTemp;
 using cap::cutSelection;
 using cap::cutSelectionToTemp;
 using cap::pasteFromStack;
@@ -288,9 +289,16 @@ static bool doInsertInset(Cursor & cur, Text * text,
 
        bool gotsel = false;
        if (cur.selection()) {
-               cutSelectionToTemp(cur, false, pastesel);
+               if (cmd.action() == LFUN_INDEX_INSERT)
+                               copySelectionToTemp(cur);
+                       else
+                               cutSelectionToTemp(cur, false, pastesel);
+                       cur.clearSelection();
+                       gotsel = true;
+       } else if (cmd.action() == LFUN_INDEX_INSERT) {
+               gotsel = text->selectWordWhenUnderCursor(cur, WHOLE_WORD);
+               copySelectionToTemp(cur);
                cur.clearSelection();
-               gotsel = true;
        }
        text->insertInset(cur, inset);