do_go: some cleanups

This commit is contained in:
Maxime Coste 2012-08-21 20:58:10 +02:00
parent 3f471c138a
commit c6e8080426

View File

@ -125,9 +125,11 @@ void do_go(Context& context)
if (count != 0) if (count != 0)
{ {
BufferIterator target = BufferIterator target =
editor.buffer().iterator_at(BufferCoord(count-1, 0)); editor.buffer().iterator_at_line_begin(count-1);
editor.select(target); editor.select(target);
if (context.has_window())
context.window().center_selection();
} }
else else
{ {
@ -139,12 +141,8 @@ void do_go(Context& context)
{ {
case 'g': case 'g':
case 't': case 't':
{ editor.select(editor.buffer().begin());
BufferIterator target =
editor.buffer().iterator_at(BufferCoord(0,0));
editor.select(target);
break; break;
}
case 'l': case 'l':
case 'L': case 'L':
editor.select(select_to_eol, append); editor.select(select_to_eol, append);
@ -155,9 +153,8 @@ void do_go(Context& context)
break; break;
case 'b': case 'b':
{ {
BufferIterator target = editor.buffer().iterator_at( const Buffer& buf = editor.buffer();
BufferCoord(editor.buffer().line_count() - 1, 0)); editor.select(buf.iterator_at_line_begin(buf.line_count() - 1));
editor.select(target);
break; break;
} }
} }