summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-09-23 13:13:51 +0900
committerMaxime Coste <mawww@kakoune.org>2017-09-23 13:13:51 +0900
commit002e77534f23890ccf7a2dfd31b76d4962f657ff (patch)
treef903afb1e4d2a0315dc38145abafee476e11dd6a /src/normal.cc
parent81070875107c9705e79e79c3b6e4225d92b70991 (diff)
parenta20ecf6b005350b42be60ce74d1c3d0354ee74ee (diff)
Merge remote-tracking branch 'occivink/quit-on-esc'
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/normal.cc b/src/normal.cc
index df6e686f..c4ccf2da 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -185,7 +185,7 @@ void goto_commands(Context& context, NormalParams params)
on_next_key_with_autoinfo(context, KeymapMode::Goto,
[](Key key, Context& context) {
auto cp = key.codepoint();
- if (not cp)
+ if (not cp or key == Key::Escape)
return;
auto& buffer = context.buffer();
switch (to_lower(*cp))
@@ -1122,7 +1122,7 @@ void select_object(Context& context, NormalParams params)
on_next_key_with_autoinfo(context, KeymapMode::Object,
[count](Key key, Context& context) {
auto cp = key.codepoint().value_or((Codepoint)-1);
- if (cp == -1)
+ if (cp == -1 or key == Key::Escape)
return;
static constexpr struct ObjectType
@@ -1335,15 +1335,17 @@ void select_to_next_char(Context& context, NormalParams params)
on_next_key_with_autoinfo(context, KeymapMode::None,
[params](Key key, Context& context) {
+ auto cp = key.codepoint();
+ if (not cp or key == Key::Escape)
+ return;
constexpr auto new_flags = flags & SelectFlags::Extend ? SelectMode::Extend
: SelectMode::Replace;
- if (auto cp = key.codepoint())
- select_and_set_last<new_flags>(
- context,
- std::bind(flags & SelectFlags::Reverse ? select_to_reverse
- : select_to,
- _1, _2, *cp, params.count,
- flags & SelectFlags::Inclusive));
+ select_and_set_last<new_flags>(
+ context,
+ std::bind(flags & SelectFlags::Reverse ? select_to_reverse
+ : select_to,
+ _1, _2, *cp, params.count,
+ flags & SelectFlags::Inclusive));
}, get_title(),"enter char to select to");
}