Window: scroll when inserting, appending, erasing if necessary

This commit is contained in:
Maxime Coste 2011-10-10 14:28:39 +00:00
parent 7e84ca9ae9
commit fe0e1c79f0

View File

@ -140,6 +140,7 @@ void Window::erase_noundo()
m_buffer.erase(sel.begin(), sel.end()); m_buffer.erase(sel.begin(), sel.end());
sel = Selection(sel.begin(), sel.begin()); sel = Selection(sel.begin(), sel.begin());
} }
scroll_to_keep_cursor_visible_ifn();
} }
static WindowCoord measure_string(const Window::String& string) static WindowCoord measure_string(const Window::String& string)
@ -171,6 +172,7 @@ void Window::insert_noundo(const String& string)
m_buffer.insert(sel.begin(), string); m_buffer.insert(sel.begin(), string);
sel.offset(string.length()); sel.offset(string.length());
} }
scroll_to_keep_cursor_visible_ifn();
} }
void Window::append(const String& string) void Window::append(const String& string)
@ -183,6 +185,7 @@ void Window::append_noundo(const String& string)
{ {
for (auto& sel : m_selections) for (auto& sel : m_selections)
m_buffer.insert(sel.end(), string); m_buffer.insert(sel.end(), string);
scroll_to_keep_cursor_visible_ifn();
} }
bool Window::undo() bool Window::undo()