Commit Graph

84 Commits

Author SHA1 Message Date
Maxime Coste
d3ef2d36ea Add a SplitView container view 2016-03-25 20:38:26 +00:00
Maxime Coste
131b0a8298 Use ByteCoords directly for buffer insert/erase/replace 2016-03-16 13:59:30 +00:00
Maxime Coste
de1433d30a Avoid the spurious newline insertion when replacing at end of buffer
Add a Buffer::replace method to handle the replacements properly
Fixes #633
2016-03-16 13:48:11 +00: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
24411569fc Slight refactor in selection update code 2015-12-17 04:56:44 +00:00
Maxime Coste
d6a2d77857 Fix double check_invariant in SelectionList construction, and set main selection to last 2015-11-04 19:53:47 +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
d19df5d5de Enable more invariant checking in selection lists 2015-08-03 11:23:40 +01:00
Maxime Coste
6f337b254d Fix warning 2015-07-24 13:57:44 +01:00
Maxime Coste
8795a56731 Merge overlapping selections before erasing
Overlapping selections on erase confuse the ForwardChangeTracker
and will confuse the user,

Fixes #298
2015-06-28 10:16:39 +01:00
Maxime Coste
e1ba2991f5 Initial selection saving/restoring support bound to ^ and alt-^ 2015-06-27 11:02:08 +01:00
Maxime Coste
87fcfda508 Avoid buffer end in compute_modified_ranges 2015-06-05 13:10:30 +01:00
Maxime Coste
c38a7f3ca4 Merge branch 'diff' 2015-05-21 22:58:50 +01:00
Maxime Coste
43f7657151 Remove clamping in compute_modified_range
It can result in a non ordered range list.
2015-05-20 13:34:16 +01:00
Maxime Coste
f224d11ccd Small cleanup in selections.cc 2015-05-13 23:22:48 +01:00
Maxime Coste
8ff63198bc Comment out update_erase function (keeped for reference)
Fixes #254
2015-04-21 13:51:01 +01:00
Maxime Coste
eb9c95298e Add support for string <-> selection list serialization 2015-04-13 15:21:26 +01:00
Maxime Coste
1cec8df45e ArrayView content is not const anymore
As in upcoming std c++ array_view, ArrayView<T> points to mutable
data, use ArrayView<const T> or alias ConstArrayView<T> for const
data.
2015-03-09 13:54:09 +00:00
Maxime Coste
56dd5f9540 Fix selecting of insert text in SelectionList::insert 2015-02-09 21:09:17 +00:00
Maxime Coste
f4e96e7f2e Fix bug when deleting end of buffer text using multiple selections 2015-01-23 19:12:15 +00:00
Maxime Coste
da562e03a0 replace all std::vector with Vector 2015-01-12 13:58:41 +00:00
Maxime Coste
295a97f2a6 Rename memoryview to ArrayView 2015-01-06 13:43:37 +00:00
Maxime Coste
116ea7364a Restore some special behaviours, I missed them in interactive mode. 2014-12-19 13:58:33 +00:00
Maxime Coste
fc4d77964e Remove special case when appending at eol 2014-12-13 13:10:40 +00:00
Maxime Coste
b6f2b872b0 Preserve selection orientation when replacing
Fixes #31
2014-10-12 18:58:10 +01:00
Maxime Coste
d4a84125ef Use InternedStrings for buffer contents 2014-10-03 13:39:13 +01:00
Maxime Coste
0ac65e1610 Use std:move for selection parameters 2014-09-22 13:55:39 +01:00
Maxime Coste
6813440212 Fix Selection::insert when replacing with empty string at the end of the buffer 2014-07-25 23:47:11 +01:00
Maxime Coste
d181a40a91 Add support for paste all (on <a-[pP]>)
Paste all pastes all yanked text at all selections, selecting each
pasted text.

Replace paste moves to R, and concat yank/concat delete (Y and D)
are removed.

Fixes #161
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
af750ce186 Fix selection update 2014-06-12 21:23:49 +01:00
Maxime Coste
c28a61187b Fix handling of empty insert 2014-06-05 19:44:56 +01:00
Maxime Coste
26f69b199e Rework and fix corner cases in selection updating code 2014-06-05 19:44:56 +01:00
Maxime Coste
f7e89bc9f8 Fix selection updating, avoid overlapping selections 2014-06-02 17:36:46 +01:00
Maxime Coste
d33c27acdf Move compute_modified_ranges to selection.cc and use an optimized approach 2014-06-02 15:13:56 +01:00
Maxime Coste
23a1914d7e Optimize SelectionList::update in the case where changes are backward
This case arise on undo, reverse sorted changes that are not overlapping.
2014-06-02 02:16:19 +01:00
Maxime Coste
1b30c0f4fb Extract merge_overlapping as a free function template 2014-06-01 15:57:12 +01:00
Maxime Coste
cf03cc97ef formatting fix 2014-05-31 18:12:54 +01:00
Maxime Coste
49ab0c101a Use forward iteration on selections, and take advantage of it when updating
SelectionList::update now is optimized for the common case where changes
are sorted, the algorithm is O(m*n) with m the number of sorted ranges
in the changes. In the common case, m should be very small.
2014-05-29 05:48:40 +01:00
Maxime Coste
f49bec8021 Go back to Buffer::Change based implementation for SelectionList::update
However take into account the ordering of selections in insert and erase
methods, so that we update selection position cheaply.
2014-05-26 20:57:10 +01:00
Maxime Coste
51eae8026b Use SelectionList::insert in InputModes::Insert 2014-05-25 22:59:29 +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
Maxime Coste
eba98ecad4 Clamp modified coord in Selection as it could be buffer end 2014-05-24 02:14:51 +01:00
Maxime Coste
695c85f451 Fix, cleanup and refactor compute_modifications 2014-05-24 02:14:28 +01:00
Maxime Coste
2c52b8bca6 Add initial (and probably buggy) compute_modifications code
compute_modifications compiles a list of buffer change into
a list of Modifications that can be used for updating BufferCoord
2014-05-21 23:35:10 +01:00
Maxime Coste
4e280977a2 Iterate in reversed order on selections when modifing buffer
This way, update only needs to be called once everything is done
as we always modify after the next selection to be used.
2014-05-14 20:56:49 +01:00
Maxime Coste
bf98b38afd Use a plain SelectionList for Context, remove DynamicSelectionList 2014-05-14 19:49:04 +01:00
Maxime Coste
db423e4a88 utf8::is_character_start takes directly the char value 2014-05-14 19:49:03 +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