Commit Graph

116 Commits

Author SHA1 Message Date
Maxime Coste
5d17e1132f Ensure that the capture group actually matched in select_matches
We were creating selections from default constructed iterators,
which happened to have 0,0 coords and led to out-of-order selection
lists.

Fixes #3757
2020-09-22 21:14:40 +10:00
Maxime Coste
3c34de7fe7 Remove explicit sizes from make_array calls 2019-10-17 22:48:22 +11:00
Justin Frank
29342836a6 Fixed Selection being defined as a struct and class 2019-02-27 22:45:31 -08:00
Jason Felice
7cf6eddc30 Add object mode expansions 2019-02-17 20:18:19 -05: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
fd043435e5 Split compile time regex flags from runtime ones 2019-01-20 22:59:28 +11:00
Frank LENORMAND
2d44712766 src: Implement <a-m> and <a-M>
Closes #2425
2018-09-30 19:56:37 +03:00
Maxime Coste
73a239d3be Text-Objects: Use regex to select surroundings
Fixes #925
2017-12-03 17:15:24 +08:00
Maxime Coste
1c95074657 Make use of custom regex backward searching support for reverse search 2017-11-01 14:05:14 +08:00
Maxime Coste
43d470f286 Slight cleanup of select_surrounding implementation 2017-10-28 13:43:04 +08:00
Maxime Coste
079cfbc6ac Remove unused forward declaration 2017-10-10 10:52:58 +08:00
Maxime Coste
dc378aed72 Pass a context instead of just the buffer to selector functions 2017-06-26 14:56:50 +01:00
Maxime Coste
e44f95820e Fixes some clang-tidy warning and add a few missing meta.hh include 2017-03-16 23:34:02 +00:00
Maxime Coste
7d9f1df73a Small code tweaks regarding flags handling 2017-03-15 18:25:59 +00:00
Maxime Coste
db9b863222 Migrate WithBitOps template specialization to with_bit_ops function
This way we dont depend on knowing the base template to enable bit ops
on an enum type.
2017-03-15 18:00:58 +00:00
Maxime Coste
ddc5e958e6 Return an optional selection in most selectors, fail rather than keep current
Instead of returning the current selection when a selector fails, return
an empty Optional<Selection>. That means object selections will now
remove the selections that dont match the object.
2017-03-03 20:17:11 +00:00
Maxime Coste
7ba24c043a Add gi to go to first non-blank character on line
Fixes #407
2017-01-22 23:53:08 +00:00
Maxime Coste
7316afd17b Use ints instead of unsigned for capture count 2017-01-16 18:49:27 +00:00
Maxime Coste
3c1f606a22 Move some template code out of selectors.hh into selectors.cc 2017-01-01 19:30:02 +00:00
Maxime Coste
7a04efb6d9 Force wrapping when searching from buffer end
Fixes #868
2016-10-23 21:03:15 +01:00
Maxime Coste
9078039326 Fix select_to_previous_word with spaces at buffer start
Fixes #844
2016-10-05 23:42:36 +01:00
Maxime Coste
a51d5a1046 Do not select the next word for inner word. 2016-10-03 20:01:37 +01: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
696db111e2 Selecting 'around' word when on spaces after word now selects next word 2016-09-26 23:33:28 +01:00
Maxime Coste
fcb37cc754 Pass count to all object selectors 2016-09-26 23:32:07 +01:00
Maxime Coste
532ae5a1a6 Do not go backward to when selecting to end of line from the end of line
Fixes #699
2016-06-22 19:56:40 +01:00
Maxime Coste
abac6a9436 Use boost::wregex implementation and manually utf8 decode into it
That way we get proper unicode support in regular expressions as long
as the current locale treats wchar_t as unicode codepoints.

Fixes #638
Fixes #595
Fixes #162
2016-05-10 09:38:21 +01:00
Maxime Coste
bff9d45bdb Make utf8_iterator codepoint type and difference type configurable 2016-05-09 21:56:08 +01:00
Maxime Coste
fb2fb3811f Tweak useage of skip_while and move the functions in utils.hh 2016-03-06 15:12:36 +00:00
Maxime Coste
1138264a83 Notify when searching for next match wraps around buffer
Fixes #215
2016-02-29 13:50:18 +00:00
Maxime Coste
a8eddd03f0 String usage cleanups 2016-02-04 23:54:22 +00:00
Maxime Coste
b7530b021a StringView based surround selection 2016-01-27 19:36:31 +00:00
Maxime Coste
04119d6207 Make find_surrounding more reusable and add unit tests 2016-01-26 07:23:18 +00:00
O. Perret
6a8507ce40 Keep match whose end is closest to the selection in reverse regex
search.
2015-12-27 16:53:52 +01:00
Maxime Coste
1d748a4017 Pass flags to the regex engine to correct anchors
Current behaviour was matching ^ $ for the current search start/end
(and \b was always matching begin/end as well).

Fixes #536
2015-12-23 22:20:25 +00:00
Maxime Coste
f66bbdf209 select/split interpret count parameter as the capture group to use
count being 0 by default, we use the whole match, but we can now
specify to use capture 1 with 1s<regex><ret>.
2015-11-26 13:36:26 +00:00
Maxime Coste
27571a7716 Refactor utf8::iterator to be on the safe side
utf8::iterator now knows the iterator valid range, and pass
it to utf8 functions.
2015-09-23 19:39:21 +01:00
Maxime Coste
e0049bb587 Fix backward search searching from on char before the corret one.
Fixes #406
2015-09-14 14:28:45 +01:00
Viktor Palmkvist
13d212f445 Added argument text object 2015-07-01 17:42:10 +02:00
Maxime Coste
66866aafd3 Change gl/gh to only move cursor, not selecting (<a-h>/<a-l>) are unchanged
That is more consistant with other goto commands (that just move the cursor)
2015-06-08 13:51:06 +01:00
Maxime Coste
8f6fc6a0f3 Port even more code to use format function 2015-06-01 21:15:59 +01:00
Maxime Coste
bf02838816 Remove is_blank, which is identical to is_horizontal_blank 2015-04-15 00:34:00 +01:00
Maxime Coste
adaf6ecc40 Move skip_while helpers to selectors.hh 2015-03-29 20:03:09 +01:00
Maxime Coste
0fbbd64681 small formatting tweak 2015-03-27 13:20:37 +00:00
Maxime Coste
94bd32572d Move some only used once inline functions directly in their caller
No need to have that in a header, and not really selectors anyway
2015-03-26 13:34:21 +00:00
Maxime Coste
757366472b Add <alt-:> for ensuring selections are forward (cursor >= anchor)
Not very useful interactively, but that feature can make macros much
more robust.
2015-03-26 13:34:21 +00:00
Maxime Coste
bc7c3987e1 Convert CodepointPair to struct MatchingPair 2015-03-04 20:47:14 +00:00
Maxime Coste
18eec7e511 Regex selectors more tolerant to matches not ending on char boundaries 2015-02-02 22:54:05 +00:00
Maxime Coste
3e797a3d15 centralize bit operation support for enum used as flags 2014-10-23 19:02:39 +01:00