Commit Graph

4031 Commits

Author SHA1 Message Date
Maxime Coste
d75a835ca1 Merge remote-tracking branch 'Delapouite/main_index' 2017-07-23 23:15:51 +02:00
Maxime Coste
d1c005dd8c Limit diff algorithm complexity
Return a non-optimal, but valid, diff when we detect too many
iterations

Fixes #1509
2017-07-23 21:33:12 +02:00
Maxime Coste
d43e2ac843 More cleanups in diff code 2017-07-20 17:47:50 +02:00
Maxime Coste
d7c0bfddd0 Merge remote-tracking branch 'Delapouite/rmhl' 2017-07-20 12:47:49 +02:00
Delapouite
720ff62f03 Fix wrong autoinfo for remove-highlighter 2017-07-20 12:08:06 +02:00
Maxime Coste
ec1824d3c3 Make non smart case full match better than smart case full match 2017-07-19 20:18:47 +02:00
Maxime Coste
016a50f213 Use smart case matching for contiguous/prefix/fullmatch detection
Fixes #1498
2017-07-19 20:16:28 +02:00
Maxime Coste
f87afbcb65 Detect overflow using a long long for the computation result.
Closes #1306
2017-07-19 17:55:48 +02:00
Maxime Coste
d3f438810e Fix main selection handling in keep pipe ($)
$kak_reg_hash will properly contain the current selection index when
executing the shell command, fixing its use.

Fixes #1503
2017-07-19 17:42:41 +02:00
Maxime Coste
9c4448ac41 Remove echo -color support, superseeded by echo -markup
`echo -color Error "blah"` is the same as `echo -markup '{Error}blah'`
Fixes #1512
2017-07-19 17:18:52 +02:00
Maxime Coste
5ccf18d772 More use of std::enable_if_t alias 2017-07-19 08:55:24 +02:00
Maxime Coste
d37c3d175d More uses of standard type traits aliases 2017-07-19 08:49:44 +02:00
Maxime Coste
609bc24f67 Remove unused function 2017-07-19 08:49:44 +02:00
Maxime Coste
ba83cbee0e Use c++14 function deduction and decltype(auto) to cleanup some code 2017-07-19 08:49:43 +02:00
Maxime Coste
5bf401948a Cleanup some code with C++14 features 2017-07-19 08:47:14 +02:00
Maxime Coste
bbaa98c46d Fix travis configuration for C++14 support 2017-07-19 08:47:14 +02:00
Maxime Coste
7a79cbbc81 Migrate code to c++14 2017-07-19 08:47:14 +02:00
Maxime Coste
fbffd86f85 Add an assert to try to get more info on #1506 2017-07-19 08:40:17 +02:00
Maxime Coste
7b96d56996 Use the provided equal functor for prefix/suffix detection in diff
We were wrongly using the `==` operator.
2017-07-18 17:53:30 +02:00
Maxime Coste
9197dd393c More refactoring of the diff code in order to make it cleaner 2017-07-18 16:11:24 +02:00
Maxime Coste
50fec86749 Change diff Implementation to use end indices instead of length
Having absolute begin and relative lenght was a bit strange to
work with. Rename middle_snake to snake.
2017-07-18 12:14:52 +02:00
Maxime Coste
793c2ed9cf Slight style change 2017-07-17 19:29:57 +02:00
Maxime Coste
d90cd6de77 Refactor find_diff_rec and detect kept prefix/suffixes early
Certain cases, like diffing an empty buffer with a big buffer, were
very slow, now this should get better as we will directly detect the
matching eol at the end of both buffers, end then immediatly detect
we need to add the rest of the big buffer.

We still are too slow on some general diff when there is a lot of
differences.
2017-07-17 13:30:11 +02:00
Maxime Coste
388ada8142 Remove MirroredArray for diff implementation
We can index native arrays negatively, so just setup V1 and V2 to
point in the middle of the work arrays and remove the need for
creating MirroredArray.
2017-07-17 19:28:52 +09:00
Maxime Coste
da9794e272 Fix xmessage handling in assert.cc
The return value of the system call is not directly the exit value
of the process, but a status that needs to be inspected with some
macros.
2017-07-17 18:13:20 +09:00
Maxime Coste
a9455bf132 Tolerate that the cursor might not be visible
Sometimes, like if the window is not high enough, we might not be
able to display any buffer lines, hence not have the cursor visible.

Fixes #1502
2017-07-16 13:12:17 +09:00
Maxime Coste
5eae7aacc7 Small code cleanup in diff implementation 2017-07-15 17:17:27 +09:00
Maxime Coste
6e40e57ed4 Fix replacing reducing selections to their cursor
Broken by 8650c99f13
2017-07-14 16:16:43 +09:00
Maxime Coste
580eae0388 | now applies the diff of the modification instead of plain replace
Fixes #312
Fixes #1501
2017-07-14 16:16:40 +09:00
Maxime Coste
8650c99f13 Fix assertion when replacing with empty strings
Replacing with empty strings is essentially a deletion, which means
it can end up push some selections out of the buffer (imagine 3 a
2 empty line buffer, and deleting the second one). We are fixing
the selections in SelectionList::erase, but we were not doing that
in SelectionList::insert.

Fixes #1504
2017-07-14 13:08:29 +09:00
Maxime Coste
53f5b3d709 Fix an assert in compute modified ranges when merging single char ranges
Due to the way Selection::min/max worked, we were creating backward
selections, with cursor < anchor, which was triggering an assert when
trying to move cursor back one char when it was already on the first
char of the buffer.
2017-07-14 12:42:43 +09:00
Maxime Coste
26cc8b3ee0 Fix undo handling in <a-o>/<a-O> 2017-07-13 08:24:55 +09:00
Delapouite
287a20c485 Add main selection index in mode_info 2017-07-12 19:08:13 +02:00
Maxime Coste
7389e37b4b Small startup message formatting tweak 2017-07-13 00:31:17 +09:00
Maxime Coste
74076ef9b7 Alternative, and hopefully safer implementation of <a-o>/<a-O>
Fixes #1495
2017-07-11 22:35:42 +09:00
Maxime Coste
81b5de6fd8 Add <a-c> and <a-d> for changing/deleting without yanking
As asked for in #1175
2017-07-11 22:25:15 +09:00
Maxime Coste
42e5d95cd8 Preserve order of definition of mappings when listing them
Fixes #1479
Closes #1494
2017-07-11 09:51:56 +09:00
Maxime Coste
ebc1e054fc Merge remote-tracking branch 'Delapouite/last-command-reg' 2017-07-11 09:11:10 +09:00
Maxime Coste
b575067317 Add <a-o> and <a-O> to add lines below/above selections
Fixes #1480
2017-07-11 09:03:45 +09:00
Delapouite
0d2b303f62 Docs: add missing colon register (last entered command) 2017-07-10 22:05:21 +02:00
Maxime Coste
c38dc9a37b Merge remote-tracking branch 'Delapouite/alt-r' 2017-07-09 22:29:05 +09:00
Delapouite
f917402f89 Docs: add missing <a-R> key and fix info message 2017-07-09 12:00:28 +02:00
Maxime Coste
50e26a2bac Remove assert in String::String(Codepoint, ColumnCount)
codepoint_width is locale dependent, and we could end up with it
returning a different value depending on the locale. It is better
to return a string of the wrong column length than fail on assert
in this case as we cannot fix it anyway.

Fixes #1489
2017-07-09 11:03:04 +09:00
Maxime Coste
dbba047a8a Merge remote-tracking branch 'Delapouite/prompt-idle' 2017-07-08 13:33:44 +09:00
Maxime Coste
ad1dad9d04 Merge remote-tracking branch 'Delapouite/extend' 2017-07-08 13:32:11 +09:00
Maxime Coste
8cad40a0c9 Merge remote-tracking branch 'Delapouite/stars-less' 2017-07-08 13:31:17 +09:00
Maxime Coste
b51d19bfaa Formatting fixes 2017-07-07 13:59:53 +09:00
Maxime Coste
6604aa66f7 Treat non printable characters as zero-width instead of -1 width
This fix a bug when opening a file where a line has a lot of unprintable
chars (like a binary file) which was confusing Kakoune into considering
that the line length in column was negative.
2017-07-07 10:57:32 +09:00
Delapouite
9254363673 Make register and completion autoinfo lists uniform with all the other ones 2017-07-06 18:47:02 +02:00
Delapouite
b3f2a7e46e Refine info titles to distinguish f/t (select) and F/T (extend) 2017-07-05 20:23:02 +02:00
Delapouite
8ed29dbd7a Docs: add missing PromptIdle hook mentions 2017-07-05 13:45:45 +02:00
Maxime Coste
620e718087 Formatting tweak 2017-06-29 09:31:02 +01:00
Maxime Coste
eb2984807c Remove some dead code 2017-06-29 07:43:20 +01:00
Maxime Coste
e95fab0e7a Code style tweak 2017-06-29 07:36:07 +01:00
Maxime Coste
14958a7c94 Validating an empty command in prompt reruns the last command
This is more consistent with other prompts like regexes or shells,
and has proven useful from time to time.
2017-06-29 07:33:16 +01:00
Maxime Coste
9bbab690ba Merge remote-tracking branch 'danr/Expose-last-entered-command-in-register' 2017-06-29 07:29:32 +01:00
Maxime Coste
cc946764ed Consider non-files buffers as never modified 2017-06-28 06:48:24 +01:00
Maxime Coste
641acc5943 Do not allow repeating last insert when we are not in normal mode
<a-;>. is not accepted anymore. Note that <a-;> are not repeatable
currently anyway (That could be fixed, athough not trivial).
Fixes #1469
2017-06-27 09:57:10 +01:00
Maxime Coste
ce8078ad73 Ensure cursor stays visible with wrapped line bigger than window
Fixes #1459
2017-06-27 09:29:25 +01:00
Maxime Coste
e9c0c05548 Fix reference highlighter not forwarding compute_display_setup 2017-06-26 16:50:12 +01:00
Maxime Coste
475e8849a1 Fix replacing last eol with a single eol 2017-06-26 16:16:46 +01:00
Maxime Coste
f41d78083a Use the extra_word_chars option in word based normal commands
the completion_extra_word_chars is now gone, superseeded by
extra_word_chars that gets used both for completion and for normal mode.

Fixes #1304
2017-06-26 15:28:41 +01:00
Maxime Coste
dc378aed72 Pass a context instead of just the buffer to selector functions 2017-06-26 14:56:50 +01:00
Maxime Coste
477f0700f0 Remove useless Vector, use a ConstArrayView instead 2017-06-26 14:40:01 +01:00
Maxime Coste
268c214f56 Change completion_extra_word_char to be a list of codepoints instead of a string 2017-06-26 14:39:17 +01:00
Maxime Coste
1a64ba18d3 Always use the base LineNumber face for the line number separator
Fixes #1431 as we can now just hide the wrapped line numbers by
setting the LineNumberWrapped foreground and background to the
LineNumber background.
2017-06-26 13:45:56 +01:00
Maxime Coste
f788333778 Formatting fix 2017-06-26 12:18:02 +01:00
Maxime Coste
4864c8cecb Disable -Wunknown-attributes 2017-06-26 11:27:35 +01:00
Maxime Coste
4e7a357a47 Fix various undefined behaviours detected by UBSan 2017-06-26 11:27:18 +01:00
Maxime Coste
8a2ece78b7 Remember count when repeating last insert
Fixes #1465
2017-06-25 07:25:31 +01:00
Maxime Coste
c6eddefb0d Slight code refactoring and perf improvement in vector option to string 2017-06-24 12:24:24 +01:00
Maxime Coste
dc1b039282 Add ctags command renaming info in the startup message 2017-06-23 10:23:26 +01:00
Maxime Coste
430e4495f0 Merge remote-tracking branch 'nuao/autoshowcompl_opt' 2017-06-23 10:20:34 +01:00
Maxime Coste
9d4f5a49e0 Merge remote-tracking branch 'lenormf/debug-commands' 2017-06-23 10:19:45 +01:00
Maxime Coste
806d885eaf Do not set idle timers when running in a transient context 2017-06-23 10:01:24 +01:00
Maxime Coste
7ceb768a2e Use an HashMap to store options in option manager
Turns out looking for options can get pretty slow, so O(1) lookup
seems better.

This should improve the performance of the #1460 issue
2017-06-23 09:54:21 +01:00
nuao
ddc846cf89 Use user-supplied autoshowcompl option's value. 2017-06-17 18:07:45 +01:00
Maxime Coste
657e30db1c Use already stored coordinates in show_whitespaces 2017-06-17 14:48:59 +01:00
Maxime Coste
400f52c438 Merge remote-tracking branch 'EliteTK/fix-show_whitespaces-tab' 2017-06-17 14:47:18 +01:00
Tomasz Kramkowski
bd65719698 Correctly handle tabs when show_whitespaces is added
Tabs now align to tab stops instead of always spanning 8 spaces when
show_whitespaces is added as a highlighter.

This fixes issue #1453.

A regression test is also provided.
2017-06-17 11:46:39 +01:00
Frank LENORMAND
dbabb19d81 src: Add profile-hash-maps to the debug command's docstring 2017-06-17 11:29:09 +03:00
Frank LENORMAND
8d24768d5d src: Add a commands debug flag
This commit allows setting the `commands` flag to the `debug` option, in
order to have the engine write on the *debug* buffer the commands that are
being executed, along with their arguments.
2017-06-17 11:27:07 +03:00
Maxime Coste
5fbaa2c955 Update startup info message
Remove some old breaking changes, add the lint/make/grep command
changes.
2017-06-17 08:47:14 +01:00
Maxime Coste
0aeb2cd64f Disable -Wnoexcept-type warning
We dont really care that the mangled name will change, Kakoune is
not built as a library.

Fixes #1436
2017-06-17 08:15:32 +01:00
Maxime Coste
f0f2b1c383 Trim whitespaces surrounding docstrings
Closes #1439
2017-06-16 10:48:14 +01:00
Maxime Coste
ea105b9942 Add fallthrough comment to silence gcc-7 warning
Until we switch to C++17 and can use the proper attributes there.
Fixes #1437
2017-06-16 10:28:40 +01:00
Maxime Coste
42d7b66b92 Support hitting escape to cancel a selection combine operation
Fixes #1443
2017-06-16 10:23:03 +01:00
Maxime Coste
42f03fb71f Hide info/menu when they are anchored to an invisible buffer coord
Fixes #1444
2017-06-16 10:19:08 +01:00
Maxime Coste
2992d5bb0b Fix some remaining uses of invalid atom coordinates 2017-06-16 08:06:24 +01:00
Maxime Coste
4ed790632d Fix some other uses of invalid buffer coordinates in display code 2017-06-15 18:12:21 +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
01a1e92b79 Fix crash recently introduced when deleting at buffer start in insert mode 2017-06-15 17:35:48 +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
724b4198b0 Change window display to not use invalid buffer coordinates
Fixes #1435
2017-06-15 16:48:16 +01:00
Maxime Coste
40f845d77e Respect scroll offset even when wrapping lines
Fixes #1433 although in a slightly different way than requested:
We ensure that scrolloff *displayed* lines are visible below the
cursor, not scrolloff *buffer* lines.
2017-06-15 12:29:34 +01:00
Delapouite
229848dece Change custom text object desc trigger from ':' to 'c' - Fix #1362 2017-06-14 19:41:30 +02:00
Maxime Coste
98627726cf Always store InclusiveBufferRange with first < second
Closes #1434
2017-06-13 09:00:55 +01:00
Maxime Coste
ab56be090a minor style tweak 2017-06-12 06:12:10 +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
250886a9e1 Use read_fd to get pipe command from stdin instead of ad-hoc code
read_fd will also now throw on read error instead of just returning
the data read so far as if nothing failed.
2017-06-12 05:21:34 +01:00
Maxime Coste
7bcfbd055c Fix corner case in compute_modified_ranges 2017-06-11 12:25:12 +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
d86a612774 Fix wrapping support 2017-06-09 16:00:22 +01:00
Maxime Coste
0dec1e3a91 Remove unused only_buffer mode for DisplayLine::trim 2017-06-09 15:30:13 +01:00
Maxime Coste
7b9d8d39b1 Simplify column highlighter and make it more robust
Fixes #1382
2017-06-09 15:24:07 +01:00
Maxime Coste
3612eb50e5 Fix bug in word completer
A bug could be triggered in the word completer when a multiselection
would trigger word completion with one selection being at buffer first
character.
2017-06-09 14:21:18 +01:00
Maxime Coste
64aa6f3fb4 Proper linear time insert completion insertion
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.
2017-06-09 14:13:43 +01:00
Maxime Coste
f310db639c Rework partial line display logic
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
2017-06-09 13:22:32 +01:00
Maxime Coste
242f951c84 More explicit and simpler code 2017-06-09 09:54:18 +01:00
Maxime Coste
fe46c05685 Remove spurious double underscore 2017-06-08 10:37:48 +01:00
Maxime Coste
2b5fafa909 Do not show startup info when piping into kak
Fixes #1340
2017-06-08 10:03:07 +01:00
Maxime Coste
ad9b090ddf Fix quadratic behaviour in when selecting an insert completion
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
2017-06-08 09:55:34 +01:00
Maxime Coste
4ab40af3a9 Disable idle timers on all transient contexts 2017-06-08 09:53:23 +01:00
Maxime Coste
609b0bbbac Merge remote-tracking branch 'Delapouite/rotate-forward' 2017-06-08 07:14:20 +01:00
Maxime Coste
eadf8930fb Add -width <max_width> support in the wrap highlighter
Will always wrap at the minimum between max_width and actual window
width.

Fixes #1424
2017-06-08 07:05:44 +01:00
Maxime Coste
acc2dbf79c Move variable closer to its point of use 2017-06-07 20:33:34 +01:00
Maxime Coste
56b52bdb3d Filter debug buffers before creating the SafePtr vector in -buffer * 2017-06-07 20:25:39 +01:00
Maxime Coste
e947c20ce0 Do not disable incsearch option in context wrap
It will only trigger on idle, which should not happen during non-
interactive contexts.
2017-06-07 20:24:37 +01:00
Maxime Coste
03f8679e5c Only trigger PromptEvent::Change on idle
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.
2017-06-07 20:16:19 +01:00
Maxime Coste
b81500c0e4 Use microseconds instead of milliseconds for built-in profiling 2017-06-07 20:06:47 +01:00
Maxime Coste
1c0bdd8c85 Run BufCreate hook *before* Buf{Open,New}File 2017-06-07 19:46:43 +01:00
Maxime Coste
4495aefea6 Use range based find_if wrapper for finding shell env vars 2017-06-07 19:46:16 +01:00
Maxime Coste
d9b1ee13d9 Change merge_overlapping to guarantee we dont break the sorting
In certain cases, we could end up with a unsorted selection list,
leading to broken invariant.
2017-06-07 19:30:44 +01:00
Maxime Coste
1d4093bcdc Fix memory errors due to sharing the MatchResults in the Hooks struct
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.
2017-06-07 19:18:15 +01:00
Maxime Coste
575e6fe325 Remove unneeded unknown_expand exception type 2017-06-07 19:01:26 +01:00
Maxime Coste
b7982c6ee3 Use range based accumulate wrapper instead of std::accumulate 2017-06-07 13:36:47 +01:00
Maxime Coste
a0d848da8d Do not allow whitespaces as % string delimiters 2017-06-07 13:09:45 +01:00
Maxime Coste
f0285a8e60 Move hook executing logic into HookManager
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.
2017-06-07 12:33:39 +01:00
Maxime Coste
4606453fed Avoid expensive copies of Hooks in HookManager::run_hooks
Use a deferred deletion mechanism to ensure hooks are kept alive
for the duration of run_hooks.
2017-06-07 12:15:16 +01:00
Maxime Coste
87477cf2bb Move NestedBool to utils.hh 2017-06-07 11:55:42 +01:00
Maxime Coste
21da24235a Small style tweak 2017-06-07 11:40:13 +01:00
Maxime Coste
5a5d2ad7cb noexcept-ify utf8::iterator methods 2017-06-07 10:58:49 +01:00
Maxime Coste
cb6ef4afb6 noexept-ify BufferIterator methods 2017-06-07 10:58:01 +01:00
Maxime Coste
502c5da0e9 Fix useles copy of hook_func in HookManager::add_hook parameter 2017-06-07 09:54:58 +01:00
Maxime Coste
295fa5b27d Use String default ctor instead of empty string 2017-06-07 09:54:11 +01:00
Maxime Coste
a5e7b6a22f Use a vector instead of a hash map to store hooks 2017-06-07 09:46:05 +01:00
Delapouite
86cc66577b Clarify rotation direction between <'> and <a-'> in info help 2017-06-07 08:53:33 +02:00
Maxime Coste
fd00e1f9ae Merge remote-tracking branch 'Delapouite/underscore' 2017-06-07 07:48:57 +01:00
Maxime Coste
d214969d5b Merge remote-tracking branch 'Delapouite/buf_line_count' 2017-06-07 07:48:32 +01:00
Maxime Coste
9cb9e77dc2 Merge remote-tracking branch 'Delapouite/view-count' 2017-06-07 07:45:53 +01:00
Delapouite
09daaa8b3a Expose kak_buf_line_count 2017-06-06 14:29:06 +02:00
Delapouite
2f84051efb Add underscore char as a valid punctuation for text-object pairs 2017-06-06 12:04:53 +02:00
Delapouite
b4af4994fb Remember previous NormalParams::count in view-lock mode 2017-06-06 09:52:02 +02:00
Maxime Coste
36364d5f6b Fix spurious copies being made when using the format function
We were not correctly forwarding the arguments, leading to copies of
'const String&' parameters.
2017-06-06 08:50:51 +01:00
Maxime Coste
73ecbdbc97 Log errors written to the status line inside the debug buffer as well
Fixes #1410
2017-06-04 08:48:23 +01:00
Maxime Coste
261e0fabcc Improve readability of command docstrings by changing formatting
Fixes #1378
2017-06-04 08:37:51 +01:00
Maxime Coste
6101138606 Change RankedMatch ordering to favor / characters
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
2017-06-04 08:27:53 +01:00
Maxime Coste
96813ee824 Document the * behaviour change in the startup message 2017-06-03 18:17:44 +01:00
Maxime Coste
c1e4b4ff79 Strip surrounding whitespaces in *
Fixes #1406
2017-06-03 18:16:40 +01:00
Maxime Coste
8dc9f8cc22 Support option_add for HashMap options
Fixes #1407
2017-06-03 18:01:38 +01:00
Maxime Coste
6906e6924b Merge remote-tracking branch 'occivink/ignore-debug' 2017-06-03 15:26:51 +01:00
Maxime Coste
a313dab90f Merge remote-tracking branch 'Delapouite/include' 2017-06-03 14:46:03 +01:00
Maxime Coste
c440bbde81 Merge remote-tracking branch 'Delapouite/shift-modes' 2017-06-03 14:45:48 +01:00
Maxime Coste
58dfd76dca Small formatting fix 2017-06-03 14:02:43 +01:00
Maxime Coste
0e88a9695a Add support for more selection combining operations
Change append to 'a', add select longest/shortest, union and
intersection.
2017-06-03 13:45:59 +01:00
Delapouite
e8707298c1 Refine info titles to distinguish G and V modes 2017-05-31 19:57:56 +02:00
Delapouite
ccecc2b7cf fix: remove duplicate include to containers.hh in face_registry.cc 2017-05-30 20:01:31 +02:00
Maxime Coste
f6e00ff00f Merge remote-tracking branch 'Delapouite/typo' 2017-05-29 10:20:21 +01:00
Maxime Coste
b030088d60 Re-hide hardware cursor, seems its causing troubles with various terminal emulator 2017-05-29 10:02:18 +01:00
Maxime Coste
62def0f4df Tweak alias command docstring not to end up with an eol 2017-05-28 19:58:24 +01:00
Maxime Coste
76d3425bf9 Change ncurses_ui info box generation logic to use a Vector<String>
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.
2017-05-28 19:58:18 +01:00
Olivier Perret
9697f61b0d Exclude debug from eval/exec over all buffers 2017-05-27 23:44:53 +02:00
Delapouite
c9c868d4de Fix typos in info-box: availabe, encodngs, highglighters… 2017-05-27 22:37:25 +02:00
Maxime Coste
e97f23f2be Use more precise wording for object selection info box 2017-05-27 09:29:51 +01:00
Maxime Coste
bc92633ddd Put the doc/manpages/ pages in the 'k' section 2017-05-27 07:35:13 +01:00
Maxime Coste
72acb0177d Parse meta as 8 bit in Normal mode to fix the terminals using that
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)
2017-05-27 06:18:39 +01:00
Maxime Coste
b9080d8b2c Document line-flags -> line-specs and update-option in breaking changes 2017-05-27 06:18:02 +01:00
Maxime Coste
f57e72ab4a Small code tweak 2017-05-27 06:17:44 +01:00
Maxime Coste
f2c0ee62ce Remove unneeded explicit conversion 2017-05-26 09:51:32 +01:00
Maxime Coste
57ef592f57 Remove unused and potentially error prone constructor from ArrayView
Add as well a SFINAE check to the vector constructor to avoid constructing
an array_view from derived types with a different size.
2017-05-26 09:25:25 +01:00
Maxime Coste
2307cf500c Small formatting tweak 2017-05-26 08:38:12 +01:00
Maxime Coste
11f924c528 Use a ScopedSetBool instead of manual set/unset for InputModes::Normal::m_in_on_key 2017-05-26 08:28:34 +01:00
Maxime Coste
5a93159012 Small code style tweak 2017-05-26 08:19:35 +01:00
Maxime Coste
b1bb9d0cb2 Small documentation tweak in display_buffer.hh 2017-05-26 08:00:15 +01:00
Maxime Coste
6e389512f5 Modernize the way we compute memory domains from type
Use a constexpr function instead of a template type
2017-05-26 07:59:18 +01:00
Dan Rosén
b1735ae76e Expose last entered command in register : 2017-05-25 21:48:41 +02:00
Maxime Coste
83d85df26e Add an update-option command to update range-descs/line-descs options
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.
2017-05-25 19:54:08 +01:00
Maxime Coste
f014eb7052 Fix command parsing bug when commenting after a command
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.
2017-05-25 08:30:49 +01:00
Maxime Coste
c4db46b58b Rename line-flags option type to line-specs
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.
2017-05-24 15:41:43 +01:00
Maxime Coste
074666d298 Small code tweak 2017-05-24 15:40:16 +01:00
Maxime Coste
119a5b8442 Fix hardware cursor positioning in prompt when status bar is on bottom 2017-05-24 15:20:23 +01:00
Maxime Coste
720e567ac2 Remove unneeded forward declaration 2017-05-23 19:11:13 +01:00
Maxime Coste
7ee3039a79 Do not avoid eol in insert mode vertical movement 2017-05-22 17:04:01 +01:00
Maxime Coste
28bcb45b92 Fix bug where idle timers of disabled modes were still run 2017-05-22 16:57:22 +01:00
Maxime Coste
bc11e52960 Remove virtual destructor from OptionManagerWatcher
We should never destruct anything through an OptionManagerWatcher
pointer, so having all those destructor virtual makes no sense.
2017-05-22 10:31:56 +01:00
Maxime Coste
bdcfe30834 Fix scrolling when cursor is on a wrapped part of the last displayed line 2017-05-22 08:54:25 +01:00
Maxime Coste
ad9ad7e603 Fix vertical movement with tabstops
Fixes #1388
2017-05-21 08:24:44 +01:00
Maxime Coste
df4eadd2f5 Merge remote-tracking branch 'danr/Add-modified-value-if-buffer-has-modifications-not-saved' 2017-05-21 06:43:19 +01:00
Maxime Coste
248ffa543b Merge branch 'master' of git://github.com/bmwiedemann/kakoune 2017-05-21 06:34:36 +01:00
Bernhard M. Wiedemann
4788112f2d Always link input files in the same order
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
2017-05-20 22:50:25 +02:00
Bernhard M. Wiedemann
78991c4820 do not embed timestamps in .gz files
using gzip -n to produce bit-identical results
and -9 to compress a bit better
2017-05-20 22:49:36 +02:00
Maxime Coste
b440d9f537 Change <a-z>/<a-Z> to combine selections instead of appending 2017-05-20 10:31:49 +01:00
Dan Rosén
625e7f8249 Add modified value if buffer has modifications not saved
Closes #1386
2017-05-18 17:39:30 +02:00
Maxime Coste
91ed57c985 Make hardware cursor visible in ncurses ui 2017-05-18 06:28:08 +01:00
Maxime Coste
973487abcd Small reorganization in the normal keymap 2017-05-18 06:05:45 +01:00
Maxime Coste
a578c51baf Move constexpr compatible Array struct to meta.hh 2017-05-17 20:20:31 +01:00
Maxime Coste
3917d26709 small code cleanups 2017-05-17 20:17:16 +01:00
Maxime Coste
7acf11c851 Add missing std::move in on_scope_end implementation 2017-05-17 20:12:36 +01:00
Maxime Coste
0229baf6ba Add range-faces -> range-specs rename to the breaking changes message 2017-05-17 19:42:23 +01:00
Maxime Coste
dfaafcd49a Rename range-faces to range-specs
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.
2017-05-17 19:40:52 +01:00
Maxime Coste
44d2db2706 Add a basic replace-ranges highlighter
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.
2017-05-15 09:12:10 +01:00
Maxime Coste
468bd63569 Tweak buffer change code so that WinDisplay hooks can use info boxes 2017-05-13 11:18:21 +01:00
Maxime Coste
3a0d9481ac Add the -E switch for server initialization commands
Fixes #1361
2017-05-13 11:05:09 +01:00
Olivier Perret
ec636ce04b update line-flags and flag_lines doc to reflect current status 2017-05-11 20:45:28 +02:00
Maxime Coste
75e6b54ae2 Disable horizontal scroll offset support when wrapping 2017-05-11 09:23:20 +01:00
Maxime Coste
8fa7e67abc Use LineCount instead of int for ncurses assistant margin 2017-05-10 11:35:12 +01:00
Maxime Coste
a0752d8d46 Merge remote-tracking branch 'lenormf/fix-assistant-align' 2017-05-10 11:31:26 +01:00
Olivier Brewaeys
3f42e45ff6 Small spelling error fix
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.
2017-05-10 12:17:11 +02:00
Maxime Coste
9300a981eb Add support for the -passes option to the ref highlighter 2017-05-10 10:31:34 +01:00
Maxime Coste
5483a087d2 Make ref highlighter work for all highlight passes 2017-05-10 08:16:31 +01:00
Maxime Coste
59a0841baa Update group highlighter docstring to document the passes option 2017-05-09 10:02:01 +01:00
Maxime Coste
12c498a0bd Distinguish between BufferRanges and InclusiveBufferRanges
Fixes #1257
2017-05-08 12:34:57 +01:00
Maxime Coste
f9a609e479 Refactor range highlighting into a struct 2017-05-08 12:05:45 +01:00
Maxime Coste
6a97455b3b Do not push a final spurious command separators when parsing commands
Fixes #1336
2017-05-08 11:46:03 +01:00
Maxime Coste
ad1175fefc Update wrap highlighter docstring 2017-05-08 11:30:51 +01:00
Maxime Coste
b0b40485ce Move SimpleHighlighter as an implementation detail 2017-05-08 11:29:23 +01:00
Maxime Coste
a5d4dbc16e Fix unneeded and wrong splitting of display atom during wrapping 2017-05-07 16:26:14 +01:00
Maxime Coste
e63156bcfb Fix infinite loop with longer than width words in word wrap mode 2017-05-07 16:26:14 +01:00
Maxime Coste
4e9193a975 Slight highlighting related code cleanup 2017-05-07 16:26:14 +01:00
Maxime Coste
b4b08d10b4 Fix assert when wrapping a line that takes more than the full window height 2017-05-07 16:26:14 +01:00
Maxime Coste
17b19dc057 Ensure window position line is inside buffer 2017-05-07 16:26:14 +01:00
Maxime Coste
4032d05c79 Reject 0 wrap column 2017-05-07 16:26:14 +01:00
Maxime Coste
8dd808726d Add support for word wrapping with the -word switch to the wrap highlighter 2017-05-07 16:26:14 +01:00
Maxime Coste
bb17fb6dd3 Add a -passes switch support for the group highlighter 2017-05-07 16:26:14 +01:00
Maxime Coste
fa5ae65f3a Move passes logic to the base Highlighter class
Validate that childs of HighlighterGroup are matching its passes.
2017-05-07 16:26:14 +01:00
Maxime Coste
55631c8d8e Detect errors while parsing flag line and handle them
Fixes #1345
2017-05-07 16:26:14 +01:00
Maxime Coste
053544d740 Disable horizontal scrolling when running a WrapHighlighter 2017-05-07 16:26:14 +01:00
Maxime Coste
23e38a254f Introduce a LineNumberWrapped face 2017-05-07 16:26:14 +01:00
Maxime Coste
39826afde5 Make scrolling around work more correctly with wrapping 2017-05-07 16:26:14 +01:00
Maxime Coste
bd3ba77e96 Make Wrap highlighter only wrap on window width. 2017-05-07 16:26:14 +01:00
Maxime Coste
5ee21ec932 Respect tabstop in Buffer::offset_coord 2017-05-07 16:26:14 +01:00
Maxime Coste
57c2b32d20 Introduce highlighting phases and display setup computation
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.
2017-05-07 16:26:14 +01:00
Maxime Coste
a4f9e29d60 Add a wrap highlighter 2017-05-07 16:26:14 +01:00
Maxime Coste
93408e4b76 Do not use any display information to determine where the cursor moves 2017-05-07 16:26:14 +01:00
Maxime Coste
3a3144f3f5 Fix use of invalidated iterator in the command map on exception
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)
2017-05-07 16:25:34 +01:00
Maxime Coste
80f1056851 Support appending selections to empty register
Fixes #1332
2017-04-25 17:25:44 +01:00
Maxime Coste
26a105b2b7 Style tweak in highglighters.cc 2017-04-24 07:04:15 +01:00
Maxime Coste
e264d189eb Add noexcept specifiers to unicode and utf8 functions 2017-04-23 12:47:26 +01:00
Maxime Coste
caed8a55c7 Set stdin to /dev/null instead of closing it when we dont have data to pipe to child
Fixes #1330
Fixes #1331
2017-04-22 09:39:55 +01:00
Maxime Coste
e722868c60 Fix generation of empty erase changes
Fixes #1308
2017-04-20 17:31:27 +01:00
Maxime Coste
ab3a255d58 Merge remote-tracking branch 'lenormf/command-force-write' 2017-04-20 16:25:24 +01:00
Maxime Coste
dbcddafbfd Change utf8::to_next/to_previous so that they are more symetrical
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
2017-04-20 16:18:49 +01:00
Frank LENORMAND
51ab59cd36 src: Implement a write! command
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.
2017-04-20 17:13:42 +03:00
Maxime Coste
30e6387071 Assume filename passed to write_buffer_to_file is already parsed 2017-04-20 09:55:56 +01:00
Maxime Coste
5103b15b84 Safer code for parsing commands
Fix some possible past the end of target string reads
Fixes #1310 (maybe, probably, who knows)
2017-04-19 22:04:03 +01:00
Maxime Coste
34bf8c23e1 Fix uninitialised value for cursor mode 2017-04-19 21:23:16 +01:00
Maxime Coste
bee2180da7 Do not try to split non range atoms in column highlighter
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
2017-04-19 21:15:36 +01:00
Maxime Coste
52ffa98787 When not sending data to a subprocess, close its stdin
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
2017-04-17 20:39:24 +01:00
Maxime Coste
91bfd714e4 Place hardware terminal cursor at the current main cursor/prompt cursor position
Fixes #1318
Also fixes https://gitlab.com/gnachman/iterm2/issues/5408
2017-04-12 10:39:17 +01:00
Maxime Coste
80dd9ec4cb Name key '+' as plus and '-' as minus 2017-04-11 10:47:15 +01:00