Restore implicit word selection for inset insertion.

Modifies 0662ffb9.

(cherry picked from commit aa2f409d87)
This commit is contained in:
Richard Kimberly Heck 2018-04-25 21:48:25 -04:00
parent 1101d85a3a
commit 69a72f5dec
3 changed files with 18 additions and 2 deletions

View 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

View 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);
/**

View 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);