Commit Graph

39 Commits

Author SHA1 Message Date
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
Maxime Coste
b764a0a63e Selection: refactoring, move CaptureList to Selection 2012-11-30 18:32:49 +01:00
Maxime Coste
77272db0fd make Buffer::{add,remove}_change_listener const and the listener list mutable 2012-11-12 20:11:27 +01:00
Maxime Coste
5a267ab627 selections should always point to an utf8 character sequence start byte 2012-10-08 14:26:57 +02:00
Maxime Coste
11d86ca3f3 fix Selection::merge_with 2012-09-05 14:27:48 +02:00
Maxime Coste
a2aefa2998 avoid keeping end of lines selected in Editor::erase 2012-08-15 18:20:02 +02:00
Maxime Coste
31c0931dff Go back to a generic BufferChangeListener interface for selection update 2012-07-16 21:51:37 +02:00
Maxime Coste
e4b872abd2 remove ModificationListener and use a list of iterators to update instead
This permits to fix a bug in BufferIterator::upgrade, replaced by
BufferIterator::on_insert and BufferIterator::on_erase. ModificationListener
was only used to updating iterators anyway.
2012-04-04 13:56:19 +00:00
Maxime Coste
0ba7c7286d Store buffer content in a list of lines
Instead of a big std::string, buffer now store it's content in a
list of lines. In order to achieve O(log(n)) random access, lines
contains both their content and their offset since the start of
the file, making binary search usable.

BufferIterator now have a LineAndColumn coordinate into the buffer
instead of an offset so that access is still O(1).
2012-03-30 11:37:18 +00:00
Maxime Coste
7f175da3fd Selection: handle last buffer character deleted case 2012-02-22 22:03:11 +00:00
Maxime Coste
d84d085cc2 Merge captures into registers, implements register insertion 2012-02-09 23:47:55 +00:00
Maxime Coste
69d96c90da extract an Editor class from Window and refactor 2012-01-31 19:12:06 +00:00