Commit Graph

173 Commits

Author SHA1 Message Date
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
Maxime Coste
25a31534ec Fix splitting selecting the first buffer char when there is a match at buffer begin 2016-04-30 10:37:31 +01:00
Maxime Coste
9e15181dc9 Rework container helpers, use pipe syntax and cleanup implementation
use 'container | filter(func) | reverse() | transform(func)' instead
of 'transform(reverse(filter(container), func), func)' to express
container transformations.
2016-03-08 21:35:56 +00:00
Maxime Coste
f3ec218a1c Support user given text objects 2016-01-28 19:30:34 +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
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
12abb54a88 Slightly more performant regex capture gathering in select_all_matches 2015-11-09 08:42:12 +00:00
Maxime Coste
48a296dc71 Avoid an unneeded call to ensure_char_start 2015-11-04 20:10:12 +00:00
Maxime Coste
e82ca36117 Avoid unneeded sort_and_merge_ovelapping call in select_all_matches 2015-11-04 19:43:25 +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
Viktor Palmkvist
1bdaf0675d Argument text object no longer handles <> 2015-08-25 15:56:49 +02:00
Maxime Coste
58101645ab Rewrite select_lines and trim_partial_lines
Fixes #338 for real (I hope)
2015-07-23 21:03:38 +01:00
Maxime Coste
889bc98866 fix crash in trim_partial_lines
Fixes #338
2015-07-23 13:46:20 +01:00