Jimmy Thrasher
240a004354
Fix compile warnings on OSX that could actually be errors
...
c++ -std=gnu++11 -g -Wall -Wno-reorder -Wno-sign-compare -pedantic -DKAK_DEBUG -MD -MP -MF .buffer.d -c -o .buffer.o buffer.cc
buffer.cc:35:20: warning: logical not is only applied to the left hand side of this comparison
[-Wlogical-not-parentheses]
kak_assert(not line->length == 0 and line->data()[line->length-1] == '\n');
^ ~~
./assert.hh:17:18: note: expanded from macro 'kak_assert'
if (not (condition)) \
^
buffer.cc:35:20: note: add parentheses after the '!' to evaluate the comparison first
./assert.hh:17:18: note: expanded from macro 'kak_assert'
if (not (condition)) \
^
buffer.cc:35:20: note: add parentheses around left hand side expression to silence this warning
./assert.hh:17:18: note: expanded from macro 'kak_assert'
if (not (condition)) \
^
buffer.cc:177:20: warning: logical not is only applied to the left hand side of this comparison
[-Wlogical-not-parentheses]
kak_assert(not line->length == 0 and line->data()[line->length-1] == '\n');
^ ~~
./assert.hh:17:18: note: expanded from macro 'kak_assert'
if (not (condition)) \
^
buffer.cc:177:20: note: add parentheses after the '!' to evaluate the comparison first
./assert.hh:17:18: note: expanded from macro 'kak_assert'
if (not (condition)) \
^
buffer.cc:177:20: note: add parentheses around left hand side expression to silence this warning
./assert.hh:17:18: note: expanded from macro 'kak_assert'
if (not (condition)) \
^
2 warnings generated.
2015-02-06 09:12:05 -05:00
Maxime Coste
d59b36b816
Fix incorrect Buffer::Change generated in Buffer::reload
2015-02-04 21:42:42 +00:00
Maxime Coste
c004187f32
Fix buffer reloading
2015-02-02 13:24:40 +00:00
Maxime Coste
804a050c39
Tweak Buffer::Change layout
2015-01-29 22:44:07 +00:00
Maxime Coste
42966317b8
Tweak SharedString
2015-01-25 22:36:05 +00:00
Maxime Coste
cb197f57ba
Avoid temporary strings on buffer load/reload
...
Pass directly a Vector<ref_ptr<StringStorage>> to the buffer
2015-01-22 13:39:29 +00:00
Maxime Coste
b1281d225d
rename SharedString::Storage to StringStorage and use directly in Buffer
2015-01-19 19:31:56 +00:00
Maxime Coste
76d806e98d
Replace InternedStrings with SharedString, shared_ptr based
2015-01-15 19:26:38 +00:00
Maxime Coste
da562e03a0
replace all std::vector with Vector
2015-01-12 13:58:41 +00:00
Maxime Coste
064fb81b8d
Move containers utils to containers.hh and add filtered/transformed utils
2014-12-23 13:40:26 +00:00
Maxime Coste
eee2cb3a6e
Revert "Add support for BufInsert/BufErase hooks"
...
This is potentially quite slow, and not used, reintroduce
later if we have a use case for it.
This reverts commit 5f3a477277
.
2014-12-18 23:13:45 +00:00
Maxime Coste
1c8ee78d1a
Do not register timers for transient input handlers
2014-12-18 23:12:58 +00:00
Maxime Coste
5f3a477277
Add support for BufInsert/BufErase hooks
2014-12-17 13:56:45 +00:00
Maxime Coste
b494b873b1
Fix buffer being considered modified after reloading
2014-11-01 19:35:27 +00:00
Maxime Coste
e38ba6ce3d
Add scope class and encapsulate Options, Keymaps, Aliases and Hooks in it
2014-10-30 14:04:57 +00:00
Maxime Coste
185b980718
Add scoped aliases
...
aliases are now stored in window, buffer, or globally.
2014-10-30 14:02:13 +00:00
Maxime Coste
d29419bcd6
Fix invalid memory access when applying modifications on an empty buffer
...
That can happen when undoing/redoing accross a buffer reload
boundary.
2014-10-28 21:55:08 +00:00
Maxime Coste
54f4b8fc2d
Do not lose history when reloading a buffer
...
Fixes #157
2014-10-23 21:04:58 +01:00
Maxime Coste
fc4142178f
Port more code to StringView instead of const String&
2014-10-20 19:18:38 +01:00
Maxime Coste
844c8f1ec4
InternedStrings know their slots
2014-10-05 10:20:50 +01:00
Maxime Coste
d4a84125ef
Use InternedStrings for buffer contents
2014-10-03 13:39:13 +01:00
Maxime Coste
d55d041c6a
Add support for interned strings
...
Use interned strings for Modification contents and word database.
Interned strings are guaranteed not to move in memory and are
reference counted.
2014-10-01 00:20:12 +01:00
Maxime Coste
e440adbcf4
add a 'buffers' debug command to get info on alive buffers
2014-09-22 19:19:34 +01:00
Maxime Coste
5092494427
Add support for target column preservation
...
Fixes #64
2014-09-09 19:42:57 +01:00
Maxime Coste
ed68d1ff28
utf8: use end of sequence iterators for more security
2014-07-05 12:10:06 +01:00
Maxime Coste
63878b03c5
Style fixes
2014-06-26 19:01:39 +01:00
Maxime Coste
c8354588c9
Remove undo group optimizer
2014-06-02 15:17:56 +01:00
Maxime Coste
b6b646e9a2
Remove use of 'offset' in buffer iterators, lines are just String
...
No need to maintain line offsets anymore.
2014-05-24 17:08:01 +01:00
Maxime Coste
03e5264df4
Remove per lines timestamp in Buffer
2014-05-17 12:17:05 +01:00
Maxime Coste
c3f4ef9ba2
Remove BufferChangeListener
2014-05-14 19:49:04 +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
ddd8f8d392
LineChangeWatcher uses Buffer::changes_since rather than listening
2014-05-13 19:01:27 +01:00
Maxime Coste
a510276025
Maintain an append-only list of changes in Buffer
2014-05-12 19:03:13 +01:00
Maxime Coste
05b79921a9
Minor code cleanups in buffer.{cc,hh}
2014-05-10 16:25:07 +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
33de42610d
Add g. command to go to the last buffer modification position
2014-04-07 23:47:50 +01:00
Maxime Coste
e1a9d5f71e
Fix clang compilation
2014-04-02 22:33:52 +01:00
Maxime Coste
3248829f5b
rename buffer_iterator.inl.hh as buffer.inl.hh and inline some more methods
2014-01-12 17:19:05 +00:00
Maxime Coste
4aed32d152
Store timestamp of last content modification in buffer lines
...
That means that lines that move around keep their timestamp.
2014-01-12 16:26:31 +00:00
Maxime Coste
ba5b21d43e
Clear buffer values explicitely in destructor
...
Buffer values could be registered as a listener, so we need to
get rid of them before asserting that all listeners have been
unregistered.
2014-01-11 19:05:09 +00:00
Maxime Coste
b247a05e43
Buffer: maintain a per line timestamp
2014-01-09 22:51:50 +00:00
Maxime Coste
560b4ab0b5
Fix DynamicSelectionList selecting buffer end on Buffer::reload
2014-01-08 19:36:18 +00:00
Maxime Coste
1e6fbf548b
Fix some tabs in the code
2014-01-05 14:30:26 +00:00
Maxime Coste
c0973075fa
Get rid of Editor for good
...
ClientManager now stores only the free windows, clients take
ownership of its own.
2013-12-20 20:14:57 +00:00
Maxime Coste
0e6bbbb8c4
remove useless code in Buffer constructor
2013-12-16 23:53:04 +00:00
Maxime Coste
9b6639eb27
Remove Editor::move_selections
2013-12-15 14:14:52 +00:00
Maxime Coste
563f62b467
Fix Buffer::char_next when the line ends with an invalid utf8 sequence
2013-12-12 13:45:14 +00:00
Maxime Coste
1b1031627c
Add Buffer::run_hook_in_own_context helper method
2013-12-11 13:57:10 +00:00
Maxime Coste
ad275d1d1c
Extract InputHandler from Client
2013-11-14 18:09:15 +00:00
Maxime Coste
04ae48c346
indent cleanup, correct erroneous 3 spaces indent
2013-11-14 00:12:15 +00:00
Maxime Coste
db5050fab0
Add BufSetOption hook support
2013-11-12 20:36:42 +00:00
Maxime Coste
a11bccaa12
fix Buffer constructor exception safety
2013-11-07 21:43:18 +00:00
Maxime Coste
2c09da50be
Add key mapping support
2013-10-25 00:30:46 +01:00
Maxime Coste
60dbec4949
Add Buffer::reload for reloading buffers without loosing options and hooks
2013-10-21 18:57:19 +01:00
Maxime Coste
44281c8fed
More robust Buffer filesystem timestamp handling
2013-10-17 18:47:09 +01:00
Maxime Coste
03c74b7a88
Detect file external modification and ask the user whether to reload or not
...
* Buffer now store a m_fs_timestamp field.
* Client in Normal mode checks current buffer file every 500 ms, or
each time it goes back to Normal mode.
2013-10-15 18:51:31 +01:00
Maxime Coste
3862b5cbb8
LineAndColumns: always pass by value
2013-07-26 01:50:09 +02:00
Maxime Coste
5b4ef23b9d
more tolerant Buffer::string
2013-06-27 23:49:34 +02:00
Maxime Coste
bd8daac3a1
Fix UndoGroupOptimizer
2013-06-12 00:14:05 +02:00
Maxime Coste
7306f6b33b
Buffer: always use {line_count(), 0} as end in Modifications
2013-06-06 20:02:20 +02:00
Maxime Coste
2a74b0e9e2
Buffer: insert and erase go back to taking iterators, and return iterators
2013-06-06 19:44:08 +02:00
Maxime Coste
cf454ef904
UndoGroupOptimizer: fix count_byte_to
2013-06-06 19:44:08 +02:00
Maxime Coste
357799c966
replace remaining plain assert with kak_assert
2013-06-06 19:44:08 +02:00
Maxime Coste
bd504058d9
remove unused Buffer::char_at
2013-06-06 19:44:07 +02:00
Maxime Coste
70bf71e51f
remove Buffer:char_{distance,advance} use line access instead
2013-06-06 19:44:07 +02:00
Maxime Coste
580749a91d
Buffer: remove line_length and replace line_content with operator[]
2013-06-06 19:44:07 +02:00
Maxime Coste
6b667bc803
remove BufferIterator conversion to/from BufferCoord
2013-06-06 19:44:07 +02:00
Maxime Coste
ee22596d61
tweak Buffer::{,char_}prev
2013-06-04 18:53:28 +02:00
Maxime Coste
c4f9253634
Remove Buffer::iterator_at_line_{begin,end}, use iterator_at(line{,+1})
2013-06-04 14:21:07 +02:00
Maxime Coste
fb41e1fdf9
tweak Buffer::do_insert
2013-06-04 14:21:07 +02:00
Maxime Coste
02b33c7d8f
Buffer: add methods for char access instead of byte access
2013-06-03 18:56:48 +02:00
Maxime Coste
3453ebbd52
BufferChangeListener: pass buffer to on_{inser,erase}
2013-06-01 00:48:46 +02:00
Maxime Coste
28e127a48a
remove avoid_eol parameter from Buffer::{iterator_at,clamp}
2013-05-30 14:23:25 +02:00
Maxime Coste
a07fde181a
Add Buffer::{next,prev,at}(BufferCoord) methods and use them in iterators
2013-05-30 13:59:38 +02:00
Maxime Coste
7f17644a6b
Buffer insert and erase takes coord rather than iterators
2013-05-30 13:59:38 +02:00
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