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')) diff --git a/src/normal.cc b/src/normal.cc index fdec4258..3ba7760a 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1481,8 +1481,10 @@ static NormalCmdDesc cmds[] = { alt('B'), "extend to prevous WORD start", repeated>> }, { alt('l'), "select to line end", repeated> }, + { Key::End, "select to line end", repeated> }, { alt('L'), "extend to line end", repeated> }, { alt('h'), "select to line begin", repeated> }, + { Key::Home, "select to line begin", repeated> }, { alt('H'), "extend to line begin", repeated> }, { 'x', "select line", repeated> },