commit 69a72f5dec0edeb96b00842a1b77ec92505fd21c
Author: Richard Kimberly Heck <[email protected]>
Date:   Wed Apr 25 21:48:25 2018 -0400

    Restore implicit word selection for inset insertion.
    
    Modifies 0662ffb9.
    
    (cherry picked from commit aa2f409d871d36dc0e1c038aba900d06963d3459)
---
 src/CutAndPaste.cpp |    6 ++++++
 src/CutAndPaste.h   |    2 ++
 src/Text3.cpp       |   12 ++++++++++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp
index be8142b..2d18aba 100644
--- a/src/CutAndPaste.cpp
+++ b/src/CutAndPaste.cpp
@@ -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
diff --git a/src/CutAndPaste.h b/src/CutAndPaste.h
index 43a89c3..540397d 100644
--- a/src/CutAndPaste.h
+++ b/src/CutAndPaste.h
@@ -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);
 /**
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 9d75274..e13160b 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -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);
 

Reply via email to