mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Consider deleted text when inserting quote inset.
This bug was reported against the ubuntu build: https://bugs.launchpad.net/bugs/1100046 Additionally, some extra code for avoiding double undo entries has been removed, since this is handled by grouped undo now.
This commit is contained in:
parent
d5e0e21ba0
commit
db025be5ae
@ -940,15 +940,12 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
case LFUN_NEWLINE_INSERT: {
|
case LFUN_NEWLINE_INSERT: {
|
||||||
InsetNewlineParams inp;
|
InsetNewlineParams inp;
|
||||||
docstring arg = cmd.argument();
|
docstring arg = cmd.argument();
|
||||||
// this avoids a double undo
|
|
||||||
// FIXME: should not be needed, ideally
|
|
||||||
if (!cur.selection())
|
|
||||||
cur.recordUndo();
|
|
||||||
cap::replaceSelection(cur);
|
|
||||||
if (arg == "linebreak")
|
if (arg == "linebreak")
|
||||||
inp.kind = InsetNewlineParams::LINEBREAK;
|
inp.kind = InsetNewlineParams::LINEBREAK;
|
||||||
else
|
else
|
||||||
inp.kind = InsetNewlineParams::NEWLINE;
|
inp.kind = InsetNewlineParams::NEWLINE;
|
||||||
|
cap::replaceSelection(cur);
|
||||||
|
cur.recordUndo();
|
||||||
cur.insert(new InsetNewline(inp));
|
cur.insert(new InsetNewline(inp));
|
||||||
cur.posForward();
|
cur.posForward();
|
||||||
moveCursor(cur, false);
|
moveCursor(cur, false);
|
||||||
@ -1447,14 +1444,14 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_QUOTE_INSERT: {
|
case LFUN_QUOTE_INSERT: {
|
||||||
// this avoids a double undo
|
|
||||||
// FIXME: should not be needed, ideally
|
|
||||||
if (!cur.selection())
|
|
||||||
cur.recordUndo();
|
|
||||||
cap::replaceSelection(cur);
|
cap::replaceSelection(cur);
|
||||||
|
cur.recordUndo();
|
||||||
|
|
||||||
Paragraph const & par = cur.paragraph();
|
Paragraph const & par = cur.paragraph();
|
||||||
pos_type pos = cur.pos();
|
pos_type pos = cur.pos();
|
||||||
|
// Ignore deleted text before cursor
|
||||||
|
while (pos > 0 && par.isDeleted(pos - 1))
|
||||||
|
--pos;
|
||||||
|
|
||||||
BufferParams const & bufparams = bv->buffer().params();
|
BufferParams const & bufparams = bv->buffer().params();
|
||||||
bool const hebrew =
|
bool const hebrew =
|
||||||
|
Loading…
Reference in New Issue
Block a user