From 0b48525b3537d2a9008dc4f56c81e39e42515b80 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 29 Nov 2011 22:48:00 +0000 Subject: [PATCH] Window: do not stay on an eol when clearing selections --- src/window.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/window.cc b/src/window.cc index 02625fc5..646bc999 100644 --- a/src/window.cc +++ b/src/window.cc @@ -206,8 +206,12 @@ DisplayCoord Window::line_and_column_at(const BufferIterator& iterator) const void Window::clear_selections() { check_invariant(); - Selection sel = Selection(m_selections.back().last(), - m_selections.back().last()); + BufferIterator pos = 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.push_back(std::move(sel)); }