Commit Graph

187 Commits

Author SHA1 Message Date
Maxime Coste
fd043435e5 Split compile time regex flags from runtime ones 2019-01-20 22:59:28 +11:00
Maxime Coste
8c2603ab3c Support re-using the same ThreadedRegexVM for multiple iterations
This should reduce the number of allocations as the memory allocated
for the thread stack and the saves can be re-used between runs instead
of being cleared every time.
2019-01-20 22:59:28 +11:00
Maxime Coste
566268d7bc Refactor RegexIterator to use a Sentinel 2019-01-20 22:59:28 +11:00
Maxime Coste
1553d91d27 Make '_' the default extra_word_chars, and remove built-in support
Fixes #2599
2018-11-27 18:16:21 +11:00
Jason Felice
feea0064d8 Simplify surround selection
This has the same effect with fewer conditions, and I think it also
specifies the intent more closely this way.
2018-10-27 13:49:45 -04:00
Frank LENORMAND
2d44712766 src: Implement <a-m> and <a-M>
Closes #2425
2018-09-30 19:56:37 +03:00
Jason Felice
83244af106 Don't skip opening brace twice when finding closing
Fixes #2367
Fixes #2129
2018-09-09 10:15:41 -04:00
dahlbaek
2a509ba73f Mark unused variables with the [[gnu::unused]] attribute 2018-07-02 19:33:52 +02:00
Maxime Coste
54b62cbef7 Do not expose C++ typeid().name to user facing errors on wrong option type
Fixes #2079
2018-05-26 10:01:26 +10:00
Maxime Coste
148d6c205b Fix wrong behaviour in select surrounding
Fixes #2030
2018-05-07 22:17:57 +10:00
Delapouite
cb02186c77 Make error messages more consistent 2018-04-06 16:56:53 +02:00
Maxime Coste
71a1893a5e Fix some trailing spaces and a tab that sneaked into the code base 2018-04-05 08:52:33 +10:00
Maxime Coste
59e9108812 indent selector: When line is empty, find indent from surrounding lines
Look for the first non empty line preceeding the current line, or
if not found, the first non empty line following it.

Fixes #1904
2018-03-25 10:25:56 +11:00
Maxime Coste
fb65fa60f8 Regex: take the full subject range as a parameter
To allow more general look arounds out of the actual search range,
pass a second range (the actual subject). This allows us to remove
various flags such as PrevAvailable or NotBeginOfSubject, which are
now easy to check from the subject range.

Fixes #1902
2018-03-05 05:48:10 +11:00
Maxime Coste
28716ec058 Change x behaviour to select full line first even if on EOL
x will always first select current line fully, and only then select
next line.
2018-03-01 15:34:31 +11:00
Maxime Coste
a25d6171d3 Fix crash in select_sentence when not selection to end
select_sentence could create a buffer iterator preceeding the
buffer begin, leading to a crash trying to read line -1.
2018-02-24 20:22:23 +11:00
Maxime Coste
e41b4ee65d Change m to search until the end of the buffer instead of end of line
Fixes #1774
 # Please enter the commit message for your changes. Lines starting
2018-01-31 11:10:18 +11:00
Maxime Coste
eeacb8b5a8 Use the _str and _sv string literals more often 2018-01-18 09:00:54 +11:00
Maxime Coste
6333ae207f Correctly set the NotBeginOfSubject/NotEndOfSubject flags for regex matching
Fixes #1778
2017-12-29 09:55:53 +11:00
Maxime Coste
73a239d3be Text-Objects: Use regex to select surroundings
Fixes #925
2017-12-03 17:15:24 +08:00
Maxime Coste
9a4b5de772 Regex: Introduce backward_regex_search helper function 2017-12-03 17:12:33 +08:00
Maxime Coste
7f51e51fcb Introduce matching_pairs option that controls the pairs used by m 2017-11-04 15:53:53 +08:00
Maxime Coste
8c8dcb3a84 Regex: Fix reverse searching behaviour, again 2017-11-01 14:05:14 +08:00
Maxime Coste
2b97e4e124 Regex: Fix handling of ^ and $ in backward matching mode 2017-11-01 14:05:14 +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
065bbc8f59 Regex: switch to custom impl, use boost for checking 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
5bf401948a Cleanup some code with C++14 features 2017-07-19 08:47:14 +02:00
Maxime Coste
f41d78083a Use the extra_word_chars option in word based normal commands
the completion_extra_word_chars is now gone, superseeded by
extra_word_chars that gets used both for completion and for normal mode.

Fixes #1304
2017-06-26 15:28:41 +01: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
477f0700f0 Remove useless Vector, use a ConstArrayView instead 2017-06-26 14:40:01 +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
Frank LENORMAND
0acb350619 src: Make the cursor character an opening delimiter
This commit allows the editor to consider the character under the cursor
as an opening delimiter when using an object selector, instead of
ignoring it and looking for one before the cursor.
2017-03-15 14:39:40 +03:00
Maxime Coste
cc88b0f586 Change word object selector to fail if the cursor is not on a word char 2017-03-04 18:33:50 +00:00
Maxime Coste
887232987c Refactor surround unit test code 2017-03-04 17:43:24 +00:00
Maxime Coste
ed3c48057d Refactor regex based selection code 2017-03-03 23:43:54 +00:00
Maxime Coste
1728c67fef Fix indent selection respect for original selection cursor position
Fixes #1233
2017-03-03 22:03:20 +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
dcd8f6ef01 Apply clang-tidy modernize to the codebase 2017-01-08 22:39:01 +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
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
fcb37cc754 Pass count to all object selectors 2016-09-26 23:32:07 +01:00
Maxime Coste
fafde8655b Fix select_to_reverse to correctly handle the first character of the buffer
Fixes #809
2016-09-19 09:20:55 +01:00
Maxime Coste
4d13e6fb88 Do not crash whenever S matches the whole selection and hence does not select anything
Fixes #787
2016-09-04 11:17:34 +01:00
Maxime Coste
56a7c6e594 Rework buggy number selection function
Fixes #765
Fixes #766
2016-08-22 13:54:22 +01:00
Maxime Coste
f51ba6089c Use variadic macros for kak_assert to remove the need for COMMA 2016-05-17 19:39:55 +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