summaryrefslogtreecommitdiff
path: root/src/selection.hh
AgeCommit message (Collapse)Author
2025-03-26Make sure captures are taken into account when comparing selectionsMaxime Coste
sel1 == sel2 was using BasicSelection::operator==, ignoring captures, which led to selection history deciding that selection did not change in some cases where only the captures had been updated and for the new selection not to be properly applied, leading to missing capture.
2024-08-12Reduce headers dependency graphMaxime Coste
Move more code into the implementation files to reduce the amount of code pulled by headers.
2023-12-12Fix stray semicolonMaxime Coste
2023-10-25Remove redundant comparison operatorsMaxime Coste
Since C++20 (a != b) get automatically rewritten as !(a == b) if the != operator does not exist.
2023-08-14Change `+` command not to duplicate identical selections more than onceMaxime Coste
The current exponential behaviour does not seem that useful, it seems more predictible that pressing `+` twice would end up with 3 copies of the original selections instead of 4. Fixes #4533
2022-11-28Fix pasting after when selections are overlappingMaxime Coste
With overlapping selections, pasting after breaks assumption of SelectionList::for_each as our changes are no longer happening in increasing locations. We hence cannot rely on the ForwardChangeTracker in that case and have to rely on the more general (and more costly) ranges update logic. This interacts poorly with paste linewise pastes and we try to preserve the current behaviour by tracking the last paste position. Overall, this change really begs for overlapping selections to be removed, but we will fix them like that for now. Fixes #4779
2022-07-05Distinguish between non-eol max column target and plain max columnMaxime Coste
2022-03-06src: Select the data inserted by `!` and `<a-!>`Frank LENORMAND
Closes #1468
2021-10-10Split InsertMode into InsertMode and PasteModeMaxime Coste
They are quite different use cases, and this allow moving InsertMode to input_handler.hh which is what uses it. This also cleans up the code as we can get rid of get_insert_pos and rely more on SelectionList::for_each.
2021-09-30rework selection insert/replace using a for_each methodMaxime Coste
expose that method so that various commands can take advantage of it for performance or simplicity purposes.
2021-08-30Take a function SelectionList::insert to get string to insertMaxime Coste
This makes it unnecessary to allocate Vector<String> to insert and allows to remove the insert_pos pointer hack by passing it to the callback.
2021-01-03Add missing limits includesMaxime Coste
Fixes #4003
2020-05-29Avoid to_remove vector in select helper functionMaxime Coste
Remove the need to allocate anything when removing selections.
2019-11-12Fix display column computationsJason Felice
Closes #3201
2019-11-12Add support for selecting and exporting selections in display columnsMaxime Coste
Fixes #2724
2019-11-12Add support for a -codepoint switch to the select commandMaxime Coste
2019-11-12Implement %val{selections_char_desc}Jason Felice
Fixes #3194
2019-11-09Add static or const where usefulJason Felice
2019-11-07Merge selection list parsing into selection_list_from_stringsJason Felice
2019-05-29Do not merge selections on backspace in insert modeMaxime Coste
Fixes #2861
2019-04-01Add -timestamp switch support to the select commandMaxime Coste
Fixes #2829
2019-02-11Fix bug in 'itersel' handling that could result in unsorted selectionsMaxime Coste
2019-02-04Remove references to SelectionList from selectorsMaxime Coste
2019-02-04Remove target_eol and small code cleanupsMaxime Coste
2019-01-23Change pipe diffing to work linewiseMaxime Coste
This should greatly improve performances as we only need to diff lines instead of individual characters. Closes #2678 Fixes #2037
2018-07-05Tolerate restoring invalid coordinates from registerMaxime Coste
Clamp those selection after updating them to the current timestamp Fixes #2078
2018-07-05Store each selection as a separate element in a registerMaxime Coste
It makes more sense to use the list nature of the register to store the selections instead of storing them as a single string separated by spaces.
2018-07-05Make selection lists use the option list syntaxMaxime Coste
2018-03-04Remove SelectionList::update_timestamp()Maxime Coste
This single line member function was only used once, inline it directly.
2018-02-25Remove avoidance of end of linesMaxime Coste
Various places in Kakoune code used to modify selections so that cursors would not lie on an end of line. Remove those to increase Kakoune's consistency and simplicity. Now that end of lines are highlighted separately, they should not be handled specially in most commands.
2018-01-12Save/restore main selection from/to stringsMaxime Coste
Always consider that the first selection in the list is the main one, save selections that way. This approach was suggested by PR #1786 but the implementation here is different, and is used more generally whenever we save selections to strings. This is also the prefered way to work only on the main selection: save selections with Z, reduce to main with <space>, restore with z. Closes #1786 Fixes #1750
2017-08-18Remove now trivial Selection::merge_with methodMaxime Coste
2017-07-14Fix an assert in compute modified ranges when merging single char rangesMaxime Coste
Due to the way Selection::min/max worked, we were creating backward selections, with cursor < anchor, which was triggering an assert when trying to move cursor back one char when it was already on the first char of the buffer.
2017-03-15Move SelectionList::set implementation out of the headerMaxime Coste
2017-03-03Ensure main selection index is correct directly in SelectionList::removeMaxime Coste
2017-02-01Use <a-'> for backward rotate selection and move rotate content to <a-">Maxime Coste
2017-01-13Fix capture group handlingMaxime Coste
Fixes #1129
2017-01-03Fix bug relying on undefined arg evaluation order.Maxime Coste
2017-01-03Fix handling of main selection when copying selection to next/previous linesMaxime Coste
Fixes #1095
2017-01-01Refactor SelectionList::insert a bitMaxime Coste
2016-10-01Support codepoints of variable widthMaxime Coste
Add a ColumnCount type and use it in place of CharCount whenever more appropriate, take column size of codepoints into account for vertical movements and docstring wrapping. Fixes #811
2016-08-27Support merging consecutive selections with <a-m>Maxime Coste
Fixes #773
2016-07-30Support sorting and merging overlapping separately, fix bug in moveMaxime Coste
Fixes #754
2016-07-08Keep modified selections in non-draft exec/eval -iterselMaxime Coste
Fixes #727
2015-12-27Fix uses of non-keyword logical operators (replace &&, || and ! with and, or ↵Maxime Coste
and not)
2015-09-12Add some missing memory domainsMaxime Coste
2015-06-27Initial selection saving/restoring support bound to ^ and alt-^Maxime Coste
2015-04-13Add support for string <-> selection list serializationMaxime Coste
2015-03-09ArrayView content is not const anymoreMaxime Coste
As in upcoming std c++ array_view, ArrayView<T> points to mutable data, use ArrayView<const T> or alias ConstArrayView<T> for const data.
2015-02-19Rename safe_ptr and ref_ptr to SafePtr and RefPtrMaxime Coste