Commit Graph

62 Commits

Author SHA1 Message Date
Maxime Coste
f9e31856cf Buffer: Allow inserting at the end when the inserted text ends with an end of line
Adapted other code in consequence and added unit tests so that this behavior
is maintained.
2012-09-10 19:26:17 +02:00
Maxime Coste
aac30a27e7 use more constexpr 2012-09-04 23:54:10 +02:00
Maxime Coste
e4fd839dda use a strongly typed int CharCount for character counts 2012-08-23 23:56:35 +02:00
Maxime Coste
0d8cce2728 use a strongly typed int LineCount for line counts 2012-08-22 23:33:52 +02:00
Maxime Coste
0eaf39b725 Add Buffer::iterator_at_line{begin,end}(size_t line) overloads 2012-08-21 20:52:49 +02:00
Maxime Coste
416785f53c Add BufferIterator::clamp(bool avoid_eol) method 2012-08-15 18:18:12 +02:00
Maxime Coste
390d4ccdfc Buffer::{iterator_at,clamp} takes an optional avoid_eol parameter
when avoid_eol is true, clamping does avoid end-of-line if possible
2012-08-15 18:06:59 +02:00
Maxime Coste
5393e9e78b Buffer: add a timestamp 2012-08-15 17:07:53 +02:00
Maxime Coste
4e34f777b0 Buffer: stronger invariant, a buffer is never empty and all lines finish by '\n' 2012-08-14 14:13:10 +02:00
Maxime Coste
759319ca44 Buffer: move back Modification as an implementation detail
* Filters now only works on insertion and take directly the
   iterator and content
 * use Buffer::insert and Buffer::erase to modify a buffer
2012-08-10 19:12:43 +02:00
Maxime Coste
c7fc2a9317 Buffer: add reset_undo_data method 2012-08-10 14:21:32 +02:00
Maxime Coste
e5c46d7c45 Window,Buffer: add const overload for {option,hook}_manager 2012-08-10 14:21:01 +02:00
Maxime Coste
1ede3f6b13 BufferIterator: use default operator= 2012-08-08 18:51:30 +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
49e1d91804 Buffer: pass by value instead of by reference when object will be copied anyway
Let copy elision and move semantics kick in
2012-06-29 13:19:29 +02:00
Maxime Coste
4dfc910195 BufferManager use safe_ptr to reference the Buffers 2012-06-28 13:45:42 +02:00
Maxime Coste
ccec35f88c code cleanups in buffer 2012-06-25 19:05:32 +02:00
Maxime Coste
9bcfda3226 HookManager are now hierarchical from window to buffer to global
window hooks also executes buffer hook which also execute global hooks
2012-06-07 13:29:44 +00:00
Maxime Coste
30d9e10ac6 DisplayBuffer optimization, suppressed some paranoid checks 2012-05-29 00:33:55 +00:00
Maxime Coste
9337938403 replace std::string references with String 2012-04-14 01:17:09 +00: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
f3dd65fbf1 add an OptionManager class and use it to manage tabstops
OptionManager map names to options, and may delegate option resolution
to it's parent if it does not contains the asked for option. That way
Buffers can override global options, and Windows can override Buffer
options.
2012-04-03 13:39:20 +00:00
Maxime Coste
2e7cd2233c add a Line::length method 2012-03-30 12:00:40 +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
3dd82a2b85 get rid of Buffer::at 2012-03-19 14:04:33 +00:00
Maxime Coste
3c105592e0 get rid of Buffer::compute_lines 2012-03-12 21:31:27 +00:00
Maxime Coste
df0f7b4689 rename BufferString to String 2012-03-08 21:23:29 +00:00
Maxime Coste
a386315bde Buffer: optimize line updating when applying a modification 2012-02-22 21:54:25 +00:00
Maxime Coste
96101b4392 Use an Editor instead of a Window as much as possible 2012-02-02 20:48:03 +00:00
Maxime Coste
3ef9895a97 Buffer: support creation of temporary windows to apply commands when no windows are in context 2012-01-31 14:03:10 +00:00
Maxime Coste
830d96f7a1 Buffer: add NewFile buffer type for buffer with an non existing yet file 2012-01-31 14:01:48 +00:00
Maxime Coste
50ce3d1549 Document some Kakoune concepts, as Window, Buffer, DisplayAtom... 2012-01-11 14:21:58 +00:00
Maxime Coste
2239fb6e49 Filters: move from buffer to window 2011-12-07 14:29:10 +00:00
Maxime Coste
c40eb2b03a Buffer: replace insert and erase methods with modify
modify directly takes a Modification as parameter
2011-12-07 14:26:40 +00:00
Maxime Coste
2edddfe009 Buffer: rename BufferModification to Modification 2011-12-06 18:58:43 +00:00
Maxime Coste
4ae2fcffbd Buffer: add comment for clamp 2011-12-05 19:21:11 +00:00
Maxime Coste
94d59cc4dd Buffer: add filter support
filters are functions called prior to applying a modification
to a buffer. They can manipulate the modification to change
the editor behaviour.
2011-12-02 14:28:27 +00:00
Maxime Coste
b24dec89a2 Buffer: add iterator_at_line_{begin,end} methods 2011-11-28 19:31:29 +00:00
Maxime Coste
51ee0b61f4 DynamicBufferIterator: use const_cast instead of having a mutable field in Buffer 2011-11-28 18:55:17 +00:00
Maxime Coste
dc642f8afa Buffer: refactor to remove do_{insert,erase} methods 2011-11-27 18:41:25 +00:00
Maxime Coste
cebb7980cb Buffer: tweak default content 2011-11-04 09:10:05 +00:00
Maxime Coste
9cf7cb682c Buffer: fix modified handling 2011-11-03 13:44:02 +00:00
Maxime Coste
62482b65ec rename buffer_iterator.inl.h to buffer_iterator.inl.hh 2011-10-27 14:13:39 +00:00
Maxime Coste
d2c6ceb47b DynamicBufferIterator: add and use in Selections
DynamicBufferIterator are a new type of BufferIterators that
automatically update themselves when their buffer is modified.

Selections now uses this type of iterators instead of plain ones
2011-10-24 14:26:21 +00:00
Maxime Coste
bace526fa3 Buffer: not copyable, add destructor 2011-10-24 14:23:13 +00:00
Maxime Coste
8cab34d57f Buffer: add support for modification listeners 2011-10-18 00:55:45 +00:00
Maxime Coste
d48a2bd325 BufferIterator: move methods implementation to buffer_iterator.inl.h 2011-10-17 22:05:06 +00:00
Maxime Coste
53ce1e016a Buffer: move struct Modification out of class, as BufferModification 2011-10-17 14:12:15 +00:00
Maxime Coste
dc74934e59 DisplayBuffer: refactoring, correct support of replacements
DisplayAtoms now know where they are on the screen and have
line_and_column_at and iterator_at methods.
2011-10-15 04:45:49 +00:00
Maxime Coste
c5be69a9a9 BufferCoord: allow explicit construction from all LineAndColumns 2011-10-14 14:27:43 +00:00