Commit Graph

100 Commits

Author SHA1 Message Date
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
Maxime Coste
fa85f0fc32 Refactor regex uses, do not reference boost except in regex.hh 2014-10-13 13:14:23 +01:00
Maxime Coste
c94b343c65 Start regex search from selection min/max depending on search direction 2014-10-09 18:55:58 +01:00
Maxime Coste
3ea690a92e Fix finding next match when the cursor is in the middle of the only match 2014-10-01 13:54:33 +01:00
Maxime Coste
9beba90060 Finding next matches start from seleciton min/max instead of cursor
uses min for backward serching, max for forward searching.
2014-09-26 00:27:23 +01:00
Maxime Coste
ecf8047bcc Fix reverse search when extending 2014-09-25 13:29:53 +01:00
Maxime Coste
dd2bdea8dd Keep selection direction on split/select/search 2014-09-18 00:34:23 +01:00
Maxime Coste
5092494427 Add support for target column preservation
Fixes #64
2014-09-09 19:42:57 +01:00
Maxime Coste
9439d28028 More consistent <space> and <a-space> behaviour
<space> and <a-space> without count now remove all except/keep
main selection. Without reducing main selection to cursor.

Reduce to cursor is moved to ';' and flip selections to <a-;>
2014-07-05 12:10:06 +01:00
Maxime Coste
ed68d1ff28 utf8: use end of sequence iterators for more security 2014-07-05 12:10:06 +01:00
Maxime Coste
5b27b956ad Rename utf8::utf8_iterator to utf8::iterator 2014-06-24 19:10:57 +01:00
Alex Leferry 2
d5b1605df5 add ' ' for whitespaces object 2014-06-11 20:48:38 +01:00
Maxime Coste
1ffafa8650 Merge branch 'master' into remove-buffer-change-listener 2014-06-06 00:22:46 +01:00
Maxime Coste
72d6ed3575 Add 'n' for number object (inner number does not recognise '.') 2014-05-27 09:50:12 +01:00
Maxime Coste
e1c9e42213 Merge branch 'master' into remove-buffer-change-listener
Conflicts:
	src/normal.cc
	src/selectors.cc
	src/selectors.hh
2014-05-27 00:35:12 +01:00
Maxime Coste
9aa38a1ea0 Rename select_whole_.* to just select_.* 2014-05-26 21:44:57 +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