Window: do not stay on an eol when clearing selections

This commit is contained in:
Maxime Coste 2011-11-29 22:48:00 +00:00
parent 0859b20bcf
commit 0b48525b35

View File

@ -206,8 +206,12 @@ DisplayCoord Window::line_and_column_at(const BufferIterator& iterator) const
void Window::clear_selections() void Window::clear_selections()
{ {
check_invariant(); check_invariant();
Selection sel = Selection(m_selections.back().last(), BufferIterator pos = m_selections.back().last();
m_selections.back().last());
if (*pos == '\n' and not pos.is_begin() and *(pos-1) != '\n')
--pos;
Selection sel = Selection(pos, pos);
m_selections.clear(); m_selections.clear();
m_selections.push_back(std::move(sel)); m_selections.push_back(std::move(sel));
} }