Select pasted text on paste
This is more consistent with the recently changed ! and <a-!> behaviour
This commit is contained in:
parent
ef8a11b3db
commit
266d1c37d0
|
@ -390,7 +390,7 @@ define-command -hidden c-family-insert-include-guards %{
|
|||
evaluate-commands %sh{
|
||||
case "${kak_opt_c_include_guard_style}" in
|
||||
ifdef)
|
||||
echo 'execute-keys ggi<c-r>%<ret><esc>ggI/<esc>xs^.*/<ret>dxs\.<ret>c_<esc><space>A_INCLUDED<esc>ggxyppI#ifndef<space><esc>jI#define<space><esc>jI#endif<space>//<space><esc>O<esc>'
|
||||
echo 'execute-keys gg"%PI/<esc>xs^.*/<ret>dxs\.<ret>r_A_INCLUDED<esc>xyPPI#ifndef<space><esc>jI#define<space><esc>jI#endif<space>//<space><esc>O<esc>'
|
||||
;;
|
||||
pragma)
|
||||
echo 'execute-keys ggi#pragma<space>once<esc>'
|
||||
|
|
|
@ -683,10 +683,13 @@ void paste(Context& context, NormalParams params)
|
|||
ScopedEdition edition(context);
|
||||
context.selections().for_each([&](size_t index, Selection& sel) {
|
||||
auto& str = strings[std::min(strings.size()-1, index)];
|
||||
if (mode == PasteMode::Replace)
|
||||
replace(buffer, sel, str);
|
||||
else
|
||||
insert(buffer, sel, paste_pos(buffer, sel, mode, linewise), str);
|
||||
auto& min = sel.min();
|
||||
auto& max = sel.max();
|
||||
BufferRange range = (mode == PasteMode::Replace) ?
|
||||
buffer.replace(min, buffer.char_next(max), str)
|
||||
: buffer.insert(paste_pos(buffer, sel, mode, linewise), str);
|
||||
min = range.begin;
|
||||
max = range.end > range.begin ? buffer.char_prev(range.end) : range.begin;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user