Commit Graph

237 Commits

Author SHA1 Message Date
Maxime Coste
38f146d849 Fix another bug in Buffer::replace implementation 2016-03-17 12:38:09 +00:00
Maxime Coste
c6ca3af9b4 Fix bug introduced in Buffer::do_insert 2016-03-17 12:07:20 +00:00
Maxime Coste
131b0a8298 Use ByteCoords directly for buffer insert/erase/replace 2016-03-16 13:59:30 +00:00
Maxime Coste
ad5da15cfa Use replace in Buffer unit test 2016-03-16 13:52:39 +00:00
Maxime Coste
de1433d30a Avoid the spurious newline insertion when replacing at end of buffer
Add a Buffer::replace method to handle the replacements properly
Fixes #633
2016-03-16 13:48:11 +00:00
Maxime Coste
c5b24e2a8a More cleanups in Buffer::do_insert 2016-03-16 13:22:11 +00:00
Maxime Coste
338462e94f Refactor Buffer::do_insert 2016-03-15 23:37:18 +00:00
Maxime Coste
d2dfb9ecb1 Slight cleanup in Buffer::do_insert 2016-03-15 23:15:57 +00:00
Maxime Coste
9e15181dc9 Rework container helpers, use pipe syntax and cleanup implementation
use 'container | filter(func) | reverse() | transform(func)' instead
of 'transform(reverse(filter(container), func), func)' to express
container transformations.
2016-03-08 21:35:56 +00:00
Maxime Coste
ff6eacffa3 dont intern SharedStrings but StringDataPtr 2016-02-05 00:20:45 +00:00
Maxime Coste
966ac90fe7 Change eolformat and BOM options to be enums instead of strings 2015-12-06 12:51:55 +00:00
Maxime Coste
7335065d20 Update buffer display names after changing working directory
Fixes #501
2015-12-01 13:42:42 +00:00
Maxime Coste
7bd3f4306d Remove useless checks, buffer has always at list one line 2015-11-10 23:06:57 +00:00
Maxime Coste
fe704b9b84 Move line parsing and to Buffer.cc directly 2015-10-17 11:33:09 +01:00
Maxime Coste
e2720f1fbe Store timespec for buffer fs timestamps, not just time_t
time_t has a resolution of one second, which cause troubles when
a file changes multiple time during that same second.
2015-09-27 11:55:34 +01:00
Maxime Coste
e9d7d70e47 Cache buffer display name 2015-09-01 20:49:47 +01:00
Maxime Coste
e7b4217762 Support flags getting modified by hooks at buffer creation
Fixes #361
2015-08-04 23:02:40 +01:00
Maxime Coste
1e04343178 Workaround incomplete c++11 stdlib in gcc 4.8 2015-05-26 19:05:11 +01:00
Maxime Coste
dd25dcc361 Move unit test functions in next to the code they are testing 2015-05-22 13:58:56 +01:00
Maxime Coste
802d6e106c Keep hash stored in StringData 2015-05-14 19:13:52 +01:00
Maxime Coste
8ba6804480 Do not use diff when reloading a no undo buffer 2015-05-14 14:05:02 +01:00
Maxime Coste
15b26fd06c Use diff when reloading buffer 2015-05-13 23:22:42 +01:00
Maxime Coste
e875828aa9 Use format for {Win,Buf}SetOption hooks description 2015-03-31 13:55:40 +01:00
Maxime Coste
6e1a388544 Replace various adhoc operator+ based formatting with format func 2015-03-30 23:06:02 +01:00
Maxime Coste
023c8afb73 Fix unneeded string copy 2015-03-11 13:58:42 +00:00
Maxime Coste
99996902de Use a IdMap for storing hooks
The number of hook names is small (<20), using an UnorderedMap
is overkill, and prevents using StringView for key searching.
2015-03-05 14:59:27 +00:00
Maxime Coste
98972c18b7 rename StringStorage to StringData 2015-03-01 12:03:08 +00:00
Maxime Coste
e5121fe40a Wrap debug loop in ifdef KAK_DEBUG 2015-02-16 22:27:40 +00:00
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