From 3be77842db0b617edbd598925b815354181ba28c Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 2 Jan 2014 19:28:37 +0000 Subject: [PATCH] fix select_to_eol behaviour when on empty line fixes #3 --- src/selectors.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/selectors.cc b/src/selectors.cc index 6501fc1f..c8841f41 100644 --- a/src/selectors.cc +++ b/src/selectors.cc @@ -205,9 +205,9 @@ Selection select_to_reverse(const Buffer& buffer, const Selection& selection, Selection select_to_eol(const Buffer& buffer, const Selection& selection) { Utf8Iterator begin = buffer.iterator_at(selection.last()); - Utf8Iterator end = begin + 1; + Utf8Iterator end = begin; skip_while(end, buffer.end(), [](Codepoint cur) { return not is_eol(cur); }); - return utf8_range(begin, end-1); + return utf8_range(begin, end != begin ? end-1 : end); } Selection select_to_eol_reverse(const Buffer& buffer, const Selection& selection)