Maxime Coste
fc64369f9d
Purge history on buffer reload when NoUndo flag is on
...
We were preserving the history in that case, so on fifo buffers
(that set the NoUndo flag until the fifo is closed), we still had
the history from the "previous life" of the buffer, leading crashes
when trying to apply it.
Fixes #1518
2017-08-04 11:39:28 +07:00
Maxime Coste
53e1d2f0de
Slight formatting tweak
2017-08-01 14:48:45 +07:00
Maxime Coste
cc946764ed
Consider non-files buffers as never modified
2017-06-28 06:48:24 +01:00
Maxime Coste
475e8849a1
Fix replacing last eol with a single eol
2017-06-26 16:16:46 +01:00
Maxime Coste
fa4b88c2f8
Move tolerance for one past end of line coordinates to highlighter code
...
The rest of Kakoune's code now requires coord passed to Buffer::iterator_at
to be valid.
2017-06-15 17:43:18 +01:00
Maxime Coste
e6c4bed42b
Go back to window lines ending at one past the end of the buffer line
...
Change Buffer::iterator_at so that this case is tolerated, and fixes
the coord to next line start instead of clamping to last line char.
2017-06-15 17:25:37 +01:00
Maxime Coste
208b28cbe7
Simplify a bit buffer iteration functions
...
Dont try to ensure the returned value is valid, incrementing past
the end/decrementing before begin is the caller's error.
2017-06-12 06:10:18 +01:00
Maxime Coste
63a791d651
Fix the Buffer::end() madness
...
Until now, buffer had multiple recognized end coordinates, either
{ line_count, 0 } or { line_count - 1, line[line_count - 1].length }.
Now the only correct end coord is { line_count, 0 }, removing the need
for various special cases.
2017-06-11 12:01:40 +01:00
Maxime Coste
1c0bdd8c85
Run BufCreate hook *before* Buf{Open,New}File
2017-06-07 19:46:43 +01:00
Maxime Coste
21da24235a
Small style tweak
2017-06-07 11:40:13 +01:00
Maxime Coste
f2c0ee62ce
Remove unneeded explicit conversion
2017-05-26 09:51:32 +01:00
Maxime Coste
7ee3039a79
Do not avoid eol in insert mode vertical movement
2017-05-22 17:04:01 +01:00
Maxime Coste
ad9ad7e603
Fix vertical movement with tabstops
...
Fixes #1388
2017-05-21 08:24:44 +01:00
Maxime Coste
5ee21ec932
Respect tabstop in Buffer::offset_coord
2017-05-07 16:26:14 +01:00
Maxime Coste
e722868c60
Fix generation of empty erase changes
...
Fixes #1308
2017-04-20 17:31:27 +01:00
Maxime Coste
ca17572301
Try to fix clang 3.5 compilation
2017-03-22 21:08:52 +00:00
Maxime Coste
e44f95820e
Fixes some clang-tidy warning and add a few missing meta.hh include
2017-03-16 23:34:02 +00:00
Maxime Coste
7d9f1df73a
Small code tweaks regarding flags handling
2017-03-15 18:25:59 +00:00
Maxime Coste
edc2a88643
Rename BufNew and BufOpen hooks to BufNewFile and BufOpenFile
...
Fixes #1225
2017-02-19 13:08:06 +00:00
Maxime Coste
1c63d28f15
Fix Buffer::offset_coord that was dropping the target coordinate
2017-02-07 23:13:14 +00:00
Maxime Coste
472f5149c0
Formatting fix
2017-01-31 21:46:20 +00:00
Maxime Coste
f30e164232
Make SharedString::create take a list of StringViews
2017-01-30 13:38:38 +00:00
Maxime Coste
072064407a
Remove hash from StringData
...
Maintaining the hash value of strings is not worth it as we only
use it for buffer reload, but pay for it on any buffer modifications.
2017-01-28 13:04:55 +00:00
Maxime Coste
69789d4793
When inserting at the end, store the next line as end pos in the change
2017-01-01 16:32:04 +00:00
Maxime Coste
e340e0ed39
Forward client name to contexts created for write-all
...
Fixes #937
2016-11-24 13:35:42 +00:00
Maxime Coste
b3ba769220
Propagate the hooks disabled state through prompt, menu, and command execution
...
Maintain it as well during buffer creation even if the hooks are not executed
in client context.
Fixes #818
2016-11-14 19:39:35 +00:00
Maxime Coste
35559b65dd
Support codepoints of variable width
...
Add a ColumnCount type and use it in place of CharCount whenever
more appropriate, take column size of codepoints into account for
vertical movements and docstring wrapping.
Fixes #811
2016-10-01 13:45:00 +01:00
Maxime Coste
12f2815159
Tweak Buffer::offset_coord implementation
2016-09-21 13:36:11 +01:00
Maxime Coste
8803bf7c46
Fix comment missing a closing parenthesis
2016-08-14 20:05:57 +01:00
Frank LENORMAND
f8224b1384
Use explicit initialization of the timespec
object to fix compilation on older compilers
2016-07-26 09:43:41 +03:00
Maxime Coste
087a17eb24
Support for going backward/forward in buffer history with <a-u>/<a-U>
2016-07-24 21:25:05 +01:00
Maxime Coste
03a4b3c73f
Support counts for undo/redo
2016-07-24 21:25:05 +01:00
Maxime Coste
3edd2c127c
Support moving between arbitrary history nodes
2016-07-24 21:25:05 +01:00
Maxime Coste
b9c77e2f09
Store creation timepoint in HistoryNode
2016-07-24 21:25:05 +01:00
Maxime Coste
2296b43299
Store buffer undo/redo information in a tree instead of a vector
2016-07-24 21:25:05 +01:00
Maxime Coste
003cb8dfea
Merge remote-tracking branch 'lenormf/readonly-mode'
2016-07-24 21:21:49 +01:00
Frank LENORMAND
8a4596bea9
Implement a readonly
mode
...
This commit introduces the `readonly` variable as well as the `-ro`
command line option which prevent buffers from being overwritten on
disk when the `write` command is used without arguments. Some buffers
can selectively be put in readonly mode by setting the `readonly`
variable on the `buffer` scope, the `global` mode will affect all
buffers (even those who will be open subsequently), using the `window`
scope will have no effect.
Closes #685
2016-07-23 10:03:21 +03:00
Maxime Coste
530ecf212e
Ensure buffer create/close hooks are run at appropriate times
...
They used to be ran before the buffer was added to the buffer list
we now run them afterwards.
2016-07-10 16:34:16 +01:00
Maxime Coste
511367f977
Change end of line format detection logic to match vims
...
Only consider a buffer to be Crlf if *all* of its lines use it, else
consider it as Lf with embedded Cr chars.
Fixes #686
2016-06-28 20:46:20 +01:00
Maxime Coste
f51ba6089c
Use variadic macros for kak_assert to remove the need for COMMA
2016-05-17 19:39:55 +01:00
Maxime Coste
1788126f38
BufferManager now owns the Buffers instead of registering them
2016-05-14 08:33:50 +01:00
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