summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-03-27 13:33:14 +0000
committerMaxime Coste <frrrwww@gmail.com>2015-03-27 13:33:14 +0000
commit195b813b7340af5c4ff072449eb25dbde2569cde (patch)
treebb31f6eb1e7159dbeb088284f1f4bc0688262a23 /src/input_handler.cc
parent0fbbd64681802753cd598635fc9026b372ccab4e (diff)
Add support for Home/End keys in normal and insert mode
Fixes #260
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index 6d712697..b5f9e817 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -950,6 +950,24 @@ public:
move(1_line);
moved = true;
}
+ else if (key == Key::Home)
+ {
+ auto& selections = context().selections();
+ for (auto& sel : selections)
+ sel.anchor() = sel.cursor() = ByteCoord{sel.cursor().line, 0};
+ selections.sort_and_merge_overlapping();
+ }
+ else if (key == Key::End)
+ {
+ auto& buffer = context().buffer();
+ auto& selections = context().selections();
+ for (auto& sel : selections)
+ {
+ const LineCount line = sel.cursor().line;
+ sel.anchor() = sel.cursor() = buffer.clamp({line, buffer[line].length()});
+ }
+ selections.sort_and_merge_overlapping();
+ }
else if (key.modifiers == Key::Modifiers::None)
insert(key.key);
else if (key == ctrl('r'))