Use existing window reference in view mode

This commit is contained in:
Delapouite 2017-12-17 14:42:09 +01:00
parent d8dc7d7f39
commit b81c6b5840

View File

@ -331,29 +331,29 @@ void view_commands(Context& context, NormalParams params)
{ {
case 'v': case 'v':
case 'c': case 'c':
context.window().center_line(cursor.line); window.center_line(cursor.line);
break; break;
case 'm': case 'm':
context.window().center_column( window.center_column(
context.buffer()[cursor.line].column_count_to(cursor.column)); context.buffer()[cursor.line].column_count_to(cursor.column));
break; break;
case 't': case 't':
context.window().display_line_at(cursor.line, 0); window.display_line_at(cursor.line, 0);
break; break;
case 'b': case 'b':
context.window().display_line_at(cursor.line, window.dimensions().line-1); window.display_line_at(cursor.line, window.dimensions().line-1);
break; break;
case 'h': case 'h':
context.window().scroll(-std::max<ColumnCount>(1, count)); window.scroll(-std::max<ColumnCount>(1, count));
break; break;
case 'j': case 'j':
context.window().scroll( std::max<LineCount>(1, count)); window.scroll( std::max<LineCount>(1, count));
break; break;
case 'k': case 'k':
context.window().scroll(-std::max<LineCount>(1, count)); window.scroll(-std::max<LineCount>(1, count));
break; break;
case 'l': case 'l':
context.window().scroll( std::max<ColumnCount>(1, count)); window.scroll( std::max<ColumnCount>(1, count));
break; break;
} }
}, lock ? "view (lock)" : "view", }, lock ? "view (lock)" : "view",