Commit Graph

61 Commits

Author SHA1 Message Date
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
Maxime Coste
67a251ffd5 Pass a at_end param to BufferChangeListener::on_{insert,erase} 2014-05-13 19:01:27 +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
e0424ba017 Minor formatting fixes (very long lines) 2014-04-08 20:09:54 +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
eced7d4c24 SelectionList should never be empty 2013-12-14 14:38:17 +00:00
Maxime Coste
894ee0297e Move main selection index to SelectionList 2013-12-14 14:38:17 +00:00
Maxime Coste
3862b5cbb8 LineAndColumns: always pass by value 2013-07-26 01:50:09 +02:00
Maxime Coste
4ef1bfa4db Use coord instead of iterators for selections 2013-06-04 14:21:07 +02:00
Maxime Coste
3453ebbd52 BufferChangeListener: pass buffer to on_{inser,erase} 2013-06-01 00:48:46 +02:00
Maxime Coste
557acc5068 reorganize check_invariant in SelectionList 2013-05-30 13:59:38 +02:00
Maxime Coste
7f8d5c1fd0 Remove Range::content 2013-05-30 13:59:38 +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
9630990b74 Remove Selection::avoid_eol, move as static func in editor.cc
Conflicts:
	src/editor.cc
2013-05-29 18:53:57 +02:00
Maxime Coste
9cbf790d13 tweak Range::merge_with behaviour 2013-05-14 13:58:35 +02:00
Maxime Coste
4c4b6a404d add SelectionList::check_invariant 2013-05-03 18:44:26 +02:00
Maxime Coste
9b3e0c8055 Move selection update code to SelectionList 2013-05-02 19:04:59 +02:00
Maxime Coste
5adee4a6a7 rename assert to kak_assert to avoid collisions 2013-04-09 20:04:11 +02:00
Maxime Coste
2f410f62e4 Add String Range::content() const 2013-02-27 19:11:25 +01:00
Maxime Coste
cd8c36fc50 Add a debug option to Makefile, and use KAK_DEBUG define to remove debug code 2013-02-27 19:02:01 +01:00
Maxime Coste
3404366b65 add more asserts 2013-01-23 14:39:33 +01:00
Maxime Coste
cfd7ee049a move selection updating code out of selection, to DynamicSelectionList
this avoids a lot of unnecessary (add|remove)_change_listener as
creating temporary Selections do not call that anymore.

Use can choose between a SelectionList which or a DynamicSelectionList
depending on wethear the buffer will be modified or not during the
selections lifetime.
2012-12-13 18:50:27 +01:00