summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-06-21 18:58:35 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-06-21 19:36:13 +0100
commit75dd74ff43ba269bd62ff9b69d32f3fda2f511f9 (patch)
treeb6fbe17db013d6a5c8b54a51bb6c4d63043c8253 /src
parent64cbdcd3282c1500c01f4f15572173d67ea7cae6 (diff)
Use <a-R> as replace paste all yanked selections
Move rotate to ' and rotate contents to <a-'> Fix segfault when pasting all and nothing was yanked yet
Diffstat (limited to 'src')
-rw-r--r--src/normal.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/normal.cc b/src/normal.cc
index 6a936f82..84724b11 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -533,7 +533,10 @@ void paste_all(Context& context, NormalParams params)
Vector<ByteCount> offsets;
for (auto& str : strings)
{
- if (not str.empty() and str.back() == '\n')
+ if (str.empty())
+ continue;
+
+ if (str.back() == '\n')
effective_mode = adapt_for_linewise(mode);
all += str;
offsets.push_back(all.length());
@@ -557,7 +560,8 @@ void paste_all(Context& context, NormalParams params)
pos = offset;
}
}
- selections = std::move(result);
+ if (not result.empty())
+ selections = std::move(result);
}
template<typename T>
@@ -1463,6 +1467,7 @@ static NormalCmdDesc cmds[] =
{ alt('p'), "paste every yanked selection after selected text", paste_all<InsertMode::Append> },
{ alt('P'), "paste every yanked selection before selected text", paste_all<InsertMode::Insert> },
{ 'R', "replace selected text with yanked text", paste<InsertMode::Replace> },
+ { alt('R'), "replace selected text with yanked text", paste_all<InsertMode::Replace> },
{ 's', "select regex matches in selected text", select_regex },
{ 'S', "split selected text on regex matches", split_regex },
@@ -1554,8 +1559,8 @@ static NormalCmdDesc cmds[] =
{ ctrl('o'), "jump backward in jump list", jump<Backward> },
{ ctrl('s'), "push current selections in jump list", save_selections },
- { alt('r'), "rotate main selection", rotate_selections },
- { alt('R'), "rotate selections content", rotate_selections_content },
+ { '\'', "rotate main selection", rotate_selections },
+ { alt('\''), "rotate selections content", rotate_selections_content },
{ 'q', "replay recorded macro", replay_macro },
{ 'Q', "start or end macro recording", start_or_end_macro_recording },