From fbe8eed3e4f3c0f095f9c51037b1af3110b63e7c Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 27 Oct 2011 18:57:31 +0000 Subject: [PATCH] Selectors: select_line selects next line when cursor is on eol --- src/selectors.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/selectors.cc b/src/selectors.cc index 0c4d0d41..bd7cc550 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -174,10 +174,13 @@ Selection select_to_previous_WORD(const BufferIterator& cursor) Selection select_line(const BufferIterator& cursor) { BufferIterator first = cursor; + if (*first == '\n' and not first.is_end()) + ++first; + while (not first.is_begin() and *(first - 1) != '\n') --first; - BufferIterator last = cursor; + BufferIterator last = first; while (not (last + 1).is_end() and *last != '\n') ++last; return Selection(first, last);