Commit Graph

144 Commits

Author SHA1 Message Date
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
Maxime Coste
b6b646e9a2 Remove use of 'offset' in buffer iterators, lines are just String
No need to maintain line offsets anymore.
2014-05-24 17:08:01 +01:00
Maxime Coste
11d9b60766 Make it harder to have an invalid SelectionList 2014-05-13 23:22:54 +01:00
Maxime Coste
ea3e92aa5e SelectionList know its buffer and timestamp 2014-05-13 20:09:06 +01:00
Maxime Coste
db8a4ca318 SelectionList no longer inherit from std::vector 2014-05-12 18:59:00 +01:00
Maxime Coste
8546788b43 Refactor LineAndColumn coordinates
BufferCoord -> ByteCoord
DisplayCoord -> CharCoord

Moved their definition along with LineAndColumn into coord.hh
2014-05-07 19:53:45 +01:00
Maxime Coste
e92e6c775a Paragraph selection selects next paragraph when on previous end 2014-05-04 11:21:19 +01:00
Maxime Coste
30bdc8936b Fix select_whole_lines on empty buffer 2014-04-10 20:14:11 +01:00
Maxime Coste
ac90839c3d Select previous sentence or paragraph if selecting backward from the first char
[s and [p on the first char of a sentence or paragraph will select the
previous sentence or paragraph.
2014-03-31 21:46:47 +01:00
Maxime Coste
c3a1318ffd When selecting forward paragraph and we are on an end of line, select the next one.
Fixes #62. Thanks to alexherbo2.
2014-03-30 11:13:45 +01:00
Maxime Coste
5079d78747 minor cleanup in select_whole_sentence 2014-03-30 11:13:37 +01:00
Maxime Coste
da9d099f3b Remove Range struct, merge it back in Selection 2014-03-29 08:55:45 +00:00
Maxime Coste
2159fc9563 Rename selections first,last to more explicit anchor,cursor 2014-01-28 19:06:52 +00:00
Maxime Coste
1e6fbf548b Fix some tabs in the code 2014-01-05 14:30:26 +00:00
Maxime Coste
8168cba1a3 Fix small misbehaviour in split_selections 2014-01-04 14:23:08 +00:00
Maxime Coste
3be77842db fix select_to_eol behaviour when on empty line
fixes #3
2014-01-03 19:00:19 +00:00
Maxime Coste
ce0e71aacb Remove Editor::select methods, add a non-const selections getter 2013-12-14 18:38:14 +00:00
Maxime Coste
0c4d523b22 Move template selectors to the header 2013-12-14 14:49:10 +00:00
Maxime Coste
77590fe2e8 Move (keep|flip|remove|clear)_selections from editor method to free selectors 2013-12-14 14:38:17 +00:00
Maxime Coste
dad27fe1a0 Remove simple selectors, always go through a multi selector 2013-12-14 14:38:17 +00:00
Maxime Coste
f53ba0baed MultiSelectors takes a reference to the current selection and mutate it 2013-12-14 14:38:17 +00:00
Maxime Coste
db048a0792 MultiSelectors now transforms the whole selection 2013-12-14 14:38:17 +00:00
Maxime Coste
c4de866903 Fix select_to_previous_word when cursor is on last buffer char 2013-11-12 18:59:19 +00:00
Maxime Coste
70e94cb00a Fix select_next_match that would select the end of the buffer in some circumstances 2013-11-04 21:59:28 +00:00
Maxime Coste
ab925686ab Improve object selection support
* A count is supported for nestable objects so that we
  can specify the surrounding level.
* more symetric behavior for select to end/ to begin
2013-10-08 19:28:18 +01:00
Maxime Coste
fccb954611 Use WordType enum instead of a bool punctuation_is_word for word selector 2013-10-07 18:44:22 +01:00
Maxime Coste
0267540985 Do not select the first line indent in inner indent select 2013-07-27 15:37:28 +02:00
Maxime Coste
3862b5cbb8 LineAndColumns: always pass by value 2013-07-26 01:50:09 +02:00
Maxime Coste
c58bab0f66 Add indent object type (bound to i) 2013-07-23 19:12:53 +01:00
Maxime Coste
37807ba19b Add support for arrow keys in normal mode
use a Direction enum instead of a bool forward parameter
2013-07-02 19:48:05 +01:00
Maxime Coste
245e68e26e utf8_iterators: rename underlying_iterator to base 2013-06-06 19:44:07 +02:00
Maxime Coste
6b667bc803 remove BufferIterator conversion to/from BufferCoord 2013-06-06 19:44:07 +02:00
Maxime Coste
9fb4d42408 remove BufferIterator::is_{begin,end} 2013-06-04 18:53:56 +02:00
Maxime Coste
cc70e3ed70 selectors.cc: avoid dereferencing buffer end 2013-06-04 14:21:07 +02:00
Maxime Coste
4ef1bfa4db Use coord instead of iterators for selections 2013-06-04 14:21:07 +02:00
Maxime Coste
b198f6a5fb Fix select_whole_paragraph so that buffer end is not selected 2013-06-03 14:27:51 +02:00
Maxime Coste
b51799a2b2 Explicitly pass buffer to selectors 2013-06-01 14:22:57 +02:00
Maxime Coste
93dd1ff3c7 Remove begin/end from Ranges, replace with min/max
Ranges should not be utf8 aware (needed for end), and a lot of
uses for end() were in fact looking for max.
2013-05-30 13:59:38 +02:00
Maxime Coste
9a80a58ff4 buffer end should not be in a selection 2013-05-30 13:59:38 +02:00
Maxime Coste
64b20729a5 Full object selection support for paragraphs and sentences 2013-05-15 14:24:09 +02:00
Maxime Coste
b69c9ea753 add paragraph (p) object 2013-04-30 14:29:18 +02:00
Maxime Coste
4bb3863f95 add sentence (s) object 2013-04-30 14:21:48 +02:00
Maxime Coste
86f6282cbe selecting a surrounding object goes up one level if what we find is already selected 2013-04-22 14:18:49 +02:00
Maxime Coste
d3961768ec add alt-X for trimming non full lines 2013-04-16 14:30:11 +02:00
Maxime Coste
270e950cf1 sort includes directives 2013-04-09 20:05:40 +02:00
Maxime Coste
1ab8120147 refactor regex based selectors, move regex construction out of them 2013-04-05 19:28:08 +02:00
Maxime Coste
ee800ad778 select_to_{,reverse}: search on other lines if needed 2013-03-18 23:47:18 +01:00
Maxime Coste
9230667c11 Add " and ' support to object selection 2013-02-27 19:08:13 +01:00
Maxime Coste
bba7152063 Add backward search support (bound to alt-/) 2013-01-08 18:46:45 +01:00
Maxime Coste
3f7bf82cde Support for selecting to surrounding object begin/end with [ and ] 2013-01-07 18:53:27 +01:00
Maxime Coste
2195d59b49 refactoring selectors 2013-01-03 14:30:14 +01:00
Maxime Coste
8bfb7da674 fix splitting with inverted selection 2012-12-27 18:56:06 +01:00
Maxime Coste
ac778c8aa2 select_matching: fix when matching is the first character 2012-12-27 13:41:45 +01:00
Maxime Coste
b764a0a63e Selection: refactoring, move CaptureList to Selection 2012-11-30 18:32:49 +01:00
Maxime Coste
dfafcdb6e6 utf8::codepoint: configurable invalid byte policy 2012-10-13 19:05:14 +02:00
Maxime Coste
c92077762c Makefile: add -Wall to CXXFLAGS 2012-10-11 01:17:29 +02:00
Maxime Coste
7a8366da2b add a unicode.hh header for Codepoint related functions, s/utf8::Codepoint/Codepoint/ 2012-10-09 19:15:05 +02:00
Maxime Coste
0a686573ab utf8 awareness in selectors 2012-10-08 19:12:09 +02:00
Maxime Coste
430765e132 extract is_alpha to string.hh 2012-09-30 16:23:18 +02:00
Maxime Coste
e86e3bda4d select_all_matches: reject match that start at the end of originating selection 2012-09-19 14:04:09 +02:00
Maxime Coste
ec57990060 whine when a search selected nothing so that the user knows 2012-09-12 19:09:10 +02:00
Maxime Coste
bbce6b22a3 remove regex.hh, define Regex directly in string.hh 2012-08-29 21:49:36 +02:00
Maxime Coste
0c596a9d64 Add a ShellManager which handles executing shell commands
ShellManager provides shell commands with environement variable
to retrieve some internal values in the shell parameters.
2012-05-03 07:25:13 +00:00
Maxime Coste
9337938403 replace std::string references with String 2012-04-14 01:17:09 +00:00
Maxime Coste
cd615b35a2 generalize do_select_surrounding in do_select_object and add a whole word selector 2012-03-12 14:23:30 +00:00
Maxime Coste
782b557660 factor word and WORD selectors 2012-03-07 19:20:32 +00:00
Maxime Coste
0a385885ff correctly handle boost::regex_error in selectors 2012-03-04 20:11:22 +00:00
Maxime Coste
1f854bc0cc fix select_surrounding when selection is on the closing char 2012-02-29 14:27:25 +00:00
Maxime Coste
46c614c4a2 fix skip_while 2012-02-16 14:28:22 +00:00
Maxime Coste
d84d085cc2 Merge captures into registers, implements register insertion 2012-02-09 23:47:55 +00:00
Maxime Coste
9b5e9ffee2 selectors now take a Selection as parameter instead of a BufferIterator 2012-02-07 14:26:51 +00:00
Maxime Coste
e02cb4e5bd Selectors: select_next_match starts from cursor+1
so searching effectively starts on the character after current
selection end. Which makes repeating 'n' on a one character match
work.
2012-01-09 14:22:52 +00:00
Maxime Coste
8b1b1d9cd8 Selectors: add select_surrounding to select blocks
Alt-a followed by []()<>{}bB selects the block surrounding current
selection end.

Alt-i is similar but selects only the inside of the block.
2012-01-04 14:18:08 +00:00
Maxime Coste
b1daf8de16 Selectors: fix select_line on the last line 2011-12-02 18:56:18 +00:00
Maxime Coste
2549a63c0b Selectors: fix corner cases on first/last buffer char 2011-11-24 18:46:35 +00:00
Maxime Coste
7b09b34cab Selectors: fix select_whole_lines 2011-11-22 18:58:05 +00:00
Maxime Coste
7861ad9ddb Selectors: add split_selection bound to Alt-s 2011-11-21 19:30:44 +00:00
Maxime Coste
b67c36358d Extract RegexSelector methods as plain selectors 2011-11-21 19:08:51 +00:00
Maxime Coste
2677fa7961 Add , to fully selects lines selection is on. 2011-11-21 18:53:22 +00:00
Maxime Coste
fbe8eed3e4 Selectors: select_line selects next line when cursor is on eol 2011-10-27 18:57:31 +00:00
Maxime Coste
5bd61a3f38 Filters: correct select_to_previous_WORD 2011-10-27 14:09:57 +00:00
Maxime Coste
2c8f3229c0 Selectors: add selectors for WORDs
WORDs are the same as vim's ones, i.e. a group of contiguous non blank
characters. They are bound as alt + word selector key.
2011-10-25 18:46:14 +00:00
Maxime Coste
80e7bac622 Selectors: remove unused move_select 2011-10-12 18:54:04 +00:00
Maxime Coste
7e84ca9ae9 gl and gh now go to first or last character of the line
append mode is supported through G key
2011-10-10 14:24:17 +00:00
Maxime Coste
d99bcd7f2e bind T and F as select_to_reverse non-inclusive and inclusive 2011-10-03 14:29:44 +00:00
Maxime Coste
610acb3c0e Selectors: add a count argument to select_to 2011-09-27 14:27:48 +00:00
Maxime Coste
639897517a Word selectors: better handling of line breaks 2011-09-25 23:50:13 +00:00
Maxime Coste
52ad372adb Selectors: support inclusive mode in select_to (bound to f key) 2011-09-23 14:06:10 +00:00
Maxime Coste
662ba0c904 Selection: do not use [begin, end) semantics but [first, last]
selections are now defined with inclusive iterators, which means that
Selection(cursor, cursor) is a valid selection of the charateter pointed
by cursor.

On the user interface side, that means that the cursor is now part of
the selection, selectors were adapted to this behavior (and word
selectors are now much more intuitive)
2011-09-23 09:17:19 +00:00
Maxime Coste
c3faeb6c05 Selectors: add select_to which selects until a given character on current line 2011-09-22 14:35:28 +00:00
Maxime Coste
0f4f201b6d Selectors: fix select_matching 2011-09-22 14:18:26 +00:00
Maxime Coste
a8cac32fe0 Selectors: more vi-like words movements 2011-09-22 14:00:31 +00:00
Maxime Coste
cff69b2556 Selectors: add a basic select_matching selector for <([{]])> pairs 2011-09-21 19:09:49 +00:00
Maxime Coste
3af66276f0 Move selectors function to their own file 2011-09-21 14:37:09 +00:00