Clamp cursor position on buffer reloading

This commit is contained in:
Maxime Coste 2014-03-07 01:05:51 +00:00
parent 03760e5ba1
commit 19f5eb65e8

View File

@ -95,7 +95,7 @@ static void reload_buffer(Context& context, const String& filename)
if (not buf)
return;
context.change_buffer(*buf);
context.selections() = SelectionList{cursor_pos};
context.selections() = SelectionList{buf->clamp(cursor_pos)};
context.window().set_position(view_pos);
context.print_status({ "'" + buf->display_name() + "' reloaded",
get_color("Information") });