From 7b906134e2fbc2c37cfb9f71a2bf01f927a7d02d Mon Sep 17 00:00:00 2001 From: Dale Eidd Date: Sat, 31 Dec 2016 08:52:41 +1100 Subject: [PATCH] Fix commandline selection including extra character Fixes #3684 --- src/reader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index 334c6edc8..5121f7544 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -415,7 +415,7 @@ static void reader_repaint() { if (data->sel_active) { highlight_spec_t selection_color = highlight_make_background(highlight_spec_selection); - for (size_t i = data->sel_start_pos; i <= std::min(len - 1, data->sel_stop_pos); i++) { + for (size_t i = data->sel_start_pos; i < std::min(len, data->sel_stop_pos); i++) { colors[i] = selection_color; } } @@ -1922,7 +1922,7 @@ bool reader_get_selection(size_t *start, size_t *len) { bool result = false; if (data != NULL && data->sel_active) { *start = data->sel_start_pos; - *len = std::min(data->sel_stop_pos - data->sel_start_pos + 1, data->command_line.size()); + *len = std::min(data->sel_stop_pos - data->sel_start_pos, data->command_line.size()); result = true; } return result;