Commit Graph

4220 Commits

Author SHA1 Message Date
Maxime Coste
e0b28fa421 Introduce InputModeChange hook
InputModeChange <old mode>:<new mode> is intended to replace the various
<Mode>Begin/<Mode>End hooks.

Fixes #1772
2017-12-18 11:09:54 +11:00
Delapouite
b81c6b5840 Use existing window reference in view mode 2017-12-17 14:42:09 +01:00
Maxime Coste
d8dc7d7f39 Go back to getpwuid call to get user name from user id
Unfortunately, reading /etc/passwd is not enough.
2017-12-15 08:19:56 +11:00
Maxime Coste
cafecda230 Window: avoid positionning window on a negative column
Fixes #1741
2017-12-15 08:17:35 +11:00
Maxime Coste
4b06c09c68 Make edit command work fine when running from an empty context
This way, the kind of context we get from a piped command allows
for opening a buffer and working with it directly.
2017-12-12 18:22:05 +11:00
Maxime Coste
ce2c0e54f4 Detect invalid coordinates in selection_from_string
Fixes #1751
2017-12-12 18:08:40 +11:00
Maxime Coste
0033491d69 InsertCompleter: Respected ignored_filename option in filename completer 2017-12-09 22:03:19 +11:00
Maxime Coste
a33d18e125 Go back to getpwuid call on OSX
Reading /etc/passwd on OSX does not give us the full list of users.

Fixes #1758
2017-12-09 12:13:02 +08:00
Maxime Coste
bedb98220c Ranges: add unit test and fix corner case in split view 2017-12-07 01:58:19 +08:00
Maxime Coste
2f48bbf6ff Tweak unescape template function to unescape the escape char as well
Test that more thouroughly in the unit tests.
2017-12-07 01:56:02 +08:00
Maxime Coste
99636c6230 Remove Vector returning split functions, use range adaptor
Do not allocate temporary vectors to store splitted data, use the
'split' range adaptor along with transform(unescape) to provide the
same feature with less allocations.
2017-12-06 17:18:44 +08:00
Maxime Coste
70e2122ae6 InsertCompleter: only accept words matching the target buffer word definition
The words we store in the WordDB are dependent on the extra_word_chars
options, which can be different for different buffers. When completing
words in a buffer based on the WordDB from another buffer, some candidates
might contains characters that are not considered word character for
the target buffer, ignore those words.
2017-12-06 14:15:36 +08:00
Maxime Coste
86fcc55e53 RankedMatch: Make punctuation ordered *before* alphanumeric characters 2017-12-06 13:58:34 +08:00
Maxime Coste
936b95ac34 Ensure that normal mode restores disabled hook status on disabled
Fixes #1744
2017-12-06 12:59:31 +08:00
Maxime Coste
274367116a Replace uses of getpwuid which is incompatible with static linking
Introduce a get_user_name function which parses '/etc/passwd' to find
the username associated with a user id.
2017-12-04 15:19:57 +08:00
Maxime Coste
73a239d3be Text-Objects: Use regex to select surroundings
Fixes #925
2017-12-03 17:15:24 +08:00
Maxime Coste
9a4b5de772 Regex: Introduce backward_regex_search helper function 2017-12-03 17:12:33 +08:00
Maxime Coste
b34bb6b794 Regex: make RegexIterator iterable and able to iter backwards 2017-12-02 14:02:41 +08:00
Maxime Coste
413f880e9e Regex: Support forward and backward matching code in the same CompiledRegex
No need to have two separate regexes to handle forward and backward
matching, just passing RegexCompileFlags::Backward will add support
for backward matching to the regex. For backward only regex, pass
RegexCompileFlags::NoForward as well to disable generation of
forward matching code.
2017-12-01 19:57:02 +08:00
Maxime Coste
7bfb695c45 Regex: Do not allow private use codepoints literals
We use them to encode non-literals in lookarounds, so they can
trigger bugs.

Fixes #1737
2017-12-01 16:37:18 +08:00
Maxime Coste
8d892eeb62 Regex: use StartDesc to early out when not searching
Early out as well if we do not find any potential start position.
2017-12-01 15:03:03 +08:00
Maxime Coste
65b057f261 Regex: rename StartChars to StartDesc
It only contains chars for now, but its still more generally
describing where matches can start.
2017-12-01 14:46:18 +08:00
Maxime Coste
b91f43b031 Regex: optimize parsing a bit 2017-11-30 14:32:29 +08:00
Maxime Coste
c1f0efa3f4 Regex: smarter handling of start chars computation for character class 2017-11-30 14:19:41 +08:00
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