aver-d
29a7cd3ab4
Insert complete: Remove path info with one buffer
...
This change is useful when using `set scope completers word=buffer`,
instead of the default word=all.
If candidates all come from the same buffer, then the path/filename
information is the same and therefore unnecessary. This change
prevents the same path from being repeated, and the buffer's
source code is less obscured.
More generally, there could be an option to disable the path
information entirely in all cases, but for now this change seems
a reasonable solution until any such option exists.
2018-01-25 17:49:02 +00:00
Maxime Coste
220be30f02
Support multiline selections in C/<a-C>
...
Fixes #1725
2018-01-24 10:33:22 +11:00
Maxime Coste
299e22ca7c
Do not block when waiting for next event if we have pending input
...
Handle next event should never block if we have already accumulated
input that we want to process. As we can accumulate new input in
lots of places (everytime we run a shell process for example, we
might end up reading input keys. That can be triggered during the
mode line generation which takes place during display of the window)
Fixes #1804
2018-01-21 12:00:40 +11:00
Maxime Coste
d22c989984
Rename InputModeChange hook to ModeChange
...
InputModeChange is a bit long to type and its pretty clear in Kakoune
that "Mode" means "Input mode", so use a shorter and as clear name.
2018-01-21 10:34:09 +11:00
Maxime Coste
07dfcd336d
Fallback to getpwuid in the unlikely case $HOME is underfined
...
Add a homedir() helper function, and document the $kak_config
env var.
2018-01-20 11:19:23 +11:00
Maxime Coste
e7cbf38af7
Introduce a $kak_config env var containing the Kakoune user config dir
...
Makes it easier for users who want to locate their kakrc file, and
does not require to go through shell expansion to get it as
"${XDG_CONFIG_DIR:-${HOME}/.config}/kak"
Fixes #1740
2018-01-19 10:05:08 +11:00
Maxime Coste
55621fb4cc
Do not save last command/pipe/regex in register when history is disabled
2018-01-19 09:48:57 +11:00
Maxime Coste
eeacb8b5a8
Use the _str and _sv string literals more often
2018-01-18 09:00:54 +11:00
Maxime Coste
b4f8497f8d
Slight code refactor in InputHandler::handle_key
2018-01-15 10:25:58 +11:00
Maxime Coste
e74b581b0a
Save/restore main selection from/to strings
...
Always consider that the first selection in the list is the main
one, save selections that way.
This approach was suggested by PR #1786 but the implementation here
is different, and is used more generally whenever we save selections
to strings.
This is also the prefered way to work only on the main selection:
save selections with Z, reduce to main with <space>, restore with z.
Closes #1786
Fixes #1750
2018-01-12 07:51:19 +11:00
Maxime Coste
2366af29e2
Slight refactor of jump collapsing code
2018-01-12 07:50:52 +11:00
Maxime Coste
827aab1386
Merge remote-tracking branch 'Delapouite/print_status'
2018-01-12 07:03:21 +11:00
Maxime Coste
af4cc11404
Merge remote-tracking branch 'lenormf/fix-makefile'
2018-01-12 07:02:40 +11:00
Delapouite
7ecc3d343f
Remove extraneous face when clearing status line
2018-01-11 15:26:42 +01:00
Frank LENORMAND
202c977b3d
src makefile: Abort compilation when pkg-config
is not in PATH
...
Fixes #1792
2018-01-11 10:41:19 +03:00
Maxime Coste
bf66302d29
Small code style tweak
2018-01-11 13:57:33 +11:00
Maxime Coste
996d8abef4
Write new buffers even when unmodified
...
Fixes #1794
2018-01-08 09:42:26 +11:00
Maxime Coste
49e028b847
Add information on InputModeChange hook in the startup message
2017-12-29 10:00:45 +11:00
Maxime Coste
6333ae207f
Correctly set the NotBeginOfSubject/NotEndOfSubject flags for regex matching
...
Fixes #1778
2017-12-29 09:55:53 +11:00
Maxime Coste
6851604546
Regex: Add a RegexExecFlags::NotEndOfSubject flag
2017-12-29 09:55:38 +11:00
Delapouite
74898120ed
Add session name filtering for KakBegin hook
2017-12-21 22:22:33 +01:00
Maxime Coste
9b83589b18
Completion: Use a heap to gather the best matches instead of sorting
...
Generalize the behaviour of `shell-candidates` to insert completion,
gather the best 100 matches by using a heap and poping max a hundred
times.
2017-12-21 12:55:29 +11:00
Maxime Coste
a38d6cc3f0
Highlighter: In general, highlight replaced ranges
...
Fixes #1251
2017-12-21 12:26:25 +11:00
Maxime Coste
0814bb2962
InputHandler: Preserve no-hooks on insert mode from single command normal mode
...
Fixes #1775
2017-12-21 10:30:45 +11:00
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