From: Richard Kimberly Heck Date: Thu, 26 Apr 2018 01:48:25 +0000 (-0400) Subject: Restore implicit word selection for inset insertion. X-Git-Tag: 2.3.1~105 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=69a72f5dec0edeb96b00842a1b77ec92505fd21c;p=features.git Restore implicit word selection for inset insertion. Modifies 0662ffb9. (cherry picked from commit aa2f409d871d36dc0e1c038aba900d06963d3459) --- diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index be8142b76e..2d18abad8d 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 43a89c33d0..540397dde9 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 9d75274b9e..e13160b2e1 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);