diff --git a/src/input_handler.cc b/src/input_handler.cc index 3662e12f..752b642c 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -1095,7 +1095,6 @@ public: sel.cursor() = context().buffer().char_prev(sel.cursor()); } } - selections.avoid_eol(); } } diff --git a/src/normal.cc b/src/normal.cc index 85597432..99ccadb6 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -614,7 +614,6 @@ void erase_selections(Context& context, NormalParams params) } ScopedEdition edition(context); context.selections().erase(); - context.selections().avoid_eol(); } template @@ -1841,7 +1840,6 @@ void move_in_history(Context& context, NormalParams params) auto ranges = compute_modified_ranges(buffer, timestamp); if (not ranges.empty()) context.selections_write_only() = std::move(ranges); - context.selections().avoid_eol(); context.print_status({ format("moved to change #{} ({})", history_id, max_history_id), @@ -1925,9 +1923,6 @@ void move(Context& context, NormalParams params) } selections.sort(); - if (std::is_same::value) - selections.avoid_eol(); - selections.merge_overlapping(); } diff --git a/src/selection.cc b/src/selection.cc index 5f323894..b536ee1b 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -334,24 +334,6 @@ void SelectionList::sort_and_merge_overlapping() merge_overlapping(); } -static inline void _avoid_eol(const Buffer& buffer, BufferCoord& coord) -{ - auto column = coord.column; - auto line = buffer[coord.line]; - if (column != 0 and column == line.length() - 1) - coord.column = line.byte_count_to(line.char_length() - 2); -} - -void SelectionList::avoid_eol() -{ - update(); - for (auto& sel : m_selections) - { - _avoid_eol(buffer(), sel.anchor()); - _avoid_eol(buffer(), sel.cursor()); - } -} - BufferCoord get_insert_pos(const Buffer& buffer, const Selection& sel, InsertMode mode) { diff --git a/src/selection.hh b/src/selection.hh index 864b02d8..27820700 100644 --- a/src/selection.hh +++ b/src/selection.hh @@ -100,8 +100,6 @@ struct SelectionList size_t main_index() const { return m_main; } void set_main_index(size_t main) { kak_assert(main < size()); m_main = main; } - void avoid_eol(); - void push_back(const Selection& sel) { m_selections.push_back(sel); } void push_back(Selection&& sel) { m_selections.push_back(std::move(sel)); } diff --git a/test/indent/c-family/indent-if-body/state b/test/indent/c-family/indent-if-body/state index 6f7516b5..82542193 100644 --- a/test/indent/c-family/indent-if-body/state +++ b/test/indent/c-family/indent-if-body/state @@ -1 +1 @@ -2.7,2.7 +2.8,2.8 diff --git a/test/indent/c-family/indent-if-brace/state b/test/indent/c-family/indent-if-brace/state index 9c868b6b..2bec0195 100644 --- a/test/indent/c-family/indent-if-brace/state +++ b/test/indent/c-family/indent-if-brace/state @@ -1 +1 @@ -3.7,3.7 +3.8,3.8 diff --git a/test/normal/paste-before/cmd b/test/normal/paste-before/cmd index 8b6fcbb3..d2ff461f 100644 --- a/test/normal/paste-before/cmd +++ b/test/normal/paste-before/cmd @@ -1 +1 @@ -dP +dhP diff --git a/test/regression/1435-misplaced-cursor-with-show_matching-hl/display b/test/regression/1435-misplaced-cursor-with-show_matching-hl/display index 1f7c4a5a..da6ad4e6 100644 --- a/test/regression/1435-misplaced-cursor-with-show_matching-hl/display +++ b/test/regression/1435-misplaced-cursor-with-show_matching-hl/display @@ -4,9 +4,9 @@ { "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:2 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "[+]" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "yellow", "bg": "default", "attributes": [] }, "contents": "insert" }, { "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sels (1)" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - unnamed0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] } { "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 1 }] } { "jsonrpc": "2.0", "method": "refresh", "params": [true] } -{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "attributes": [] }, "contents": "·" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "¬" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "¬" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] } +{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "·" }, { "face": { "fg": "black", "bg": "cyan", "attributes": [] }, "contents": "¬" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "¬" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] } { "jsonrpc": "2.0", "method": "menu_hide", "params": [] } { "jsonrpc": "2.0", "method": "info_hide", "params": [] } -{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:1 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "[+]" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - unnamed0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] } -{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 0 }] } +{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:2 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "[+]" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - unnamed0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] } +{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 1 }] } { "jsonrpc": "2.0", "method": "refresh", "params": [true] } diff --git a/test/regression/1453-show_whitespaces-highlighter-breaks-tab-alignment/display b/test/regression/1453-show_whitespaces-highlighter-breaks-tab-alignment/display index 731639e4..ca7889b3 100644 --- a/test/regression/1453-show_whitespaces-highlighter-breaks-tab-alignment/display +++ b/test/regression/1453-show_whitespaces-highlighter-breaks-tab-alignment/display @@ -1,6 +1,6 @@ -{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "this" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "→ " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "is" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "→ " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "a" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "→ " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "tes" }, { "face": { "fg": "black", "bg": "white", "attributes": [] }, "contents": "t" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "¬" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] } +{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "this" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "→ " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "is" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "→ " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "a" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "→ " }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "test" }, { "face": { "fg": "black", "bg": "cyan", "attributes": [] }, "contents": "¬" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] } { "jsonrpc": "2.0", "method": "menu_hide", "params": [] } { "jsonrpc": "2.0", "method": "info_hide", "params": [] } -{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:14 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "[+]" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - unnamed0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] } -{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 27 }] } +{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:15 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "[+]" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - unnamed0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] } +{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 28 }] } { "jsonrpc": "2.0", "method": "refresh", "params": [true] }