mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
Restore implicit word selection for inset insertion.
Modifies0662ffb9
. (cherry picked from commitaa2f409d87
)
This commit is contained in:
parent
1101d85a3a
commit
69a72f5dec
@ -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
|
||||
|
@ -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);
|
||||
/**
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user