The previous solution, ad9b090ddf, was
failing when completion was not replacing any text, as going through
SelectionList was not permitting to replace empty ranges.
Handle replacement as first a deletion then an insert to get fast
update, as having a list of forward deletions and then a list
for forwad insertion is much faster to update than a list of
interleaved delete/insert.
Instead of highlighting full lines and then trim them to make them
fit in the window, highlight only the visible portion, and rely on
the compute_display_setup system introduced for wrapping to setup
our buffer range correctly
Use the fast, linear time SelectionList::insert algorithm instead of
an ad-hoc one that needs to call SelectionList::update after each
modification of the buffer.
Fixes#1417
There is no need to trigger that event on every keystroke, we can
trigger it only when we hit the idle timeout, avoiding computations
when input keys are pasted.
A hook execution triggered by another hook execution would change the
shared MatchResults object, which is a wrong behaviour and makes it
point to dead string data.
The existing HookManager was able to run arbitrary hook functions,
but in practice was only used for user provided textual hooks.
That separation was causing some suboptimal performances, by moving
that logic directly in the hook manager we can improve hook filtering
performance which is a big part of startup time when opening lots
of files.
This will improve matching of filenames, as 'foo/' will be sorted
before 'foo-bar' due to `/` coming before `-` in the new ordering
(it comes after in ascii/unicode order).
Fixes#1395
We were generating a string, then splitting it into lines, there is
no need for that, we can directly generate a vector of lines and
simplify the code.
The solution is a bit hackish, as we only consider the 8th bit to
mean alt in normal mode, because its unlikely accentuated characters
are going to be mapped there. It fixes using Alt on xterm, and
probably on iterm2 as well (not requiring the meta-sends-esc config
change anymore)
update-option will make the range-descs and line-descs option up to
date with the latest buffer modfications, changing the ranges/lines
to where they moved according the modifications since the timestamp
on the option.
When a comment was present directly on the same line after a command,
we did not correctly see the command as terminated and would join
continue parsing the next line.
Generalize this option type, which is a timestamped list of
<line number>|<arbitrary string>. That way this type is not strongly
coupled with the flag-lines highlighter, and can be reused for other
use cases.
to produce bit-identical 'kak' binaries
See https://reproducible-builds.org/ for why this is good.
This change is needed because filesystem ordering is random
and ordering matters for the g++ linker
range-faces are now used to replace-range highlighters, where the string
part is not interpretted as a face but as a display line, so the name was
not relevant anymore.
replace-ranges is takes a range-faces option, but treats the face
string as a display line to be parsed, and replaces the range display
with this display line.
John Doe Copyright Waiver
I dedicate any and all copyright interest in this software to the
public domain. I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors. I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.
Highlighters now run in 3 phases:
Wrap, Move, and Colorize. That way we guarantee the wrap
highlighter runs first, then eventual line numbers/flags,
and finally the colorizers.
We also run a `compute_display_setup` method thats responsible
for computing the lines that will be displayed, eventually
scrolling the view to ensure the cursor is visible.
The command map can get mutated by command execution, so the iterators
can get invalidated (now that we use our curstom HashMap implementation,
all iterators are potentially invalidated by insert/removal)
The previous implementation could yield different positions when
iterating forward and backward, leading to confusion in boost regex.
This makes an existing problem a bit more visible: iterating with
to_next and with read_codepoint wont behave the same way, as
read_codepoint will put the iterator onto the byte following the
utf8 codepoint, whereas to_next will put it on the next utf8
character start byte, which might be different if the buffer content
is not valid utf8.
Fixes#1195
This commit allows "forced" writes to a write-protected file, by
attempting to temporarily grant the current user write permissions on
it. After the buffer has been written, the previous permissions are
restored if the file existed, or set to 0644 otherwise.
That means we wont have a very nice interaction between show_whitespaces
and column highlighters, but thats the simplest fix for now, if we want
a better behaviour we need to introduce a way to know that a replaced
range is splittable (meaning it means to have the same amount of columns
as the range it replaces)
Fixes#1275
We were letting stdin untouched, which meant child processes had
access to our terminal input. That meant `!fmt` was trying to read
from our terminal input and catching keystrokes.
Fixes#1281
This commit allows a help message to be printed when a `-help` flag is
passed to the editor, which will subsequently quit after a summary and a
description of all the flags available have been displayed.
The GNU convention (passing a single `--help` argument to the program)
is also supported, although undocumented.
The man page also now documents the `+:` argument, although unrelated to
the original changeset.