Maxime Coste
d5b190369a
DisplayBuffer: use coords rather than iterators
2013-05-30 13:59:38 +02:00
Maxime Coste
6c290eff9a
Buffer::do_{erase,insert} takes coord parameters rather than iterators
...
BufferChangeListeners do as well use coord rather than iterators
2013-05-29 18:58:20 +02:00
Maxime Coste
f23f48172f
Buffer: add some method to work directly with coord instead of iterators
2013-05-29 18:58:20 +02:00
Maxime Coste
d238707e6d
Fix UndoGroupOptimizer
2013-04-30 19:01:20 +02:00
Maxime Coste
bef48b7df0
Fix UndoGroupOptimizer
2013-04-29 14:25:38 +02:00
Maxime Coste
7ce3212fb2
When committing an undo group, run an optimization pass on it
...
With incremntal insertion, undo groups tends to be a lot of single
character insertion/deletions at the same point, but the end
result is most of the time a single string insertion. Buffer
now tries to optimize the undo group.
2013-04-26 18:48:31 +02:00
Maxime Coste
b16c967f9c
Buffer::Modification::Position is a BufferCoord instead of a BufferIterator
2013-04-26 18:46:42 +02:00
Maxime Coste
f8c3b6c9ef
Buffer: rename character_count method to byte_count
2013-04-24 13:56:36 +02:00
Maxime Coste
72ef210e1b
Buffer: add is_valid(BufferCoord) method
2013-04-23 18:46:18 +02:00
Maxime Coste
681f30dd28
support renaming buffers
...
Changing buffer name allows to save a *make* or *grep* buffer when
launching another one for exemple.
2013-04-22 13:49:07 +02:00
Maxime Coste
b6d21514e4
BufOpen hook is only called for file buffers
2013-04-12 19:11:28 +02:00
Maxime Coste
270e950cf1
sort includes directives
2013-04-09 20:05:40 +02:00
Maxime Coste
5adee4a6a7
rename assert to kak_assert to avoid collisions
2013-04-09 20:04:11 +02:00
Maxime Coste
1fd99e7e88
do not check buffer invariant in do_{erase,insert} as this cause O(n²) behaviour
2013-04-04 14:04:37 +02:00
Maxime Coste
9429b662ca
move absolute path logic to Buffer class
2013-03-25 19:58:23 +01:00
Maxime Coste
df79b7610a
utf8 validity is not a buffer concern
2013-03-20 19:26:46 +01:00
Maxime Coste
a11a162734
Buffer: optimize do_insert to minimize changes in m_lines vector
2013-03-18 19:45:17 +01:00
Maxime Coste
84e3c99c93
Buffer::on_erase: avoid resizing lines more than necessary
2013-03-15 14:15:29 +01:00
Maxime Coste
c1db67e31a
Buffer: minor refactoring
2013-03-13 14:36:10 +01:00
Maxime Coste
161e32e137
fix warning
2013-02-28 18:51:24 +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
4b11f73f1e
buffer: remove too slow check from check_invariant
2013-02-22 18:38:53 +01:00
Maxime Coste
6573f16dd9
Buffer: commit current undo group before attempting to undo anything
2013-02-20 14:23:52 +01:00
Maxime Coste
9f4498e035
Buffer: replace {begin,end}_undo_group with a single commit_undo_group method
2013-02-20 14:20:16 +01:00
Maxime Coste
3d430e14c4
Buffer: small fix in apply_modification
2013-01-28 13:45:32 +01:00
Maxime Coste
54725ebcca
Buffer::do_insert: fix on_insert call when inserting at the end
2013-01-24 14:08:24 +01:00
Maxime Coste
410067282a
Buffer: end is either one past last character, or one past last line
2013-01-23 18:52:42 +01:00
Maxime Coste
72cc61c987
add undo unit_test and fix Buffer
2013-01-23 14:39:33 +01:00
Maxime Coste
3404366b65
add more asserts
2013-01-23 14:39:33 +01:00
Maxime Coste
f14bc5e310
Buffer: small style fixes
2013-01-23 13:47:45 +01:00
Maxime Coste
1b53b92267
Buffer: check that newlines are at the end of lines
2013-01-22 14:28:15 +01:00
Maxime Coste
621be2ceab
Hooks now takes a non-const context
2013-01-17 13:45:43 +01:00
Maxime Coste
914ede7a82
Add and use a Set template class for recuring small sets
2013-01-11 14:28:13 +01:00
Maxime Coste
9531fd5915
Buffer loses the 'New' flag when written
2012-12-28 13:52:19 +01:00
Maxime Coste
6c901e9152
Buffer: close undo group when saved
2012-12-19 18:56:20 +01:00
Maxime Coste
f1b15ef86b
fix buffer creation on empty file
2012-11-27 13:39:35 +01:00
Maxime Coste
c32a7b9b74
Buffer takes a vector of lines as initial content
2012-11-23 18:42:07 +01:00
Maxime Coste
2523c4955b
buffer: increment timestamp on notify saved
2012-11-23 13:41:07 +01:00
Maxime Coste
11e885e5a5
Cleanups and minor refactoring on Buffer
2012-11-22 18:54:37 +01:00
Maxime Coste
08ad8e8a40
move Window ownership to the ClientManager instead of the Buffer
2012-11-22 14:08:55 +01:00
Maxime Coste
3b5530ac09
rename (hook|option)_manager to (hook|option)s.
...
And Global(Hook|Option)Manager to Global(Hook|Option)s
2012-11-22 13:50:29 +01:00
Maxime Coste
d1fade5c9e
Buffer: replace reset_undo_data with a NoUndo flag
2012-11-21 13:43:10 +01:00
Maxime Coste
ac6171686d
minor fixes to buffer constructor
2012-11-21 13:37:36 +01:00
Maxime Coste
8bbfbc8c72
Buffer: replace Buffer::Type with Buffer::Flags
2012-11-20 19:47:56 +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
fedabb4176
Rework Window creation, avoid using the same window in multiple clients
2012-11-05 19:15:42 +01:00
Maxime Coste
c947819154
Fix buffer iterator_at_line_{begin,end}(LineCount)
2012-10-31 14:28:03 +01:00
Maxime Coste
c92077762c
Makefile: add -Wall to CXXFLAGS
2012-10-11 01:17:29 +02:00
Maxime Coste
0ce6bd9bf5
use ByteCount instead of CharCount when we are really counting bytes
...
(that is most of the time when we are not concerned with displaying)
2012-10-11 00:41:48 +02:00
Maxime Coste
194bf6ac98
Buffer: add some utf8 sanity checks
2012-10-08 19:25:17 +02:00
Maxime Coste
9ec10daf69
move clamp to utils.hh
2012-10-02 14:08:09 +02:00
Maxime Coste
e39086cd5f
Buffer: reset undo data after executing hooks in constructor
2012-09-11 19:03:37 +02:00
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
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
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
260b30e6d9
misc cleanups
2012-08-15 17:55:58 +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
54b599c1a7
Buffer: fix corner case in insert
2012-08-10 14:22:57 +02:00
Maxime Coste
c7fc2a9317
Buffer: add reset_undo_data method
2012-08-10 14:21:32 +02:00
Maxime Coste
ce99856bfa
Refactor BufferManager
2012-08-08 19:36:40 +02:00
Maxime Coste
18ca422306
Context: only buffer context are not allowed, an editor is always needed
2012-08-05 20:12:43 +02:00
Maxime Coste
23f72851e4
Buffer: fix insert at end of buffer
2012-08-02 07:04:04 +02:00
Maxime Coste
4908b2c3ef
Fix end_it computation in Buffer::insert, avoid clamping in iterator_at
2012-07-18 14:12:41 +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
36e4dacdf5
Fix BufferIterator::on_erase and tweak Buffer
2012-06-28 14:26:01 +02:00
Maxime Coste
ccec35f88c
code cleanups in buffer
2012-06-25 19:05:32 +02:00
Maxime Coste
eb34f6db73
execute BufClose hook in Buffer destructor
2012-06-14 17:44:28 +00:00
Maxime Coste
fd8517f91e
fix some warnings detected with clang
2012-06-05 13:33:02 +00:00
Maxime Coste
bc359d7c90
BufCreate hook is always called for every buffer, BufNew is called when creating a new file
2012-06-12 18:27:57 +00: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
a7c33207d6
check if no modification were made in Buffer::end_undo_group
2012-06-04 14:12:37 +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
6cedff8fb2
fix some corner cases in Buffer modification
2012-04-04 12:25:42 +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
9444c84b1c
rename HooksManager to HookManager
2012-04-03 12:01:01 +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
792f0f7f2e
BufferManager no longer owns buffers, only register them
2012-03-26 14:21:49 +00:00
Maxime Coste
3dd82a2b85
get rid of Buffer::at
2012-03-19 14:04:33 +00:00
Maxime Coste
a377ff79aa
buffer style fix
2012-03-12 21:39:54 +00:00
Maxime Coste
3c105592e0
get rid of Buffer::compute_lines
2012-03-12 21:31:27 +00:00
Maxime Coste
97b8905a6d
fix update_lines on empty buffer
2012-03-12 14:26:46 +00:00
Maxime Coste
df0f7b4689
rename BufferString to String
2012-03-08 21:23:29 +00:00
Maxime Coste
c98657a512
fix some unitialized variable use (thanks valgrind)
2012-03-08 20:49:10 +00:00
Maxime Coste
0ce3bc4621
simplify and optimize buffer line handling
2012-03-06 14:27:03 +00:00
Maxime Coste
c4ad372d91
call compute_lines before hooks at Buffer construction
2012-02-28 14:23:52 +00:00
Maxime Coste
5bddd166f1
fix Buffer::line_length for last line
2012-02-27 19:52:36 +00:00
Maxime Coste
416a1805b3
Fix last line handling in buffer
2012-02-22 22:02:43 +00:00
Maxime Coste
a386315bde
Buffer: optimize line updating when applying a modification
2012-02-22 21:54:25 +00:00
Maxime Coste
030450838a
fix Buffer::line_length for last line
2012-02-22 21:49:00 +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
945ad361fb
HooksManager: forward declare Context instead of including context.hh
2012-01-23 13:56:43 +00:00