Add gt, gb and gc to goto the first/last/middle displayed line

This commit is contained in:
Maxime Coste 2013-04-10 19:02:28 +02:00
parent 9999e5698d
commit 1398641d22
2 changed files with 29 additions and 4 deletions

View File

@ -65,8 +65,12 @@ Basic Movement
* _gh_, _alt-H_: select to line begin
* _gl_, _alt-L_: select to line end
* _gg_, _gt_: go to the first line
* _gb_: go to the last line
* _gg_, _gk_: go to the first line
* _gj_: go to the last line
* _gt_, _gk_: go to the first displayed line
* _gc_, _gk_: go to the middle displayed line
* _gb_: go to the last displayed line
* _/_: search (select next match)
* _?_: search (extend to next match)

View File

@ -88,11 +88,32 @@ void do_go(Context& context)
break;
}
case 'e':
{
context.push_jump();
editor.select(editor.buffer().end()-1, mode);
break;
case 't':
if (context.has_window())
{
auto line = context.window().position().line;
editor.select(editor.buffer().iterator_at_line_begin(line), mode);
}
break;
case 'b':
if (context.has_window())
{
auto& window = context.window();
auto line = window.position().line + window.dimensions().line - 1;
editor.select(editor.buffer().iterator_at_line_begin(line), mode);
}
break;
case 'c':
if (context.has_window())
{
auto& window = context.window();
auto line = window.position().line + window.dimensions().line / 2;
editor.select(editor.buffer().iterator_at_line_begin(line), mode);
}
break;
case 'a':
{
auto& buffer_manager = BufferManager::instance();