Append on end of line now appends to current line
This commit is contained in:
parent
e77ca7a4be
commit
cee0a2d128
|
@ -38,10 +38,19 @@ static BufferIterator prepare_insert(Buffer& buffer, const Selection& sel,
|
|||
case InsertMode::Replace:
|
||||
return sel.begin();
|
||||
case InsertMode::Append:
|
||||
return sel.end();
|
||||
{
|
||||
// special case for end of lines, append to current line instead
|
||||
auto pos = std::max(sel.first(), sel.last());
|
||||
if (pos.column() == buffer.line_length(pos.line()) - 1)
|
||||
return pos;
|
||||
else
|
||||
return pos+1;
|
||||
}
|
||||
case InsertMode::InsertAtLineBegin:
|
||||
return buffer.iterator_at_line_begin(sel.begin());
|
||||
case InsertMode::AppendAtLineEnd:
|
||||
return buffer.iterator_at_line_end(sel.end()-1)-1;
|
||||
case InsertMode::InsertAtNextLineBegin:
|
||||
return buffer.iterator_at_line_end(sel.end()-1);
|
||||
case InsertMode::OpenLineBelow:
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ enum class InsertMode : unsigned
|
|||
Append,
|
||||
Replace,
|
||||
InsertAtLineBegin,
|
||||
InsertAtNextLineBegin,
|
||||
AppendAtLineEnd,
|
||||
OpenLineBelow,
|
||||
OpenLineAbove
|
||||
|
|
|
@ -169,7 +169,7 @@ void do_change(Context& context)
|
|||
static InsertMode adapt_for_linewise(InsertMode mode)
|
||||
{
|
||||
if (mode == InsertMode::Append)
|
||||
return InsertMode::AppendAtLineEnd;
|
||||
return InsertMode::InsertAtNextLineBegin;
|
||||
if (mode == InsertMode::Insert)
|
||||
return InsertMode::InsertAtLineBegin;
|
||||
if (mode == InsertMode::Replace)
|
||||
|
|
Loading…
Reference in New Issue
Block a user