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{
|
evaluate-commands %sh{
|
||||||
case "${kak_opt_c_include_guard_style}" in
|
case "${kak_opt_c_include_guard_style}" in
|
||||||
ifdef)
|
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)
|
pragma)
|
||||||
echo 'execute-keys ggi#pragma<space>once<esc>'
|
echo 'execute-keys ggi#pragma<space>once<esc>'
|
||||||
|
|
|
@ -683,10 +683,13 @@ void paste(Context& context, NormalParams params)
|
||||||
ScopedEdition edition(context);
|
ScopedEdition edition(context);
|
||||||
context.selections().for_each([&](size_t index, Selection& sel) {
|
context.selections().for_each([&](size_t index, Selection& sel) {
|
||||||
auto& str = strings[std::min(strings.size()-1, index)];
|
auto& str = strings[std::min(strings.size()-1, index)];
|
||||||
if (mode == PasteMode::Replace)
|
auto& min = sel.min();
|
||||||
replace(buffer, sel, str);
|
auto& max = sel.max();
|
||||||
else
|
BufferRange range = (mode == PasteMode::Replace) ?
|
||||||
insert(buffer, sel, paste_pos(buffer, sel, mode, linewise), str);
|
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