Maxime Coste
839da764e7
Regex: avoid unneeded allocations and moves by reusing MatchResults storage
2017-11-29 14:07:04 +08:00
Maxime Coste
380ff553b5
Wrap: try to rework and simplify the algorithms further
...
Fixes #1731
2017-11-28 19:04:21 +08:00
Maxime Coste
ae0911b533
Regex: Various small code tweaks
2017-11-28 01:03:54 +08:00
Maxime Coste
4598832ed5
Regex: optimize compilation by reserving data
2017-11-28 00:59:57 +08:00
Maxime Coste
a52da6fe34
Regex: Tweak is_ctype implementation style
2017-11-28 00:13:42 +08:00
Maxime Coste
d142db80f2
Fix compute_modified_ranges corner case that would crash on undo
...
Fixes #1506
Fixes #1215
2017-11-27 20:29:01 +08:00
Maxime Coste
8b40f57145
Regex: Replace generic 'Matchers' with specialized functionality
...
Introduce CharacterClass and CharacterType Regex Op, and optimize
their evaluation.
2017-11-25 18:14:15 +08:00
Maxime Coste
0d44cf9591
Regex: do not decode utf8 in accept calls as they always run on ascii
2017-11-25 18:13:27 +08:00
Maxime Coste
ec6ecd5772
Add an InsertCompletionSelect hook
...
InsertCompletionSelect will be called whenever the selected insert
completion changes. If the original text is selected back, the hook
parameter will be empty. If another candidate is selected, the hook
parameter will be its text content.
Fixes #1676
2017-11-25 13:57:47 +08:00
Maxime Coste
1ae96c977c
Small formating tweak
2017-11-25 13:46:55 +08:00
Maxime Coste
318e77b25e
Highlighters: Introduce unique highlighter support
...
Some highlighters, such as wrap or line numbers, are not intended
to be used multiple times on the same display. Add support for unique
ids that are used by highlighters to disable themselves if another
unique highlighter with the same id is supposed to override them.
The usual highlighter "precedence" takes, place, that it, that most
nested highlighter will the the one to run (window in priority to
buffer in priority to global).
2017-11-25 12:53:33 +08:00
Delapouite
66250a06eb
Rename KeyMapInfo → KeymapInfo
2017-11-24 10:34:56 +01:00
Maxime Coste
6084490a6e
Merge remote-tracking branch 'Delapouite/remaining-buffers'
2017-11-24 16:37:53 +08:00
Maxime Coste
5a0332ac87
Window: fix buffer_coord when a line buffer range is empty
...
Fixes #1711
2017-11-24 16:36:37 +08:00
Maxime Coste
c0cec3e7c1
Merge remote-tracking branch 'fsub/warnings'
2017-11-23 12:30:24 +08:00
fsub
66ca53466f
Remove unused lambda captures
...
This eliminates some warnings emitted by clang++.
2017-11-22 18:43:54 +01:00
Maxime Coste
179a1f6aa1
dynregex: slight code refactor, moving a helper function to lambda
2017-11-22 15:57:59 +08:00
Maxime Coste
77b367b3e0
Wrap: simplify logic a bit and fix case where too many lines got displayed
...
Fixes #1710
2017-11-21 13:01:02 +08:00
Delapouite
be94505e46
Add modified buffers count in error message of non-force quit
2017-11-20 19:25:47 +01:00
Maxime Coste
b57a53dfbf
Merge remote-tracking branch 'Delapouite/common_prefix'
2017-11-20 17:30:28 +08:00
Delapouite
62912c6586
Remove extraneous common_prefix in input_handler
...
Related to: 52525a156f
2017-11-20 10:21:23 +01:00
Delapouite
bf222a0628
Docs: add missing -i <suffix> command line flag
2017-11-19 11:43:08 +01:00
Kylie McClain
3e1a4df3fb
Makefile: Add ability to disable compressing manpage
...
Some distributions don't compress them.
2017-11-19 01:53:40 -05:00
Kylie McClain
ab390a02dc
Makefile: use PKG_CONFIG, not pkg-config
2017-11-17 23:11:06 -05:00
Maxime Coste
706c1672d5
Normal: add <a-S> to select first and last char of selection
...
Fixes #550
2017-11-13 17:36:04 +08:00
Maxime Coste
5f5188a89c
Merge remote-tracking branch 'Delapouite/jump-count'
2017-11-13 16:37:24 +08:00
Delapouite
a071e5b226
Add count support to jumps (<c-o> and <c-i>). Add jumps tests
2017-11-13 08:38:43 +01:00
Maxime Coste
615fe0368c
Options: rework conversion to string of prefixed lists
...
* use the list_separator variable instead of hard coding ':'
* fix trailing separator when converting empty prefixed list to string
* correctly escape the prefix in case it contains a separator
2017-11-13 11:45:28 +08:00
Maxime Coste
078f0b5c90
option_types.hh: fix unfulfilled dependencies of the header
2017-11-13 11:27:55 +08:00
Maxime Coste
ffb639bf96
Regex: add unit test for #1693
2017-11-13 01:12:05 +08:00
fsub
0dd8a9ba93
Fix #1693 : typo in RegexParser::character_class()
2017-11-12 17:35:03 +01:00
Maxime Coste
b298e01390
NCurses: use the general face merging function to handle default face
...
Merge attributes as well, and reuse an existing function instead of
reimplementing the same logic again.
Closes #1684
2017-11-12 23:02:40 +08:00
Maxime Coste
208f9641ef
Remote: when converting to client, suspend *after* connecting
...
Also, do not quit server while there is a connection being accepted
Fixes #1690
2017-11-12 22:28:13 +08:00
Maxime Coste
00e0630272
Move Array and ConstexprVector to a constexpr_utils.hh header
2017-11-12 13:01:18 +08:00
Maxime Coste
5cfccad39c
Regex: Use MemoryDomain::Regex for captures and MatchResults contents
2017-11-12 12:30:21 +08:00
Maxime Coste
c9b43d3634
Regex: directly store instruction pointer in Thread struct
2017-11-11 15:15:13 +08:00
Maxime Coste
b1115f7469
Wrap: fix scrolling to keep cursor visible logic
2017-11-10 21:17:05 +08:00
Maxime Coste
0942cd5084
InputHandler: handle of last insert keys happening in nested modes
...
Move recording of keys to the input handler itself instead of the
Insert mode so that eventual nested modes (potentially introduced
by <a-;> will get their keys recorded as well).
Fixes #1680
2017-11-08 14:39:52 +08:00
Maxime Coste
04993de687
Fix pipe logic in the case where the selections were accessed in the cmdline
...
When using an env var that needed the selections in the pipe command line,
say $kak_selection, the selection update code would run, modifying the
selections to adapt to eventual changes. But the rest of the pipe logic
was assuming the selections would not change, leading to bugs.
2017-11-08 00:02:49 +08:00
Maxime Coste
d45f16b6c8
Buffer: change clamp logic to preserve ordering
...
clamp could change ordering between a coordinate past the end.
Say in a buffer with 1 line of 2 char:
{0, 1} was clamped to {0, 1}
{1, 0} was clamped to {0, 0}
That was reversing their ordering, and might be the root cause
of the bug lurking in undo range computation.
2017-11-07 23:56:24 +08:00
Maxime Coste
80ce768994
Slight code cleanup in change update functions
2017-11-07 20:00:45 +08:00
Maxime Coste
2b6c84fc40
Add missing include in remote.cc
...
strerror is defined in <string.h>
2017-11-06 12:45:14 +08:00
Maxime Coste
0a081b9f31
Do not allow rename-session to introduce '/' in session names
2017-11-06 11:55:56 +08:00
Maxime Coste
52f4af6a83
Merge remote-tracking branch 'lenormf/fix-private-commands-in-register'
2017-11-05 12:22:28 +08:00
Maxime Coste
6bac767124
CommandManager: tweak naming
2017-11-04 16:02:21 +08:00
Maxime Coste
7f51e51fcb
Introduce matching_pairs option that controls the pairs used by m
2017-11-04 15:53:53 +08:00
Frank LENORMAND
8900690288
src: Don't save whitespace-led commands in the :
register
2017-11-04 09:18:26 +03:00
Maxime Coste
aa82a90c39
Remote: stricter validation of the session names
...
Creating a session will not accept any slashes in the session path,
connecting to an existing session will accept at most one slash to
allow for specifying the session of a different user.
Fixes #1635
2017-11-04 12:01:25 +08:00
Maxime Coste
aa9bcf08fc
Code style tweak
2017-11-04 12:01:23 +08:00
Maxime Coste
9b216e0e79
Merge remote-tracking branch 'lenormf/fix-rc-aliases'
2017-11-03 19:32:30 +08:00
Maxime Coste
400ef6d48c
Wrap: rework logic to avoid infinite loop with multiple wrap highlighters
...
The display is still going to be wrong, as wrapping is going to take place
multiple times, but Kakoune should not freeze anymore.
2017-11-03 19:30:31 +08:00
Maxime Coste
9d6420caae
Remove uneeded forward declaration
2017-11-03 19:24:58 +08:00
Frank LENORMAND
9127ed0d55
src rc: Rename exec
/eval
into execute-keys
/evaluate-commands
2017-11-03 11:09:45 +03:00
Maxime Coste
39e63cf518
Append '/' to highlighter group completion candidates
2017-11-02 18:05:18 +08:00
Maxime Coste
730e5725e9
Wrap: change indent atom to be a replaced empty buffer range
...
Avoid confusing the column highlighters.
2017-11-02 11:08:03 +08:00
Maxime Coste
fd95af0e3e
Add informations on -indent in wrap highlighter docstring
2017-11-02 11:04:15 +08:00
Maxime Coste
4fabba3d12
doc.kak: Render documentation internally instead of relying on man
...
doc.kak now behaves as a basic asciidoc renderer. Asciidoc is unfortunately
still a dependency to generate the manpage of the `kak` command.
2017-11-02 10:03:24 +08:00
Maxime Coste
53069bcb2d
Ensure line-specs and range-specs options are sorted internally
2017-11-02 09:51:15 +08:00
Maxime Coste
329f5fca0e
Fix trailing spaces in highlighters.cc
2017-11-02 01:28:28 +08:00
Maxime Coste
6f2088cbc4
Wrap: Add -indent switch support that wraps preserving line indent
2017-11-02 01:28:28 +08:00
Maxime Coste
ed65d86c72
Rename doc/manpages to doc/pages
...
That fact we use man for these is an implementation detail.
2017-11-01 19:05:37 +08:00
Maxime Coste
25dac6b24e
Document the regex impl switch in the startup message
2017-11-01 14:18:13 +08:00
Maxime Coste
51de90f366
Regex: Remove boost related code
2017-11-01 14:09:39 +08:00
Maxime Coste
c74becc6af
Regex: fix RegexCompileFlags not being an enum class
2017-11-01 14:05:15 +08:00
Maxime Coste
2d901dc76f
Regex: slight readability improvement and workaround a potential gcc bug
2017-11-01 14:05:15 +08:00
Maxime Coste
f07375fb27
Regex: remove dead code
2017-11-01 14:05:15 +08:00
Maxime Coste
2c2073b417
Regex: Tweak struct layouts of ParsedRegex data
2017-11-01 14:05:15 +08:00
Maxime Coste
bbd7e604dc
Regex: Remove "Ast" from names in the ParsedRegex
...
It does not add much value, and makes names longer.
2017-11-01 14:05:15 +08:00
Maxime Coste
18a02ccacd
Regex: Optimize parsing and compilation
...
AstNodes are now POD, stored in a single vector, accessed through
their index. The children list is implicit, with nodes storing only
the node index at which their child graph ends.
That makes reverse iteration slower, but that is only used for reverse
matching regex, which are uncommon. In the general case compilation
is now faster.
2017-11-01 14:05:15 +08:00
Maxime Coste
aea2de885d
Regex: minor cleanup of the regex parsing code
2017-11-01 14:05:15 +08:00
Maxime Coste
6e0275e550
Regex: small code cleanup in the Save compilation code
2017-11-01 14:05:15 +08:00
Maxime Coste
9e15207d2a
Regex: put the other char boolean inside the general start char map
2017-11-01 14:05:15 +08:00
Maxime Coste
7c3bc48627
Fix ConstexprVector::resize
2017-11-01 14:05:15 +08:00
Maxime Coste
60e32d73ff
Regex: Fix handling of all unicode codepoint as start chars
2017-11-01 14:05:15 +08:00
Maxime Coste
df2bf9601c
Regex: fix wrong fallthough in dump_regex
2017-11-01 14:05:15 +08:00
Maxime Coste
e9e9a08e7b
Regex: refactor handling of Saves slightly, do not create them until really needed
2017-11-01 14:05:15 +08:00
Maxime Coste
d9b4076e3c
Regex: Go back to instruction based search of next start
...
The previous method, which was a bit faster in the general use case,
can hit some cases where we get quadratic behaviour and very slow
matching.
By using an instruction, we can guarantee our complexity of O(N*M)
as we will never have more than N threads (N being the instruction
count) and we run the threads once per codepoint in the subject
string.
That slows down the general case slightly, but ensure we dont have
pathological cases.
This new version is much faster than the previous instruction based
search because it does not use a plain `.*` searcher, but a specific,
smarter instruction specialized for finding the next start if we are
in the correct conditions.
2017-11-01 14:05:15 +08:00
Maxime Coste
3f627058b0
Regex: add support for \0, \cX, \xXX and \uXXXX escapes
2017-11-01 14:05:15 +08:00
Maxime Coste
c423b47109
Regex: compute if codepoints outside of the start chars map can start
2017-11-01 14:05:15 +08:00
Maxime Coste
2c6c0be0c1
Regex: abort compilation as soon as we hit the instruction count limit
2017-11-01 14:05:15 +08:00
Maxime Coste
d44e160aa7
Regex: add a unit test for why lookaheads dont count for start chars anymore
2017-11-01 14:05:15 +08:00
Maxime Coste
87eec79d07
Regex: comment the mutables in CompiledRegex::Instruction and fix their init
2017-11-01 14:05:14 +08:00
Maxime Coste
8b2297f5ca
Regex: Introduce a Regex memory domain to track usage separately
2017-11-01 14:05:14 +08:00
Maxime Coste
9ec175f2f8
Regex: use binary search to for character class ranges check
2017-11-01 14:05:14 +08:00
Maxime Coste
6e65589a34
Regex: compute start chars from matchers, do not compute it from lookarounds
...
Computing potential start characters from lookarounds is more complex
than expected, and not worth the complexity.
2017-11-01 14:05:14 +08:00
Maxime Coste
621b0d3ab8
Regex: remove the need to a processed inst vector
...
Identify each step with a counter, and check if the instruction
was already processed this step. This makes the matching faster,
by removing the need to maintain a vector of instructions executed
this step.
2017-11-01 14:05:14 +08:00
Maxime Coste
cfc52d7e6a
Regex: use intrusive linked list for the free saves instead of a Vector
2017-11-01 14:05:14 +08:00
Maxime Coste
df16fea82d
Regex: rename "flags" with the more common "modifiers"
2017-11-01 14:05:14 +08:00
Maxime Coste
52d443f764
Regex: Correctly handle ignore case mode for start chars computation
2017-11-01 14:05:14 +08:00
Maxime Coste
b8495f0953
Regex: Rework parsing, treat lookarounds as assertions, and flags separately
2017-11-01 14:05:14 +08:00
Maxime Coste
b0233262b8
Regex: Limit programs to std::numeric_limits<uint16_t>::max() instructions
2017-11-01 14:05:14 +08:00
Maxime Coste
8c8dcb3a84
Regex: Fix reverse searching behaviour, again
2017-11-01 14:05:14 +08:00
Maxime Coste
9753bcd0ad
Regex: limit explicit quantifiers value (too 1000 for now)
...
Fixes #1628
2017-11-01 14:05:14 +08:00
Maxime Coste
2b97e4e124
Regex: Fix handling of ^ and $ in backward matching mode
2017-11-01 14:05:14 +08:00
Maxime Coste
3c999aba37
Regex: Only reset processed and scheduled flags on relevant instructions
...
On big regex, reseting all those flags on all instructions for each
character can become the dominant operation. Track that actual
instructions index processed (the scheduled are already tracked in
the next_threads vector), and only reset these.
2017-11-01 14:05:14 +08:00
Maxime Coste
5bf4be645a
Regex: Fix support for ignore case in lookarounds
2017-11-01 14:05:14 +08:00
Maxime Coste
80f6caee81
Regex: move try/catch blocks inside boost specific code
2017-11-01 14:05:14 +08:00
Maxime Coste
dd9e43e6f9
Regex: small code cleanup
2017-11-01 14:05:14 +08:00
Maxime Coste
23b3a221eb
Regex: support more than two children in alternations
...
Avoid deep nested alternations, parse them flattened.
2017-11-01 14:05:14 +08:00
Maxime Coste
fb5243f710
Regex: print instruction index in dump_regex
2017-11-01 14:05:14 +08:00
Maxime Coste
c8966ca701
Regex: Assert that the regex direction matches the vm direction
2017-11-01 14:05:14 +08:00
Maxime Coste
74ed102cab
Regex: Tweak definition of character class and control escape tables
2017-11-01 14:05:14 +08:00
Maxime Coste
df73b71dfc
Regex: fix lookarounds handling when computing starting chars
2017-11-01 14:05:14 +08:00
Maxime Coste
1c95074657
Make use of custom regex backward searching support for reverse search
2017-11-01 14:05:14 +08:00
Maxime Coste
785cd34b4b
Regex: Make boost checking disableable at compile time
2017-11-01 14:05:14 +08:00
Maxime Coste
065bbc8f59
Regex: switch to custom impl, use boost for checking
2017-11-01 14:05:14 +08:00
Maxime Coste
9305fa1369
Regex: Fix lookaround use in moon.kak
...
(?=[A-Z]\w*) is strictly the same as (?=[A-Z]) as \w* will always
at least match an empty string.
2017-11-01 14:05:14 +08:00
Maxime Coste
cca730193c
Regex: Support any char and character classes in lookarounds
...
Lookarounds still need to be fixed size, but accept character classes
as well as plain literals.
2017-11-01 14:05:14 +08:00
Maxime Coste
b8cb65160a
Regex: use std::conditional instead of custom template class to choose Utf8It
2017-11-01 14:05:14 +08:00
Maxime Coste
db06acdfab
Regex: Fix computation of potential starts for lookaheads
2017-11-01 14:05:14 +08:00
Maxime Coste
34b1f1ccb6
Regex: detect when all characters can start and avoid allocating
2017-11-01 14:05:14 +08:00
Maxime Coste
ea85f79384
Regex: add elided braces to fix compilation on older gcc
2017-11-01 14:05:14 +08:00
Maxime Coste
bf3b50a543
Regex: Fix wrong size of character_class_escapes array
2017-11-01 14:05:14 +08:00
Maxime Coste
08ea68dc1f
Regex: Fix handling of match_prev_avail for boost regex
...
We were passing around iterators that were not allowed to
go before the begin iterator.
2017-11-01 14:05:14 +08:00
Maxime Coste
9ec376135b
Regex: Introduce RegexExecFlags::PrevAvailable
...
Rework assertion code as well.
2017-11-01 14:05:14 +08:00
Maxime Coste
73e177ec59
Regex: Do not use sized deallocation to support more compilers
2017-11-01 14:05:14 +08:00
Maxime Coste
30dacdade2
Regex: deallocate Saves memory on ThreadedRegexVM destruction
2017-11-01 14:05:14 +08:00
Maxime Coste
578640c8a4
Regex: Fix handling of control escapes inside character classes
2017-11-01 14:05:14 +08:00
Maxime Coste
f3736a4b48
Regex: tag instructions as scheduled as well instead of searching
...
And a few more code cleanup in the ThreadedRegexVM
2017-11-01 14:05:14 +08:00
Maxime Coste
6bc5823745
Regex: refactor ThreadedRegexVM::exec_from code
2017-11-01 14:05:14 +08:00
Maxime Coste
4ff655cc09
Regex: store the processed flag directly in CompiledRegex instructions
2017-11-01 14:05:14 +08:00
Maxime Coste
732b8bc2a4
Regex: abandon bytecode and just use a simple list of instructions
...
Makes the code simpler.
2017-11-01 14:05:14 +08:00
Maxime Coste
6434bca325
Regex: Add some comments, remove supurious semicolons
2017-11-01 14:05:14 +08:00
Maxime Coste
911a893225
Regex: fix get_base(std::reverse_iterator<...>) returning a ref to temporary
2017-11-01 14:05:14 +08:00
Maxime Coste
11abd544c6
Regex: avoid infinite loops
2017-11-01 14:05:14 +08:00
Maxime Coste
c47cdc06a7
Regex: Add support for backward matching
...
Regex can be compiled for backward matching instead of forward matching
and the ThreadedRegexVM is able to iterate in reverse on the subject
string to find the last match instead of the first.
2017-11-01 14:05:14 +08:00
Maxime Coste
071b897e00
Regex: Remove static RegexCompiler::compile
2017-11-01 14:05:14 +08:00
Maxime Coste
52ee62172a
Regex: remove use of buffer_utils.hh from regex_impl.cc
2017-11-01 14:05:14 +08:00
Maxime Coste
c375268c2d
Regex: Use memcpy to write/read offsets from bytecode
...
reinterpret_cast was undefined behaviour as we do not guarantee
that offsets are going to be stored properly aligned.
2017-11-01 14:05:14 +08:00
Maxime Coste
b53227d62c
Regex: slight cleanup of the unit tests
2017-11-01 14:05:14 +08:00
Maxime Coste
337e58d4f9
Regex: Cleanup character class parsing a bit
2017-11-01 14:05:14 +08:00
Maxime Coste
236751cb84
Regex: Make ThreadedRegexVM a proper class, define a proper interface
2017-11-01 14:05:14 +08:00
Maxime Coste
3b69dda04e
Regex: Find potential start position using a map of valid start chars
...
With this optimization we get close to performance parity with boost
regex on the common use cases in Kakoune.
2017-11-01 14:05:14 +08:00
Maxime Coste
741772aef9
Regex: Optimize single char character classes as literals
2017-11-01 14:05:14 +08:00
Maxime Coste
fabeab1ee1
Regex: reorder lookaround ops, group by direction
2017-11-01 14:05:14 +08:00
Maxime Coste
854144c535
Regex: Fix handling of Save instruction in ThreadedRegexVM
...
When not saving, we were not fully reading the instruction stream,
leading to an out of sync instruction pointer.
2017-11-01 14:05:14 +08:00
Maxime Coste
f1b4931824
Regex: Fix handling of non capturing groups (?:...)
...
We were wrongly keeping the `:` as a literal content of the group
2017-11-01 14:05:14 +08:00
Maxime Coste
5f6e71c4dc
Regex: More code tweaks and cleanups in ThreadedRegexVM
2017-11-01 14:05:14 +08:00
Maxime Coste
5f54e0de0e
Regex: Code cleanup and refactor for Saves handling
2017-11-01 14:05:14 +08:00
Maxime Coste
dbb175841b
Regex: do not write the search prefix inside the program bytecode
...
Its faster to have specialized code in the VM directly
2017-11-01 14:05:14 +08:00
Maxime Coste
cf5055f68b
Regex: small code tweak
2017-11-01 14:05:14 +08:00
Maxime Coste
e0fac20f6c
Regex: Use a custom allocated buffer for Saves instead of a Vector
2017-11-01 14:05:14 +08:00
Maxime Coste
1399563e40
Regex: make m_current_threads and m_next_threads local variable of exec
2017-11-01 14:05:14 +08:00
Maxime Coste
54da8098ae
Regex: Add a NoSaves RegexExecFlags to disable saving positions
2017-11-01 14:05:14 +08:00
Maxime Coste
119bc38254
Regex: small refactor of ThreadedRegexVM::clone_saves
2017-11-01 14:05:14 +08:00
Maxime Coste
9fbafba4cb
Regex: Refactor thread handling in ThreadedRegexVM
2017-11-01 14:05:14 +08:00
Maxime Coste
589cde67f0
Regex: store saves in a copy on write structure
2017-11-01 14:05:14 +08:00
Maxime Coste
11b9c996ea
Regex: small code style tweak
2017-11-01 14:05:14 +08:00
Maxime Coste
51ad8b4c85
Regex: fix handling of negative escaped character classes
2017-11-01 14:05:14 +08:00
Maxime Coste
adcd02b7d2
Regex: Replace boost regex_iterator impl with our own
...
Ensure we check the results from our own regex impl in all uses of
regexs in Kakoune.
2017-11-01 14:05:14 +08:00
Maxime Coste
f007794d9c
Regex: introduce RegexExecFlags to control various behaviours
2017-11-01 14:05:14 +08:00
Maxime Coste
73b14b11be
Regex: small code tweak in ThreadedRegexVM
2017-11-01 14:05:14 +08:00
Maxime Coste
630d078b6d
Regex: Fix use of not-yet-constructed CompiledRegex in TestVM impl
2017-11-01 14:05:14 +08:00
Maxime Coste
5b0c2cbdc2
Regex: Ensure we dont have a thread explosion in ThreadedRegexVM
...
Always remove threads with lower priority that end up on the same
instruction as a higher priority thread (as we know they will behave
the same from now on)
2017-11-01 14:05:14 +08:00
Maxime Coste
b4f923b7fc
Regex: min/max quantifiers can be non greedy as well
2017-11-01 14:05:14 +08:00
Maxime Coste
f02b2645da
Regex: validate that our custom impl gets the same results as boost regex
...
In addition to running boost regex, run our custom regex and compare
the results to ensure the two regex engine agree.
2017-11-01 14:05:14 +08:00
Maxime Coste
76dcfd5c52
Regex: support escaping characters in character classes
2017-11-01 14:05:14 +08:00
Maxime Coste
3d2262bebf
Regex: add support for case insensitive matching, controlled by (?i)
2017-11-01 14:05:14 +08:00
Maxime Coste
7673781751
Regex: use \A \z for subject start/end
...
This is the most common syntax in various regex variants.
2017-11-01 14:05:14 +08:00
Maxime Coste
0bdfdac5c5
Regex: Implement lookarounds for fixed literal strings
...
We do not support anything else than a plain literal string for
lookarounds.
2017-11-01 14:05:14 +08:00
Maxime Coste
e96cd29f0e
Regex: Support non greedy quantifiers
2017-11-01 14:05:14 +08:00
Maxime Coste
e4004a7b7f
Regex: Add support for \h and \H "horizontal blank" character classes
2017-11-01 14:05:14 +08:00
Maxime Coste
4ac0d35d1e
Regex: Add support for \K
that reset the start capture
2017-11-01 14:05:14 +08:00
Maxime Coste
2f450e0080
Regex: Add support for \Q...\E quoted parts
2017-11-01 14:05:14 +08:00
Maxime Coste
7a313ddafe
Regex: small error message improvement
2017-11-01 14:05:14 +08:00
Maxime Coste
c282b699d7
Regex: fix support for -
at end of a character class
2017-11-01 14:05:14 +08:00
Maxime Coste
e41d228af8
Regex: Disable dumping regex instructions by default in unit tests
2017-11-01 14:05:14 +08:00
Maxime Coste
d5048281a6
Regex: slight cleanup of the unit tests
2017-11-01 14:05:14 +08:00
Maxime Coste
f7468b576e
Regex: Refactor regex compilation to a regular RegexCompiler class
2017-11-01 14:05:14 +08:00
Maxime Coste
d5717edc9d
Regex: improve regex parse error reporting
...
Display the place where parsing failed, refactor code to make
RegexParser a regular object.
2017-11-01 14:05:14 +08:00
Maxime Coste
080160553c
Regex: support escaped character classes
2017-11-01 14:05:14 +08:00
Maxime Coste
1a8ad3759f
Regex: fix handling of strict quantifiers {N}
...
Previous behaviour was treating {N} as {N,}
2017-11-01 14:05:14 +08:00
Maxime Coste
be157453ad
Regex: Use a std::function based "Matcher" op to implement character classes
...
This is more extensible and should allow easier support for non ranges
classes.
2017-11-01 14:05:14 +08:00
Maxime Coste
eb1015cdfb
Regex: whenever Kakoune compiles a regex, pass it to the custom impl as well
...
That way we can see which features are missing.
2017-11-01 14:05:14 +08:00
Maxime Coste
002aba562f
Regex: work on unicode codepoints instead of raw bytes
2017-11-01 14:05:14 +08:00
Maxime Coste
75608ea223
Regex: when in full match mode, do not accept trailing data
2017-11-01 14:05:14 +08:00
Maxime Coste
490c130e41
Regex: Implement leftmost matching
...
Ensure threads are maintained in "priority" order, by having two
split instruction (prioritizing parent or child).
2017-11-01 14:05:14 +08:00
Maxime Coste
182b70cb0a
Regex: Add initial support for character ranges
2017-11-01 14:05:14 +08:00
Maxime Coste
52678fafa1
Regex: Add support for searching
...
Always compile a `.*` as the first instructions in a regex bytecode,
depending on the match or search mode, the RegexVM will either execute
this or skip it and start directly at the matching bytecode.
2017-11-01 14:05:14 +08:00
Maxime Coste
f7b8c1c79d
Regex: cleanup and reorganize regex code and improve capture support
...
Introduce the CompiledRegex class, rename ThreadedExecutor to
ThreadedRegexVM, remove the RegexProgram namespace.
2017-11-01 14:05:14 +08:00
Maxime Coste
023511deff
Regex: WIP support for saving captures
2017-11-01 14:05:14 +08:00
Maxime Coste
ad546e516a
Regex: Small comment tweaks
2017-11-01 14:05:14 +08:00
Maxime Coste
46a113e10a
Regex: Add support for curly braces count expressions
2017-11-01 14:05:14 +08:00
Maxime Coste
d04c60b911
Regex: Add support for subject begin/end assertion (\` and \')
2017-11-01 14:05:14 +08:00
Maxime Coste
9c5d539616
Regex: Add word boundary assertion support
2017-11-01 14:05:14 +08:00
Maxime Coste
a9a04e81b0
Regex: Ensure we only ever have a single thread on a given instruction
2017-11-01 14:05:14 +08:00
Maxime Coste
ee42c6b0ba
Regex: add unit test to check the ".*" construct
2017-11-01 14:05:14 +08:00
Maxime Coste
4010c44fc0
Regex: Make the Split op only take a single offset parameter
...
Split now creates a new thread and keep the current one running, as
all of its uses are compatible with this behaviour, which enable a
more compact compiled code.
2017-11-01 14:05:14 +08:00
Maxime Coste
f9dc6774b9
Regex: Introduce RegexProgram::ThreadedExecutor and add line end/begin impl
2017-11-01 14:05:14 +08:00
Maxime Coste
a448e1e222
Regex: Code cleanup in the regex impl
2017-11-01 14:05:14 +08:00
Maxime Coste
8c9976ea72
Regex: Add initial, exploratory work on a custom regex engine
2017-11-01 14:05:14 +08:00
Maxime Coste
797a0cb062
Add another assert to try to catch #1506
2017-11-01 14:04:42 +08:00
Maxime Coste
94a0c9bb45
Highlighters does not need to inherit from HighlighterGroup
...
Just compose, to avoid coupling Highlighters with the Highlighter
interface. And yeah, that naming is a bit confusing.
2017-10-31 13:53:08 +08:00
Maxime Coste
6272847ace
Prompt: display the fallback text everytime the prompt is empty
2017-10-31 12:54:21 +11:00
Maxime Coste
6d78b06405
Do not auto apply the fallback regex when in regex prompts
...
Fixes #1653
2017-10-30 18:58:47 +11:00
Maxime Coste
cd215ccee9
Do not allow opening files whose size we cannot express in an int
2017-10-30 18:58:47 +11:00
Maxime Coste
40eb598065
Makefile: Use pkg-config on Linux to get the ncurses compilation flags
...
Fixes #1659
2017-10-30 17:35:51 +11:00
Maxime Coste
43d470f286
Slight cleanup of select_surrounding implementation
2017-10-28 13:43:04 +08:00
Maxime Coste
7064e890f5
Update breaking changes message
2017-10-28 13:43:04 +08:00
Maxime Coste
d49555fc75
Move highlighters into Scopes
...
That means we can now have highlighters active at global, buffer, and
window scope. The add-highlighter and remove-highlighter syntax changed
to take the parent path (scope/group/...) as a mandatory argument,
superseeding the previous -group switch.
2017-10-28 13:43:04 +08:00
Maxime Coste
9a449a3344
Display the fallback value in prompts
...
Fixes #1654
2017-10-28 10:07:28 +08:00
Maxime Coste
7062022187
HashMap: Tolerate reserving for 0 elements
...
Fixes #1652
2017-10-27 11:03:43 +08:00
Maxime Coste
75767f5cb5
Fix infinite loop shell_complete
...
Fixes #1648
2017-10-25 11:26:03 +08:00
Maxime Coste
ab9283bc37
Merge remote-tracking branch 'net/master'
2017-10-25 11:13:42 +08:00
Net
74202fab45
Rename br* colors to bright-*
2017-10-24 23:08:22 -04:00
Maxime Coste
654e3fcb46
Fix regions highlighter infinite loops when regex matches empty ranges
2017-10-25 10:39:35 +08:00
Delapouite
d5b6669a83
Add distinct w (curr buf) / W (all buf) word completion for <c-x>
2017-10-24 22:47:43 +02:00
Net
2b44e93f79
Support bright named colors
2017-10-22 14:30:49 -04:00
Maxime Coste
600ba45189
Add missing include to meta.hh
2017-10-21 05:30:43 +08:00
Maxime Coste
d6cb10d693
Disable constexpr keymap as it breaks compilation with gcc 5
2017-10-20 19:12:21 +08:00
Maxime Coste
723bb2b175
Merge remote-tracking branch 'fsub/master'
2017-10-20 17:28:06 +08:00
Maxime Coste
7c06667bdf
Make the normal mode keymap a compile time hash map
...
This hash map is now fully constexpr, and ends up stored in the read
only data segment instead of being recomputed at each startup.
2017-10-20 12:21:22 +08:00
Maxime Coste
d486ea84e5
Constexprify various hash functions
2017-10-20 12:21:22 +08:00
Maxime Coste
ddff35e5ab
Move keymap as an implementation detail of the normal mode keys
...
Only expose a free function that tries to get the NormalCmd from a
key.
2017-10-20 12:21:22 +08:00
fsub
a70128a4cf
Avoid some warnings in optimized builds
2017-10-19 22:20:44 +02:00
Maxime Coste
ddc307b8e9
Optimize CommandManager::execute handling of tokens
...
Instead of walking a list of tokens and inserting eventual new
ones in the middle, use a stack of token and push new ones on top.
2017-10-17 10:25:20 +08:00
Maxime Coste
145cf843dd
Add a fail
command to explicitely raise an error
2017-10-17 10:25:16 +08:00
Maxime Coste
89f016d871
Refactor column highlighter to make it more robust
...
Support arbitrary orders for column highlighters (it was previously
failing when column highlighters were not applied in column order).
Fix show_matching tab handling at the same time (horizontal scrolling,
tab characters and show_matching were behaving badly).
Window highlighting now runs user highlighters, then built-ins for each
phases, instead of running all phases for user highlighters, then all
phases for built-ins.
We now consider unprintable character to be 1-column width as we know
we will display them as "�".
Fixes #1615
Fixes #1023
2017-10-12 14:46:15 +08:00
Maxime Coste
78d7d512cb
Fix utf8::to_previous that could go before the begin iterator
2017-10-10 10:53:24 +08:00
Maxime Coste
079cfbc6ac
Remove unused forward declaration
2017-10-10 10:52:58 +08:00
Maxime Coste
6ada6e6d77
Move all non-core string code to string_utils.{hh,cc}
2017-10-10 10:52:32 +08:00
Maxime Coste
d1b9c24afc
Make Server outlive buffer manager
...
Fixes crashes when trying to access the server to get the session
on hooks run during destruction of other managers.
Fixes #1622
2017-10-10 10:49:30 +08:00
Maxime Coste
80d2506c34
Make utf8_iterator traits clear about it returning non-references
2017-10-07 21:54:59 +08:00
Maxime Coste
e18836aea7
Add is_upper and is_lower helper unicode functions
2017-10-07 21:54:55 +08:00
Maxime Coste
ca17fbbeb9
Merge remote-tracking branch 'Delapouite/docs-scroll'
2017-10-07 21:51:37 +08:00
Maxime Coste
a5ae21d70d
Move HookManager::Hook definition in the cpp
...
This avoids including regex.hh in the header.
2017-10-06 13:58:04 +08:00
Maxime Coste
18705a0097
Add missing operator+= and -= on utf8_iterator
...
Fix operator== and != that were non-const as well.
2017-10-06 13:57:54 +08:00
Maxime Coste
cbb6e9ea0f
Merge remote-tracking branch 'Delapouite/client_list'
2017-10-06 13:53:55 +08:00
Maxime Coste
8900d06646
Merge remote-tracking branch 'Delapouite/complete-line'
2017-10-06 13:50:42 +08:00
Maxime Coste
3cfd3a3276
Merge remote-tracking branch 'Delapouite/debug-mappings'
2017-10-06 13:49:52 +08:00
Maxime Coste
1b22472ce8
Remove unneeded regex.hh include in color.cc
2017-10-06 13:48:30 +08:00
Maxime Coste
1a20e26cc4
Allow itersel with draft context to change the buffer
...
That way we can cater to the use case of executing some keys for
`:grep` matches with `exec -itersel -draft :grep-jump<ret>...`
2017-10-06 13:48:16 +08:00
Maxime Coste
30ab437777
Add more constexpr to flags wrapping functions
2017-10-06 13:48:01 +08:00
Maxime Coste
75d2eb2b79
formatting tweak
2017-10-06 13:47:30 +08:00
Delapouite
d03858280a
Add client_list var
2017-10-05 16:41:36 +02:00
Delapouite
0e62518d89
Docs: add missing normal keys <c-[bfud]>
2017-10-04 12:47:56 +02:00
Delapouite
a63cf00b05
Add debug mappings
2017-10-03 23:00:08 +02:00
Delapouite
6bfc99bf08
Add 'line' in completers option as a way to force explicit <c-x>f
2017-10-02 18:45:11 +02:00
Maxime Coste
0da5cabbfe
Distinguish between modes being disabled temporarily and definitely
...
That way, insert mode knows when it can restore selections/avoid eol
instead of (wrongly) doing it in the destructor that ends up running
unpredictibly (as the mode is kept alive during its on_key call, even
though it can happen that it is not the active mode anymore at the end
of that call).
Fixes #1580
2017-09-28 11:11:29 +08:00
Maxime Coste
100be4b836
Merge remote-tracking branch 'Delapouite/runtime-error'
2017-09-28 10:39:44 +08:00
Maxime Coste
a727e0fa0a
Merge remote-tracking branch 'Delapouite/jump'
2017-09-28 10:38:42 +08:00
Delapouite
c7c8c14561
Display selections count in insert mode the same it's displayed in normal mode
2017-09-27 18:47:37 +02:00
Delapouite
7224fe3840
Convert status info into proper runtime_errors
2017-09-27 17:53:52 +02:00
Delapouite
6b339b7a97
Add status info when navigating through jumplist (<c-o>, <c-i>)
2017-09-27 17:26:39 +02:00
Maxime Coste
76f072a786
Removing the local client due to SIGHUP is not graceful
...
That means we will now backup modified buffers if that client was
the last.
Should improve things for #1590
2017-09-27 11:08:55 +08:00
Delapouite
25f25df8f5
Add selections_desc format to select autoinfo
2017-09-26 12:51:52 +02:00
Maxime Coste
626ccc09cc
Merge remote-tracking branch 'Delapouite/next-history-id'
2017-09-23 13:18:58 +09:00
Maxime Coste
3a5bb051a8
Small code style tweak
2017-09-23 13:18:00 +09:00
Maxime Coste
002e77534f
Merge remote-tracking branch 'occivink/quit-on-esc'
2017-09-23 13:13:51 +09:00
Maxime Coste
8107087510
Merge remote-tracking branch 'Delapouite/commands-docstring'
2017-09-23 13:12:03 +09:00
Maxime Coste
0dd9bdd11f
Merge remote-tracking branch 'Delapouite/indent-count'
2017-09-23 13:11:19 +09:00
Delapouite
0b310b64ad
Add count support for indent / deindent
2017-09-21 12:26:22 +02:00
Olivier Perret
a20ecf6b00
Use <esc> to exit on-key modes
2017-09-21 11:53:10 +02:00
Delapouite
3c05b11196
Fix missing spaces / new lines in commands docstring
2017-09-21 10:56:20 +02:00
Delapouite
b46c9ac630
Add max_history_id in status printed with <a-u> and <a-U>
2017-09-20 07:32:45 +02:00
Delapouite
17520a0886
Add '[debug]' context_info for debug buffers
2017-09-19 18:16:11 +02:00
Maxime Coste
3aaf646eda
Fix compilation
2017-09-18 10:30:21 +09:00
Maxime Coste
3d79395e63
Document custom text object move in breaking changes
2017-09-18 10:06:41 +09:00
Maxime Coste
a3644f49a3
Merge remote-tracking branch 'Delapouite/custom-text-object'
2017-09-18 10:05:51 +09:00
Maxime Coste
d5c10472f6
Avoid wrapping between punctuation and word
...
Fixes #1550
2017-09-18 09:52:24 +09:00
Maxime Coste
37589fb7b4
Merge remote-tracking branch 'Delapouite/scroll-count'
2017-09-18 09:42:24 +09:00
Delapouite
e52003049c
Add count support for scroll keys (PageUp, PageDown, C-bfud)
2017-09-17 19:55:06 +02:00
Delapouite
58b0bd6f63
Fix typo: parmeter → parameter
2017-09-14 23:19:55 +02:00
Maxime Coste
772f85b883
Expose the character under the cursor as $kak_cursor_char_value
...
Fixes #142
2017-09-12 12:45:39 +08:00
Maxime Coste
6fefe66415
Replace invalid codepoints with � instead of U+XXXX
...
That way we get more predicitible column lenght with invalid codepoints.
2017-09-12 12:34:13 +08:00
Maxime Coste
df6b39ab60
Hide info box and eventual status message after handling a mouse event
...
Fixes #1566
2017-09-12 11:38:17 +08:00
Maxime Coste
63b1d0c353
Rename some string conversion function to the common 'to_string'
2017-09-12 11:31:57 +08:00
Maxime Coste
90ab5ff93b
Merge remote-tracking branch 'Delapouite/debug-faces'
2017-09-12 10:10:02 +08:00
Delapouite
53090c0dd3
Add debug faces
2017-09-11 15:49:33 +02:00
Maxime Coste
c859cb57dc
Merge remote-tracking branch 'Delapouite/too-many'
2017-09-11 21:14:06 +08:00
Maxime Coste
ba71f209af
Fork server to background when the client/server process receives SIGHUP
...
Avoid losing the whole session when closing the terminal emulator of
the client/server process, only the client will be removed and the
server will be forked.
2017-09-11 14:21:14 +08:00
Delapouite
3ed0ac8f62
Fix typo: to many → too many
2017-09-07 21:45:46 +02:00
Maxime Coste
fdf7cf3944
Small code simplifications
2017-09-07 19:38:34 +08:00
Maxime Coste
bd66aff808
Tolerate unwritable socket when trying to send the disconnection message
...
Fixes #1552
2017-09-07 19:37:58 +08:00
Maxime Coste
8e3e5b10c1
Merge remote-tracking branch 'Franciman/exposed_history_id'
2017-09-06 11:55:00 +08:00
Francesco Magliocca
d4fa94c356
Rename env variable kak_curr_history_id to kak_history_id
2017-09-04 16:41:27 +02:00
Francesco Magliocca
b3ac4d86b6
Add current history id to env variables
2017-09-02 12:14:19 +02:00
Maxime Coste
9baebbd186
Slight tweak of FaceRegistry::FaceOrAlias definition
2017-09-01 17:34:44 +07:00
Maxime Coste
e66a5c78ad
Make Buffer::Modification an aggregate
2017-09-01 17:32:03 +07:00
Maxime Coste
5c5491405e
Make LineAndColumn an aggregate as well
2017-09-01 17:21:50 +07:00
Maxime Coste
64183b1e4c
Make Token a simple aggregate
2017-09-01 17:09:34 +07:00
Maxime Coste
44fb375c81
Make InsertCompletion an aggregate
2017-09-01 17:03:34 +07:00
Maxime Coste
6d0016f89c
Remove unneeded ParameterDesc constructor
...
With C++14, we can use aggregate initialization and default values
together.
2017-09-01 16:58:52 +07:00
Maxime Coste
9672e9219d
Code style tweak in optional.hh
2017-09-01 16:54:06 +07:00
Maxime Coste
ab6a999431
Rename containers.hh to ranges.hh (and Container to Range)
2017-08-29 15:23:03 +07:00
Maxime Coste
c0a0ba3c0a
Rework containers.hh to get rid of the Factory structures
...
Replace them with polymorphic lambdas
2017-08-29 15:19:08 +07:00
Maxime Coste
1709886873
avoid literal eol in status lines, replace them with another symbol
2017-08-29 10:01:43 +07:00
Maxime Coste
24234dffa3
Do less implicit parse_filename calls
2017-08-29 09:42:04 +07:00
Maxime Coste
9001580c9b
Do not expand env vars in parse_filename
...
We have far enough ways to provide that feature, through the shell
or through regular expands.
Fixes #1545
2017-08-29 08:33:00 +07:00
Maxime Coste
5b43c46b75
Fix naming in fd_writable
2017-08-29 08:32:47 +07:00
Maxime Coste
e80b36b495
Expose client pid as $kak_client_pid
...
As requested in #1414
2017-08-28 13:12:45 +07:00
Maxime Coste
da227e48e9
Fix String::Data copying/moving from self
2017-08-23 18:13:42 +07:00
Maxime Coste
f7bed9eb18
Support specifying an exit status on quit
commands
...
The current client exit status can be specified as an optional
parameter, is nothing is given the exit status will be 0.
Fixes #1230
2017-08-23 13:33:13 +07:00
Maxime Coste
3efc406d57
Optimize DisplayBuffer::optimize()
...
Previous implementation was erasing in the middle of the atoms
vector each time two atoms were merged, leading to a move of
all following atoms.
2017-08-23 08:42:00 +07:00
Maxime Coste
6176a19520
Update startup info
...
Remove old breaking changes, add selection extending behaviour change.
2017-08-23 07:00:37 +07:00
Maxime Coste
2050167d98
Add build type (debug/release) in ":debug info" output
2017-08-22 15:12:17 +07:00
Maxime Coste
82d23bc400
Remove now trivial Selection::merge_with method
2017-08-18 08:52:40 +07:00
Maxime Coste
609a8ee8c7
Change selection extension code to be simpler
...
Selection extension now just keeps the anchor in place insead of
trying to be smart depending on the direction of selections.
2017-08-18 08:49:37 +07:00
Maxime Coste
1688332d12
Revert "Change HashCompatible trait to a variable template"
...
This reverts commit b58f72315c
.
Unfortunately gcc-5.1 handling of variable template partial
specializations is bugged.
2017-08-18 08:17:02 +07:00
Maxime Coste
65bac9c027
Respecify EnumDescs array sizes manually to workaround clang-3.6 bug
2017-08-18 08:15:18 +07:00