Commit Graph

101 Commits

Author SHA1 Message Date
Maxime Coste
63371da8aa Avoid to_remove vector in select helper function
Remove the need to allocate anything when removing selections.
2020-05-29 12:00:02 +10:00
Jason Felice
0f58f01428 Fix display column computations
Closes #3201
2019-11-12 20:43:14 -05:00
Maxime Coste
e964b68ab8 Add support for selecting and exporting selections in display columns
Fixes #2724
2019-11-12 21:56:45 +11:00
Maxime Coste
7a8f57f97b Add support for a -codepoint switch to the select command 2019-11-12 21:21:24 +11:00
Jason Felice
5fae16faef Implement %val{selections_char_desc}
Fixes #3194
2019-11-12 20:54:32 +11:00
Jason Felice
d26bb0ce2b Add static or const where useful 2019-11-09 12:53:45 -05:00
Jason Felice
c9fce9f83d Merge selection list parsing into selection_list_from_strings 2019-11-07 14:51:04 -05:00
Maxime Coste
1ebea85e6f Do not merge selections on backspace in insert mode
Fixes #2861
2019-05-29 23:12:04 +10:00
Maxime Coste
baae0c899b Add -timestamp switch support to the select command
Fixes #2829
2019-04-01 22:11:18 +11:00
Maxime Coste
94796509a0 Fix bug in 'itersel' handling that could result in unsorted selections 2019-02-11 21:48:09 +11:00
Maxime Coste
4cb402ac1a Remove references to SelectionList from selectors 2019-02-04 12:52:55 +11:00
Maxime Coste
7f9fe32f2d Remove target_eol and small code cleanups 2019-02-04 12:52:48 +11:00
Maxime Coste
36e9e7eaf9 Change pipe diffing to work linewise
This should greatly improve performances as we only need to diff
lines instead of individual characters.

Closes #2678
Fixes #2037
2019-01-23 20:20:54 +11:00
Maxime Coste
124a5d4905 Tolerate restoring invalid coordinates from register
Clamp those selection after updating them to the current timestamp

Fixes #2078
2018-07-05 07:54:28 +10:00
Maxime Coste
d6c6ed9bbf Store each selection as a separate element in a register
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-05 07:54:28 +10:00
Maxime Coste
8b2e5ea862 Make selection lists use the option list syntax 2018-07-05 07:54:28 +10:00
Maxime Coste
a2fc89a6ec Remove SelectionList::update_timestamp()
This single line member function was only used once, inline it
directly.
2018-03-04 10:35:24 +11:00
Maxime Coste
67424aae1e Remove avoidance of end of lines
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-02-25 00:05:05 +11:00
Maxime Coste
e74b581b0a Save/restore main selection from/to strings
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
2018-01-12 07:51:19 +11:00
Maxime Coste
82d23bc400 Remove now trivial Selection::merge_with method 2017-08-18 08:52:40 +07:00
Maxime Coste
53f5b3d709 Fix an assert in compute modified ranges when merging single char ranges
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-07-14 12:42:43 +09:00
Maxime Coste
a88e58763b Move SelectionList::set implementation out of the header 2017-03-15 16:51:55 +00:00
Maxime Coste
6759511b9e Ensure main selection index is correct directly in SelectionList::remove 2017-03-03 20:17:11 +00:00
Maxime Coste
bc0dfa9e8f Use <a-'> for backward rotate selection and move rotate content to <a-"> 2017-02-01 22:53:42 +00:00
Maxime Coste
4916ea1766 Fix capture group handling
Fixes #1129
2017-01-13 00:17:31 +00:00
Maxime Coste
1b9f363225 Fix bug relying on undefined arg evaluation order. 2017-01-03 23:17:08 +00:00
Maxime Coste
4295736c97 Fix handling of main selection when copying selection to next/previous lines
Fixes #1095
2017-01-03 18:41:45 +00:00
Maxime Coste
cdb2c766a5 Refactor SelectionList::insert a bit 2017-01-01 17:31:47 +00:00
Maxime Coste
35559b65dd Support codepoints of variable width
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-10-01 13:45:00 +01:00
Maxime Coste
b934bcd4e1 Support merging consecutive selections with <a-m>
Fixes #773
2016-08-27 11:20:38 +01:00
Maxime Coste
8cc27354e8 Support sorting and merging overlapping separately, fix bug in move
Fixes #754
2016-07-30 15:32:47 +01:00
Maxime Coste
88a9607552 Keep modified selections in non-draft exec/eval -itersel
Fixes #727
2016-07-08 09:52:10 +01:00
Maxime Coste
5217089902 Fix uses of non-keyword logical operators (replace &&, || and ! with and, or and not) 2015-12-27 23:28:34 +00:00
Maxime Coste
5173dad470 Add some missing memory domains 2015-09-12 10:51:16 +01:00
Maxime Coste
e1ba2991f5 Initial selection saving/restoring support bound to ^ and alt-^ 2015-06-27 11:02:08 +01:00
Maxime Coste
eb9c95298e Add support for string <-> selection list serialization 2015-04-13 15:21:26 +01:00
Maxime Coste
1cec8df45e ArrayView content is not const anymore
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-03-09 13:54:09 +00:00
Maxime Coste
8df77121d7 Rename safe_ptr and ref_ptr to SafePtr and RefPtr 2015-02-19 13:58:25 +00:00
Maxime Coste
32319aca45 Add support for per type default memory domain 2015-01-16 13:58:21 +00:00
Maxime Coste
da562e03a0 replace all std::vector with Vector 2015-01-12 13:58:41 +00:00
Maxime Coste
295a97f2a6 Rename memoryview to ArrayView 2015-01-06 13:43:37 +00:00
Maxime Coste
5092494427 Add support for target column preservation
Fixes #64
2014-09-09 19:42:57 +01:00
Maxime Coste
d181a40a91 Add support for paste all (on <a-[pP]>)
Paste all pastes all yanked text at all selections, selecting each
pasted text.

Replace paste moves to R, and concat yank/concat delete (Y and D)
are removed.

Fixes #161
2014-07-05 12:10:06 +01:00
Maxime Coste
d33c27acdf Move compute_modified_ranges to selection.cc and use an optimized approach 2014-06-02 15:13:56 +01:00
Maxime Coste
1b30c0f4fb Extract merge_overlapping as a free function template 2014-06-01 15:57:12 +01:00
Maxime Coste
9006b31472 remove reverse iterator from SelectionList 2014-05-31 11:56:48 +01:00
Maxime Coste
49ab0c101a Use forward iteration on selections, and take advantage of it when updating
SelectionList::update now is optimized for the common case where changes
are sorted, the algorithm is O(m*n) with m the number of sorted ranges
in the changes. In the common case, m should be very small.
2014-05-29 05:48:40 +01:00
Maxime Coste
f49bec8021 Go back to Buffer::Change based implementation for SelectionList::update
However take into account the ordering of selections in insert and erase
methods, so that we update selection position cheaply.
2014-05-26 20:57:10 +01:00
Maxime Coste
51eae8026b Use SelectionList::insert in InputModes::Insert 2014-05-25 22:59:29 +01:00
Maxime Coste
b2621ca140 Move insert/erase methods from normal.cc to member functions in SelectionList
It does look like the Editor class is attempting a sneaky comeback...
2014-05-25 20:28:32 +01:00