Commit Graph

5186 Commits

Author SHA1 Message Date
Maxime Coste
c82bf31378 NCursesUI: Use accumulate algorithm to gather the longest element in menu 2018-03-13 14:14:16 +11:00
Maxime Coste
bfaf52f8c0 Do not jump to buffer start on g. with no previous modifications 2018-03-13 14:00:57 +11:00
Delapouite
d5d23834f6 Handle hyphens in user-mode names
Fix #1921
2018-03-11 14:58:53 +01:00
Maxime Coste
e66073bc94 Detect infinit recursion in reference highlighting
Reference highlighters allow for potential mutual recursion between
highlighters. This is usually fine, but if the recursion happens on
the same buffer range, it means we will recurse infinitely.

Fixes #1920
2018-03-11 11:44:10 +11:00
Maxime Coste
4584ecac77 Move WORD text object to <a-w>
It improves consistency and it looked like there was support for that
change on github.
Fixes #1861
2018-03-10 00:25:19 +11:00
Maxime Coste
f801d0064a Merge remote-tracking branch 'Delapouite/hls' 2018-03-10 00:07:03 +11:00
Maxime Coste
9125b01fa8 Detect no-op replaces and do not act on them
This avoids recording no-op undo groups.
2018-03-09 23:07:05 +11:00
Delapouite
abc2d28570 Docs: extend explanations about line_flags, ranges and replace-ranges 2018-03-06 12:15:55 +01:00
Maxime Coste
9c85d9b389 Support changing autoreload option directly from the reload message
Pressing Y or N will set the buffer (or window, if it is set at that
scope) autoreload option to the corresponding value, avoiding infinite
loops where a file getting constantly modified prevents the user from
using Kakoune.
2018-03-05 11:17:57 +11:00
Maxime Coste
07113e7ee5 Add a GlobalSetOption hook 2018-03-05 10:39:14 +11:00
Maxime Coste
642b711d94 Merge remote-tracking branch 'Delapouite/scratch' 2018-03-05 07:10:57 +11:00
Maxime Coste
fb65fa60f8 Regex: take the full subject range as a parameter
To allow more general look arounds out of the actual search range,
pass a second range (the actual subject). This allows us to remove
various flags such as PrevAvailable or NotBeginOfSubject, which are
now easy to check from the subject range.

Fixes #1902
2018-03-05 05:48:10 +11:00
Maxime Coste
d9e44dfacf Regex: Remove helper functions from regex_impl.hh
They were close duplicates from the ones in regex.hh and not used
anywhere else.
2018-03-05 03:10:47 +11:00
Maxime Coste
6c4faf2050 Merge remote-tracking branch 'fsub/unused-lambda-capture' 2018-03-05 00:39:56 +11:00
Maxime Coste
a2fc89a6ec Remove SelectionList::update_timestamp()
This single line member function was only used once, inline it
directly.
2018-03-04 10:35:24 +11:00
Maxime Coste
2fd42fe5fc Insert: Do not move end of line on open line (o/O)
Change the logic of open line commands so that if a selection lies
on the end of line character of the line from which we open a new
line, that selection does not move.

If we have two clients, A and B, with B's cursor on the eol character
of line L, and A hits `o` while on line L, B's cursor should stay
on the same (logical) line. Previous behaviour would make B's cursor
jump on the newly inserted line.
2018-03-04 10:32:21 +11:00
fsub
44d381ce79 Remove unused lambda capture 2018-03-03 17:57:51 +01:00
Delapouite
c4eb4438d2 Remove <scope> from user-modes commands 2018-03-02 09:28:27 +01:00
Maxime Coste
7a54c0edfe Update status message with new breaking changes 2018-03-01 15:36:25 +11:00
Maxime Coste
28716ec058 Change x behaviour to select full line first even if on EOL
x will always first select current line fully, and only then select
next line.
2018-03-01 15:34:31 +11:00
Maxime Coste
f907e6cc46 Reintroduce complex selection merging behaviour
Selection merging is necessary if we want X to work nicely when we are
on EOL (jumping to next line is as nice as it could be, and we are much
more often on EOL nowadays).
2018-03-01 15:21:55 +11:00
Maxime Coste
7dfd439263 Merge remote-tracking branch 'Delapouite/user-mode-lock' 2018-03-01 14:04:52 +11:00
Maxime Coste
2193947b71 InsertCompleter: refactor line completer implementation 2018-02-28 15:40:42 +11:00
Maxime Coste
4e6b24eea2 Merge remote-tracking branch 'Delapouite/line_complete' 2018-02-28 15:32:31 +11:00
Maxime Coste
44a5082aaf Commands: Refactor generate_switches_doc 2018-02-28 15:32:11 +11:00
Maxime Coste
a6fd70c456 Ranges: Fix copiability of some range view iterators
Some iterators were refering to to their view with a const ref, this
was making them non-copiable. Change those const ref into const pointers
in order to fix that.
2018-02-28 15:16:49 +11:00
Maxime Coste
edee85a847 Merge remote-tracking branch 'aver-d/option_display' 2018-02-28 15:09:26 +11:00
Maxime Coste
d498a059c4 Prompt: update completions after inserting register or raw ke 2018-02-28 15:05:38 +11:00
Maxime Coste
bebc81ebe1 RefPtr: use inconditional noexcept specification on destructor
The conditional specification could end up being recursive,
assume destructors must be (as is the C++ default) noexcept.
2018-02-28 15:04:00 +11:00
Delapouite
a6a1c34288 Add -lock switch to enter-user-mode command 2018-02-27 19:55:00 +01:00
Delapouite
0568836943 Add support for line completion in all buffers
- via completers option with line=all vs line=buffer
- via <c-x> L mapping
2018-02-27 09:48:49 +01:00
Delapouite
98fcf8a497 Add [scratch] indicator in context info 2018-02-27 08:22:46 +01:00
Maxime Coste
b4dc16010d Fix out of bound read in ParameterParser::get_switch
The empty string case was not correctly handled.
Fixes #1883
2018-02-26 15:20:19 +11:00
Maxime Coste
18f0902824 Merge remote-tracking branch 'Delapouite/sels' 2018-02-26 11:34:05 +11:00
aver-d
f43635c4df Ease reading of command-line options
This change displays command-line options in grid format. Each
parameter is indented with two spaces and then padded to maintain
vertical alignment of each description.

I think the visual spacing makes the options much easier to
read. This is particularly important for people new to Kakoune who
use `-help` as a way to become familiar with the program.
2018-02-25 01:46:50 +00:00
Maxime Coste
6453ce7394 RefPtr: Add some more noexcept specifications 2018-02-25 00:20:10 +11:00
Maxime Coste
67424aae1e Remove avoidance of end of lines
Various places in Kakoune code used to modify selections so that
cursors would not lie on an end of line. Remove those to increase
Kakoune's consistency and simplicity.

Now that end of lines are highlighted separately, they should not
be handled specially in most commands.
2018-02-25 00:05:05 +11:00
Maxime Coste
171e787063 Update startup message to notify about h/l change 2018-02-24 23:16:39 +11:00
Maxime Coste
2a60af25dc Allow l/h to cross line boundaries
l and h are now respectively "next character" and "previous character"
2018-02-24 23:16:39 +11:00
Maxime Coste
6a6e71dc0f Highlight cursors differently when they lie on an end of line
When on an end of line, certain behaviours can be surprising, for
example delete will join the following line (which makes sense, and
is consistent, but hard to predict if we do not know the cursor is
on and end of line).

As Kakoune is moving more and more towards treating end of lines
as any other character, making it clear when the cursor lies on
them seems like a good way to reduce surprise.
2018-02-24 21:32:01 +11:00
Maxime Coste
a0de41d165 goto last change: do not try to avoid end of lines
Avoiding end of line is a behaviour we avoid (pun intended) more and more
in Kakoune source code, now that end of lines are regularly selected, it
makes no sense to just to next line when last modification lies on an EOL
(and it probably did not make much sense back when that code was written).
2018-02-24 21:09:09 +11:00
Maxime Coste
a25d6171d3 Fix crash in select_sentence when not selection to end
select_sentence could create a buffer iterator preceeding the
buffer begin, leading to a crash trying to read line -1.
2018-02-24 20:22:23 +11:00
Maxime Coste
efce8e0ce6 Revert "Do not save last command/pipe/regex in register when history is disabled"
This reverts commit 55621fb4cc.

This should not be necessary as :exec/eval already save those registers
and reset them by default, and it breaks the ability to use those
registers during an eval/exec (as the commands behave differently)
2018-02-24 19:58:40 +11:00
Maxime Coste
4d11bb20c3 Always collapse jumps in exec/eval, remove -collapse-jumps switch
There does not seem to be any reasonable use cases of not collapsing
jumps when the input is not comming from the user. Always collapse
them.

It could make sense to move jump collapsing out of context_wrap as
in general any action not comming directly from the user should
collapse them, at the moment a comment or mapping will not collapse
jumps, which is unfortunate.
2018-02-24 19:02:15 +11:00
Maxime Coste
933ac4d3d5 Regex: Improve comments and constify some variables
Reword various comments to make some tricky parts of the regex
engine easier to understand.
2018-02-24 17:40:08 +11:00
Maxime Coste
af21d4ca1e regex: track CompiledRegex::StartDesc in the Regex memory domain 2018-02-24 16:29:24 +11:00
Delapouite
e568231fe3 Display number of combined/saved/restored selections in status 2018-02-23 22:58:44 +01:00
Maxime Coste
e9c18ebff6 Merge remote-tracking branch 'lenormf/fix-makefile' 2018-02-23 08:10:11 +11:00
aver-d
da009b0ef5 Fix typos in C++ string literals
informations, dont, incrementaly, alignement
2018-02-22 20:28:01 +00:00
Frank LENORMAND
01c1b4fd69 src makefile: Fix the --static flag passed to pkg-config 2018-02-22 15:56:14 +03:00
Maxime Coste
99d1fee44c Merge remote-tracking branch 'Delapouite/trim' 2018-02-22 22:06:27 +11:00
Maxime Coste
13ac0e367d NCursesUI: Rework menu placement to fix missing menu on small window 2018-02-22 22:04:04 +11:00
Maxime Coste
35d68d2f82 Fix crash when iterating through options on window creation
Window::on_option_changed calls hooks, which can do anything
including adding/removing options in the various option managers

Fixes #1863
2018-02-21 22:47:41 +11:00
Maxime Coste
69a0ad09b4 Rewrite OptionManager::flatten_options to use ranges
Avoid accumulating the flattened options into a vector, generate
a lazy range that will give the proper list.
2018-02-20 23:32:51 +11:00
Maxime Coste
6d111d4bd7 Re-introduce aliases in command name completion
Aliases are considered again in command name completion, but only
if they are more than 3 charactes long. This should prevent cluttering
with aliases while still letting long ones being completed.
2018-02-20 23:32:31 +11:00
Maxime Coste
6239357e99 ranges: Support temporary parameters passed to concatenated 2018-02-20 21:55:06 +11:00
Maxime Coste
fec34c3748 Json: Fix buffer overflow when reading json finishing with { or [
Fixes #1860
2018-02-20 07:42:10 +11:00
Maxime Coste
2c0eba9d95 user-modes: Fix incorrect use of keymap mode
The keymap mode was passed to on_next_key_with_autoinfo, which
means the mapping was applied directly by the InputHandler.

That led to the first key being interpretted as a mapping, then
all following keys being executed normally, as if typed in the
parent mode of the user mapping.
2018-02-19 21:03:29 +11:00
Maxime Coste
76f5fb937c Fix bug in command parsing post refactoring
Fixes #1857
2018-02-19 08:29:04 +11:00
Maxime Coste
fc60e29870 Small code tweaks regarding user modes 2018-02-18 20:24:34 +11:00
Maxime Coste
f88195d2d9 Merge remote-tracking branch 'Delapouite/user-mode' 2018-02-18 20:20:35 +11:00
Maxime Coste
eb2e44e0eb Makefile: use PKG_CONFIG to get static compilation flags as well 2018-02-18 15:43:28 +11:00
Maxime Coste
536fa29ed5 CommandManager: unescape % while parsing the string 2018-02-18 14:56:52 +11:00
Maxime Coste
dc30b0e6d6 Do not support general commands in filter mode 2018-02-18 14:54:21 +11:00
Maxime Coste
84d70f8aeb normal mode: Fail if ':' is pressed with no CommandManager 2018-02-18 14:53:37 +11:00
Maxime Coste
5924694bda ShellManager: init from a static list of env vars
No need to go through a static list and then copy them one by
one in a vector.
2018-02-18 14:52:29 +11:00
Maxime Coste
d9cddf41f2 BufferManager: Support missing ClientManager 2018-02-18 14:50:24 +11:00
Maxime Coste
10c6c59a26 Buffer: avoid expensive option flattening in on_registred with NoHooks 2018-02-18 14:48:24 +11:00
Maxime Coste
74fd602569 '*' uses escaping of meta characters instead of \Q and \E
Fixes #1825
2018-02-17 20:36:07 +11:00
Maxime Coste
bde1f5349d CommandManager: refactor parsing of commands to iterate through tokens
Avoid storing a big vector of tokens, read them one by one, and
store only the current command.
2018-02-15 23:24:19 +11:00
Delapouite
fccfc76e89 Add trim_selections primitive 2018-02-13 14:35:10 +01:00
Delapouite
6b447a0ecb Add declare-user-mode / enter-user-mode commands 2018-02-12 14:19:58 +01:00
Maxime Coste
f3c19ba7fa Prevent whitespaces in command names
Fixes #1843
2018-02-11 20:35:21 +11:00
Maxime Coste
a822bcd6e0 Do not specify utf8 InvalidPolicy when we are using the default value
It was specified only in two call sites, and everywhere now only uses
the pass policy, which is the default.
2018-02-11 17:39:19 +11:00
Maxime Coste
66fe2d84da Refuse modification of ReadOnly buffers and make Debug buffer readonly
The debug buffer is a bit special as lots of events might mutate it,
permitting it to be modified leads to some buggy behaviour:

For example, `pipe` uses a ForwardChangeTracker to track buffer
changes, but when applied on a debug buffer with the profile flag
on, each shell execution will trigger an additional modification
of the buffer while applying the changes, leading to an assertion
failing as changes might not be happening in a forward way anymore.

Trying to modify a debug buffer will now raise an error immediatly.
2018-02-11 13:06:19 +11:00
Maxime Coste
3584e00d19 Regex: Use a template argument instead of a regular one for "forward"
forward (which controls if we are compling for forward or backward
matching) is always statically known, and compilation will first
compile forward, then backward (if needed), so by having separate
compiled function we get rid of runtime branches.
2018-02-09 22:45:53 +11:00
Maxime Coste
aa9f7753e8 Regex: minor code cleanup 2018-02-09 22:19:56 +11:00
Maxime Coste
cb16e52179 FaceRegistry: pass face names as StringViews instead of const String& 2018-02-09 22:08:29 +11:00
Maxime Coste
e46a5697e5 Add a limit to the size of selection with which we will try to diff on pipe
Limit to 100K of data for now, as we diff at the byte level.
2018-02-09 21:47:18 +11:00
Maxime Coste
bbf62d1779 diff: try to improve code readability 2018-02-09 21:31:10 +11:00
Maxime Coste
b7a3d80bde CommandManager: Use byte rather than columns for token positions
Not only are display columns rarely used to give error positions,
but they make the parsing much slower as for each token we need to
compute the column in the line.
2018-02-09 20:30:33 +11:00
Maxime Coste
e2c1d44a7f Fix parsing of percent tokens with unicode separators 2018-02-06 20:29:08 +11:00
Maxime Coste
4a96926c4b Handle errors while reloading buffer gracefully
Fixes #1831
2018-02-05 20:27:32 +11:00
Maxime Coste
f592768d3a Remove the New flag from a buffer after reloading it
If we reload a buffer, it means its underlying file exists, hence the
New flag does not make sense anymore. It could be that the file appeared
on the filesystem in the meantime.
2018-02-05 20:18:51 +11:00
Maxime Coste
05f57ace07 CommandManager: parse command lines as utf8 instead of ascii
Fixes #1829
2018-02-04 09:21:15 +11:00
Maxime Coste
52016d32bc Makefile: Only check for pkg-config when on a system that uses it
This fixes compilation on OSX where pkg-config is not installed
by default.
2018-02-03 13:37:09 +11:00
Maxime Coste
90c16d2b0d Profile the time it takes to source a file
`:source` command will now generate timings if profile is enabled
in the debug option, to help find which script can be slow to load.

This should help for #1823
2018-02-01 09:03:16 +11:00
Maxime Coste
e41b4ee65d Change m to search until the end of the buffer instead of end of line
Fixes #1774
 # Please enter the commit message for your changes. Lines starting
2018-01-31 11:10:18 +11:00
Maxime Coste
81eb2ee428 Do not strip whitespaces with '*'
Stripping whitespaces there is a failed experiment as it breaks the
ability to use multi-selections consistently: Using '*' followed by some
`N` to add following matches, we end up with mismatched selections
due to whitespace stripping the original selection still contains
whitespaces where all the new ones do not. Once we get to this state,
most selection commands will give different results for the initial
selection and the other ones, breaking predictible multiselection use,
one of the cornerstones of Kakoune editing model.
2018-01-31 09:31:18 +11:00
Maxime Coste
c30a954dfc ncurses: change handling of <c-z> suspend to improve terminal state
reset the mouse state so that the terminal can take back control
of the mouse while Kakoune is suspended, and does not emit focus
events anymore.

Fixes #1816
2018-01-30 10:46:34 +11:00
Maxime Coste
9c25e955df Use '/' register as the default register for <a-k> and <a-K>
Fixes #1808
2018-01-26 14:15:18 +11:00
Maxime Coste
bf73cb0109 Reset normal mode before hiding the reload buffer info box
Reseting normal mode will enable normal mode, which will trigger
a check for buffer modification. We do not want that check to
happen as we are trying to close the info box. Doing that mode
reset first will prevent the check from happening (as the info
box is already displayed), and will correctly hide it afterwards.

Fixes #1809
2018-01-26 13:45:36 +11:00
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
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
Maxime Coste
e0e9b8bae4 Try to get make_array to compile with older compiler version 2017-08-18 07:45:38 +07:00
Maxime Coste
8a2b8a9498 Do not consider the 8th bit to mean Alt on keys that are mouse events
Fix handling of mouse events for columns 128 to 223, we are still limited
by ncurses for columns > 223.
Fixes #1532
2017-08-16 00:40:45 +07:00
Maxime Coste
b58f72315c Change HashCompatible trait to a variable template 2017-08-14 11:54:38 +07:00
Maxime Coste
9329fc99d2 Style tweak for regex code 2017-08-14 11:41:12 +07:00
Maxime Coste
6aa2388700 Use decltype(auto) return type for some to_string functions
Remove explicit return type thats just duplicating the return
expression.
2017-08-14 11:29:55 +07:00
Maxime Coste
1b1239b25a Remove size redundancy in enum_desc function declaration
The need to have the array size in the return type was redundant with
the actual list of elements.
2017-08-12 22:11:58 +07:00
Maxime Coste
407c84666c Remove redundant types inside Kakoune::Allocator 2017-08-12 15:49:38 +07:00
Maxime Coste
a61c51dfc6 Merge remote-tracking branch 'Delapouite/single_param' 2017-08-07 21:48:10 +07:00
Maxime Coste
fc64369f9d Purge history on buffer reload when NoUndo flag is on
We were preserving the history in that case, so on fifo buffers
(that set the NoUndo flag until the fifo is closed), we still had
the history from the "previous life" of the buffer, leading crashes
when trying to apply it.

Fixes #1518
2017-08-04 11:39:28 +07:00
Maxime Coste
45a7496f54 Fix SafeCountable and RefCountable copy/move logic
The safe and ref counts should not get copied around.
2017-08-04 11:38:04 +07:00
Maxime Coste
420c6aca23 Change documentation directory towards $kak_runtime/doc 2017-08-03 15:00:02 +07:00
Maxime Coste
53e1d2f0de Slight formatting tweak 2017-08-01 14:48:45 +07:00
Delapouite
233a459dee Use single_param for ParameterDesc when relevant in command descs 2017-07-28 20:43:42 +02:00
Maxime Coste
d0dfcd2b78 Support values starting with - for in set-register command
Fixes #1220
2017-07-25 11:38:13 +02:00
Maxime Coste
5eb63a32e5 Do not reject switch parameters starting with -
Closes #1193
2017-07-23 23:21:51 +02:00
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
Maxime Coste
413d8b7ddd Change multi modifier key syntax to be <c-a-space> instead of <ca-space>
Better fix for #1311
2017-04-11 10:44:14 +01:00
Maxime Coste
112bd156e4 Merge remote-tracking branch 'lenormf/fix-filter-backup-suffix' 2017-04-10 21:39:24 +01:00
Maxime Coste
c1c40a4b56 Remove some now unneeded uses of const String& params
HashMap supports finding String from StringView.
2017-04-10 21:33:20 +01:00
Maxime Coste
a4b82131e5 Add support for parsing multiple modifiers in keys
<ca-key> means control+alt key, <ac-key> works as well.
Fixes #1311
2017-04-10 21:19:56 +01:00
Frank LENORMAND
16068321c1 src: Support the -help flag
This commit allows a help message to be printed when a `-help` flag is
passed to the editor, which will subsequently quit after a summary and a
description of all the flags available have been displayed.

The GNU convention (passing a single `--help` argument to the program)
is also supported, although undocumented.

The man page also now documents the `+:` argument, although unrelated to
the original changeset.
2017-04-10 22:23:30 +03:00
Maxime Coste
94145f2a89 ncurses: When hiding the menu, recompute the info position 2017-04-04 08:36:21 +01:00
Maxime Coste
6ad2f721dd Do not disable autoinfo and autoshowcompl in non interactive context
Fixes #1303
Fixes #1152
2017-04-03 18:16:32 +01:00
Maxime Coste
f31e898f13 Change prompt completion to only update when idle 2017-04-03 18:11:09 +01:00
Maxime Coste
055ed5ff7e Expose hook params regex captures in hook_param_capture_N 2017-03-30 11:31:07 +01:00
Maxime Coste
2cfe3cae36 Add an InsertDelete hook 2017-03-30 10:38:56 +01:00
Maxime Coste
5f4f8991e5 Merge remote-tracking branch 'lenormf/fix-makefile-distclean' 2017-03-27 15:51:05 +01:00
Frank LENORMAND
ce7673b7b7 src: Fix the distclean Makefile target
Have the Makefile remove the actual binaries and generated documentation
when called with the `distclean` target
2017-03-26 10:49:17 +03:00
Maxime Coste
95e020ed77 Remove some unneeded type declarations in AliasRegistry 2017-03-24 20:13:18 +00:00
Frank LENORMAND
6b8587000b src: Introduce a -i suffix flag for filter backups
This commit allows the user to chose to backup the files on which a
filter has been run, by specifying a suffix for the backup file. The
former implementation always backed up the files with a hardcoded
".kak-bak" suffix.

When no suffix is specified on the command line, the files are not
saved.

Fixes #1288
2017-03-23 08:50:43 +03:00
Maxime Coste
ca17572301 Try to fix clang 3.5 compilation 2017-03-22 21:08:52 +00:00
Maxime Coste
777ba287e1 Merge faces in show_whitespaces highlighter instead of replacing it 2017-03-21 18:17:43 +00:00
Maxime Coste
8b1078e510 Use a HashMap to store the normal mode keymap 2017-03-16 23:40:38 +00:00
Maxime Coste
e44f95820e Fixes some clang-tidy warning and add a few missing meta.hh include 2017-03-16 23:34:02 +00:00
Maxime Coste
5f7464d90d Try to clean up option include a bit 2017-03-16 09:57:39 +00:00
Maxime Coste
7eaa058450 Move enum/flags option functions to option_types.hh 2017-03-15 18:28:32 +00:00
Maxime Coste
7d9f1df73a Small code tweaks regarding flags handling 2017-03-15 18:25:59 +00:00
Maxime Coste
458dd2e9fa Remove unneeded 'valid' helper template 2017-03-15 18:02:36 +00:00
Maxime Coste
db9b863222 Migrate WithBitOps template specialization to with_bit_ops function
This way we dont depend on knowing the base template to enable bit ops
on an enum type.
2017-03-15 18:00:58 +00:00
Maxime Coste
a49e175727 Migrate to a more value based meta programming model
Introduce Meta::Type<T> to store a type as value, and pass it
around, migrate enum_desc and option_type_name to this.
2017-03-15 17:42:02 +00:00
Maxime Coste
a88e58763b Move SelectionList::set implementation out of the header 2017-03-15 16:51:55 +00:00
Maxime Coste
5705b6c6f9 The canonical name for the documentation command is :doc, not :help 2017-03-15 11:49:00 +00:00
Frank LENORMAND
0acb350619 src: Make the cursor character an opening delimiter
This commit allows the editor to consider the character under the cursor
as an opening delimiter when using an object selector, instead of
ignoring it and looking for one before the cursor.
2017-03-15 14:39:40 +03:00
Frank LENORMAND
2aa5d3b016 src: Align the assistant in the middle of the popup 2017-03-14 19:06:09 +03:00
Dan Rosén
5a403a9611 Increase modelinefmt configuration power 2017-03-11 21:43:51 +01:00
Maxime Coste
34da4bf08b Add dilbert in the ui_options doctring 2017-03-10 12:09:09 +00:00
Maxime Coste
564da076a6 Merge remote-tracking branch 'lenormf/assistant-dilbert' 2017-03-10 12:06:35 +00:00
Maxime Coste
0faa5567ca Fix crash on non utf8 files trigering highlighting of backward ranges
Fixes #1274
2017-03-09 23:40:34 +00:00
Maxime Coste
a0b42323ed Add a -debug flag to :edit to set the buffer as debug data
As for the *debug* buffer, buffers with the debug flag wont get
used for cycling through buffer, or word completion.
2017-03-08 19:33:25 +00:00
Frank LENORMAND
59b65bb9fb ncurses: Add a Dilbert assistant
Drawn by myself.
2017-03-08 20:03:29 +03:00
Maxime Coste
da206d9323 Try to please clang-3.5 2017-03-07 17:21:55 +00:00
Maxime Coste
dc7c5f6e67 Collapse undo groups during an eval command 2017-03-07 16:18:09 +00:00
Maxime Coste
89fa6d4fbf Small code simplification 2017-03-07 16:11:40 +00:00
Maxime Coste
30c9b3c426 Merge branch 'patch-1' of git://github.com/guillaumecherel/kakoune 2017-03-07 15:52:44 +00:00
Maxime Coste
a1a566e921 Cleanup hash_map code 2017-03-07 15:48:04 +00:00
Maxime Coste
ba02498576 Expand a bit the hash map profiling code 2017-03-07 14:01:01 +00:00
guillaumecherel
81e7158bc1 Update Makefile 2017-03-07 14:20:09 +01:00
Maxime Coste
f3fdc24383 Remove temporary stats code from HashMap 2017-03-07 01:15:41 +00:00
Maxime Coste
f0ae0b8410 Replace IdMap with HashMap 2017-03-07 01:12:37 +00:00
Maxime Coste
6373338c50 Replace uses of UnorderedMap with HashMap 2017-03-07 01:03:26 +00:00
Maxime Coste
e9f93f1b2f Add support for HashMap options types 2017-03-06 22:25:08 +00:00
Maxime Coste
420373475e Introduce a custom HashMap implementation along with a quick benchmark 2017-03-06 22:25:08 +00:00
Maxime Coste
6757ddc6cb Simplify AliasRegistry::remove_alias 2017-03-06 19:44:36 +00:00
Maxime Coste
ed2d50ecef Remove unused AliasRegistry::flatten_aliases method
We do not complete alias names anymore, so this method is not
needed.
2017-03-04 19:45:41 +00:00
Maxime Coste
cc88b0f586 Change word object selector to fail if the cursor is not on a word char 2017-03-04 18:33:50 +00:00
Maxime Coste
887232987c Refactor surround unit test code 2017-03-04 17:43:24 +00:00
Maxime Coste
ed3c48057d Refactor regex based selection code 2017-03-03 23:43:54 +00:00
Maxime Coste
1728c67fef Fix indent selection respect for original selection cursor position
Fixes #1233
2017-03-03 22:03:20 +00:00
Maxime Coste
2fa98e04c3 Merge remote-tracking branch 'ekie/hook' 2017-03-03 21:14:14 +00:00
Maxime Coste
f8a625bc2f Merge remote-tracking branch 'occivink/master' 2017-03-03 21:13:16 +00:00
Maxime Coste
134a5d1f3e Merge remote-tracking branch 'lenormf/fix-spell' 2017-03-03 21:10:51 +00:00
Maxime Coste
ddc5e958e6 Return an optional selection in most selectors, fail rather than keep current
Instead of returning the current selection when a selector fails, return
an empty Optional<Selection>. That means object selections will now
remove the selections that dont match the object.
2017-03-03 20:17:11 +00:00
Maxime Coste
6759511b9e Ensure main selection index is correct directly in SelectionList::remove 2017-03-03 20:17:11 +00:00
Maxime Coste
8a1e5d12ac Make <a-space> throw on invalid index or last selection 2017-03-03 20:17:11 +00:00
Maxime Coste
e3cfde6d07 Add docstring support for mappings, and use them in autoinfo
Fixes #105
Fixes #1100
Closes #1165
2017-03-03 20:16:36 +00:00
Olivier Perret
033b259e5b <space>, <a-space>: throw on invalid preconditions 2017-03-03 13:50:00 +01:00
Frank LENORMAND
aecc0fbb0f src: Fix the string conversion of range faces
Fixes #1250
2017-03-01 22:16:35 +03:00
Eike Plack
a35f50d832 Add RawKey to hook completion list 2017-03-01 03:28:23 +01:00
Maxime Coste
7d487e3b4c Small naming tweak 2017-02-27 20:44:38 +00:00
Maxime Coste
e5e705e151 Fix clang warnings about uninitialized timestamp field
Closes #1241
2017-02-27 20:29:53 +00:00
Maxime Coste
88752ef895 Compile optimized and debug into different files, make kak a symlink 2017-02-27 20:11:56 +00:00
Maxime Coste
1f3abde926 Cleanup some tabby mess in the Makefile 2017-02-27 20:11:27 +00:00
Maxime Coste
8703f30063 Tweak some character categorization function implementations 2017-02-23 00:56:40 +00:00
Maxime Coste
55f6ca238f Refactor get_words to be simpler and faster 2017-02-23 00:51:54 +00:00
Maxime Coste
73bb260e6c Fix support for non ascii chars in completion_extra_word_char 2017-02-23 00:35:27 +00:00
Maxime Coste
2f7313ad59 Slight code cleanup in utf8_iterator.hh 2017-02-23 00:30:59 +00:00
Maxime Coste
a39f2b0c71 Refactor WordDB::add_words to be slightly faster 2017-02-23 00:26:24 +00:00
Maxime Coste
d9abc2a156 Refactor StringData and StringRegistry to remove need for purging
Purging unused strings could get pretty expensive with a lot of
interned strings as it requiered iterating on all of them. Use
a flag on the refcount of the StringData to see if the string
is interned, and notify the StringRegistry in this case.

This should improve the speed of editing big files with many words,
such as the one described in #1195
2017-02-23 00:03:32 +00:00
Maxime Coste
7a143a7f7c Use false instead of 0 in the kak_assert do while 2017-02-23 00:03:11 +00:00
Frank LENORMAND
98cfbc7c3c Properly wrap kak_assert into a do-while scope
Expanding the `kak_assert` macro to either an `if` statement or nothing
leads to issues when the macro is used in a conditional statement that
doesn't use braces.

Example: ncurses_ui.cc:476, in non debug mode, the macro will expand to
an empty line, resulting in the `ungetch` call not being executed if the
`ioctl` call succeeds (line 448).
2017-02-22 13:04:25 +03:00
Maxime Coste
467f5547d5 Try to please clang-3.5 2017-02-22 09:44:19 +00:00
Maxime Coste
e2f6b9a393 Fix overly strict backward_sorted_until
A change that ended exactly where the previous one started was not
considered backward sorted. Leading to some very bad performances in
certain cases, like '100000o<esc>u'
2017-02-20 19:46:12 +00:00
Maxime Coste
fe2d0fab71 Fix performance of word completion with many different selections
Fixes #1228
2017-02-20 19:28:02 +00:00
Maxime Coste
5eef2b9105 Correctly handle mutation of the watcher list while iterating on them
Fixes #1227
2017-02-20 13:50:30 +00:00
Maxime Coste
2b01da530d Fix hook list in commands.cc 2017-02-19 14:14:22 +00:00
Maxime Coste
9fdbcf761d Display an info box on startup with recent breaking changes 2017-02-19 13:59:44 +00:00
Maxime Coste
9271f0a87d Fix handling of disabled_hooks regex 2017-02-19 13:59:34 +00:00
Maxime Coste
edc2a88643 Rename BufNew and BufOpen hooks to BufNewFile and BufOpenFile
Fixes #1225
2017-02-19 13:08:06 +00:00
Maxime Coste
889a2144d4 Copy the list of hooks to run before iterating on them and running them
Running hooks could result in the hook list getting mutated, leading
to potential crashes.

Fixes #1222
2017-02-19 12:08:13 +00:00
Maxime Coste
38102595ef Small naming tweak in HookManager 2017-02-19 11:52:31 +00:00
Maxime Coste
c3af384c70 Detect when -client, -buffer or -try-client are used at the same time
Fixes #1218
2017-02-15 18:59:37 +00:00
Maxime Coste
0a1cb4b9b1 Detect when switches are specified more than once
Fixes #1219
2017-02-15 18:55:11 +00:00
Maxime Coste
9e0f085b86 Reorganize code in main.cc 2017-02-14 13:54:45 +00:00
Maxime Coste
d470bd2cc9 Make numeric registers setable
Fixes #1214
2017-02-14 00:02:01 +00:00
Maxime Coste
e3a04dfa65 Fix RegisterRestorer not handling potential throws on register assign
This should fix part of #1214
2017-02-13 23:31:16 +00:00
Maxime Coste
4f18e56320 Fix non-returning parse_key lambda 2017-02-13 14:02:09 +00:00
Maxime Coste
2edb7d62ef Add support for -on-change and -on-abort to prompt
Fixes #1209
2017-02-12 12:51:58 +00:00
Maxime Coste
9ba1665e58 Refactor show_whitespaces a bit 2017-02-09 23:52:38 +00:00
Maxime Coste
6163134f30 Merge remote-tracking branch 'lenormf/show-whitespaces-flags' 2017-02-09 23:33:08 +00:00
Maxime Coste
4ae441db68 Merge remote-tracking branch 'Delapouite/decl-completer' 2017-02-09 23:26:12 +00:00
Maxime Coste
86bba5d9d2 Merge remote-tracking branch 'Delapouite/line-flags' 2017-02-09 23:26:05 +00:00
Delapouite
0cf94292e4 Add command completer for types to declare-option 2017-02-09 10:18:13 +01:00
Delapouite
cfb2b4fade Fix missing new line char in declare_option_cmd info 2017-02-09 09:01:49 +01:00
Maxime Coste
1c63d28f15 Fix Buffer::offset_coord that was dropping the target coordinate 2017-02-07 23:13:14 +00:00
Maxime Coste
5342d67fa4 Remove unneeded padding in relative line numbers highlighting
We were still adding one more char to the line number width in case
it would contain a minus sign. The minus signs are not used anymore
in relative line numbering so we dont need to keep that addtional
char which is always a blank.
2017-02-07 23:01:23 +00:00
Maxime Coste
ce2b85ddac Add -match-capture support for regions higlighter
Closes #837
2017-02-06 23:00:13 +00:00
Maxime Coste
45b145f540 Small layout tweak for Buffer::HistoryNode 2017-02-06 13:33:20 +00:00
Frank LENORMAND
5d86b58a38 Allow modifying the characters used when highlighting whitespace
This commit adds the following flags to the `show_whitespaces`
highlighter, with a one character long parameter:

 * `-lf`: character replacing line feeds
 * `-spc`: character replacing spaces
 * `-nbsp`: character replacing non breakable spaces
 * `-tab`: character replacing a tabulation
 * `-tabpad`: character used as padding after a tabulation to satisfy
              the `tabstop` option
2017-02-04 10:21:13 +03:00
Maxime Coste
cb2e1a17b3 Fix some bugs in non blocking pipe writing 2017-02-03 18:40:03 +00:00
Maxime Coste
f500af9023 Merge remote-tracking branch 'ekie/move_buffer_end' 2017-02-03 13:49:33 +00:00
Maxime Coste
c793ef3aa8 Store shell-candidates completions in the Completion memory domain 2017-02-03 13:42:47 +00:00
Maxime Coste
02b7e58481 Make piping data into shell commands non blocking
Fixes #1180
2017-02-03 01:14:42 +00:00
Maxime Coste
d90919568a Also execute prompt callback when just starting
incsearch will immediatly display the result of using an empty
string (reusing the search register content).

Fixes #1174
2017-02-01 23:04:37 +00:00
Maxime Coste
bc0dfa9e8f Use <a-'> for backward rotate selection and move rotate content to <a-"> 2017-02-01 22:53:42 +00:00
Maxime Coste
65bbc19d6f Change n behaviour to only select next match for main selection
Select next match for all selections is still available as /<ret>
Fixes #1173
2017-02-01 20:00:05 +00:00
Maxime Coste
6a0354a597 Tweak ranked match ordering 2017-01-31 22:30:23 +00:00
Maxime Coste
472f5149c0 Formatting fix 2017-01-31 21:46:20 +00:00
Maxime Coste
f44415cee4 Add some noexcept to pointer policies 2017-01-31 21:45:55 +00:00
Eike Plack
01eceebf75 Support the vim behaviour for +line syntax
* Ommitting the linenumber will move to buffer end
2017-01-31 19:44:27 +01:00
Maxime Coste
34870eb353 Rework NCurses key parsing to properly handle <a-special key> 2017-01-30 13:38:56 +00:00
Maxime Coste
f30e164232 Make SharedString::create take a list of StringViews 2017-01-30 13:38:38 +00:00
Maxime Coste
9d09d14d99 Warning fix in ranked_match.cc 2017-01-30 11:22:14 +00:00
Maxime Coste
192ea9a9d9 Fix explicit insert completion menu/info not hiding
Fixes #1168
2017-01-30 10:32:29 +00:00
Maxime Coste
632e05d830 Fix infinite loop when comparing RankedMatches containing invalid utf8
If we had a word containing some invalid utf8, like a wrong sequence
of continuation bytes, we would infinitely loop back to the previous
valid character start.

Fixes #1157
2017-01-29 23:50:33 +00:00
Maxime Coste
1ff60ff592 Fix some uninitialized values 2017-01-29 23:37:42 +00:00
Maxime Coste
cb395d39f8 Use iswlower instead of islower
islower can crash with big codepoints, and is incorrect anyway.
2017-01-29 23:37:10 +00:00
Maxime Coste
565d835d57 Fix option name in haskell.kak 2017-01-29 16:10:48 +00:00
Maxime Coste
0051a4f896 Remove unneeded assignment to null in RefPtr::release 2017-01-29 14:26:41 +00:00
Maxime Coste
2052b225d9 Detect too deep command call stack
Fixes #1163
2017-01-29 13:56:05 +00:00
Maxime Coste
753f3a50d1 Make StringView and unit types trivial types 2017-01-29 13:49:45 +00:00
Maxime Coste
0cb192921a Remove unused WindowAndSelections timestamp field
The SelectionList already has a timestamp.
2017-01-29 12:50:16 +00:00
Maxime Coste
2b6fc6beb7 Remove unused Diff::posA field 2017-01-29 12:49:52 +00:00
Maxime Coste
68b92b9ac1 Make BufferIterator only a bidirectional iterator
Distance computation is too expensive on BufferIterators to
treat them as random access.
2017-01-28 13:06:03 +00:00
Maxime Coste
072064407a Remove hash from StringData
Maintaining the hash value of strings is not worth it as we only
use it for buffer reload, but pay for it on any buffer modifications.
2017-01-28 13:04:55 +00:00
Maxime Coste
125c8b7e80 Fix fifo reading not handling potential errors from the read call
Fixes #1153
2017-01-25 13:55:20 +00:00
Maxime Coste
aa7241067e Only restore cursor position after an append if we still have cursor > anchor
Fixes #1158
2017-01-25 13:36:06 +00:00
Maxime Coste
ebcfba12f6 Add a RawKey hook for raw user input hooking
Fixes #1132
2017-01-24 23:57:36 +00:00
Maxime Coste
8a62ec12af Fix shell context capture that was accessing dead parameters
Fixes #1156
2017-01-24 20:20:50 +00:00
Maxime Coste
bbbb513990 Fix crash when clearing a regex prompt with multiple selections
Fixes #1124
2017-01-24 19:18:29 +00:00
Maxime Coste
7ba24c043a Add gi to go to first non-blank character on line
Fixes #407
2017-01-22 23:53:08 +00:00
Maxime Coste
66e422e397 Fix client destruction when there is an InsertMode mode still alive 2017-01-22 12:19:23 +00:00
Maxime Coste
e8ee8c23d8 Support the +line syntax for clients as well.
Fix a crash on daemon quit as well.
2017-01-21 12:17:49 +00:00
Maxime Coste
c6a7924b80 Fix SafeCountable callstack tracking 2017-01-21 12:10:24 +00:00
Maxime Coste
6f4515f005 Only touch new clients selections when target coord are explicit
Do not implicitely change new clients selections to target coordinates
when the user did not specify them, so that we can re-use the selections
from the found free window, which is the generally desired behaviour.
2017-01-19 18:44:26 +00:00
Maxime Coste
7316afd17b Use ints instead of unsigned for capture count 2017-01-16 18:49:27 +00:00
Maxime Coste
c24a636cb9 Fix regex search/select not restoring initial selections on abort
And incrementally set the search register for select/split as well
2017-01-16 13:57:14 +00:00
Frank LENORMAND
0b22938bce Remove the option that excludes the -pedantic flag from CXXFLAGS
Allowing compilation without the `-pedantic` flag was a temporary trick
to work around a bug involving `libstdc++` and `musl`. A fix has been
pushed for the issue in the appropriate repositories, we no longer need
the optional non-pedantic compilation option.
2017-01-14 11:55:20 +03:00
Maxime Coste
e7e72747ed Update ranges highlighter options according to buffer changes 2017-01-13 13:52:55 +00:00
Maxime Coste
ffc362cf9e Propagate ShellContext custom env-vars through custom commands
Fixes #1131
2017-01-13 00:26:43 +00:00
Maxime Coste
4916ea1766 Fix capture group handling
Fixes #1129
2017-01-13 00:17:31 +00:00
Maxime Coste
8c55acb076 Detect empty selection lists when restoring selections from registers
Fixes #1123
2017-01-11 13:43:41 +00:00
Maxime Coste
343df600cb Merge remote-tracking branch 'alexherbo2/command-names' 2017-01-10 13:44:11 +00:00
Maxime Coste
fb773367e7 Merge remote-tracking branch 'Delapouite/pipe-register' 2017-01-10 13:35:44 +00:00
Maxime Coste
37fbe6c6eb Treat <c-h> as backspace in ncurses ui
Fixes #1030
2017-01-10 13:35:10 +00:00
Delapouite
f51d03b0d8 Fix: add missing pipe register in info 2017-01-10 12:34:37 +01:00
Maxime Coste
9f0bca53c4 Small code cleanups 2017-01-08 23:26:15 +00:00
Maxime Coste
dcd8f6ef01 Apply clang-tidy modernize to the codebase 2017-01-08 22:39:01 +00:00
Maxime Coste
f9f11aa762 Make the currently sourced file path available through $kak_source
The :source command sets an 'source' value to the real path of the
file getting sourced while its commands are executed.

Fixes #1112
2017-01-06 19:46:47 +00:00
Maxime Coste
3123dbf4c2 Merge branch 'master' of git://github.com/hoop33/kakoune 2017-01-05 14:36:55 +00:00
Rob Warner
48d5e5b5a9 Use PREFIX to locate ncurses and boost on macOS 2017-01-05 09:30:58 -05:00
Maxime Coste
d991420140 Higher level implementation of attributes to json formatting 2017-01-04 23:19:18 +00:00
Rob Warner
a680d419e7 Allow non-standard homebrew location for boost and ncurses linking 2017-01-04 15:38:37 -05:00
Alex Leferry 2
671b50bb52 update command names 2017-01-04 13:04:27 +01:00
Maxime Coste
b3674a2f03 Add Modal InfoStyle used for bufer reload info box
Modal info style wont be replaced by other info boxes.
NCursesUI will center that info box.

Fixes #1060
2017-01-04 11:39:51 +00:00
Maxime Coste
1b9f363225 Fix bug relying on undefined arg evaluation order. 2017-01-03 23:17:08 +00:00
Maxime Coste
4295736c97 Fix handling of main selection when copying selection to next/previous lines
Fixes #1095
2017-01-03 18:41:45 +00:00
Maxime Coste
fc4dc93209 Merge remote-tracking branch 'casimir/makefile-osx' 2017-01-02 11:13:24 +00:00
Maxime Coste
20c47b8d61 better support for plain pointer iterators in containers.hh
use std::iterator_traits<T>::value_type instead of T::value_type
that will fail when T is not of class type.
2017-01-02 05:13:58 +00:00
Maxime Coste
ac1192f58a Ensure <esc> cancels in replace with char
After recent changes that associated <esc> with the 0x1b codepoint
r<esc> would replace each char with 0x1b instead of canceling the
replace command.
2017-01-02 04:03:02 +00:00
Maxime Coste
3c1f606a22 Move some template code out of selectors.hh into selectors.cc 2017-01-01 19:30:02 +00:00
Maxime Coste
cd89531bd9 Better handling of linewise inserting when we have multiple selections per line
Fixes #1053
2017-01-01 18:08:43 +00:00
Maxime Coste
cdb2c766a5 Refactor SelectionList::insert a bit 2017-01-01 17:31:47 +00:00
Maxime Coste
69789d4793 When inserting at the end, store the next line as end pos in the change 2017-01-01 16:32:04 +00:00
Maxime Coste
e42881fa38 Fix remaining uses of hardcoded /tmp to get the socket paths
Fixes #1097
2017-01-01 13:10:08 +00:00
Maxime Coste
968e573d80 Slight code refactor for paste handling 2017-01-01 12:58:04 +00:00
Martin Chaine
7b60ae0b5a use explicit flags for homebrew's boost on osx 2016-12-30 19:32:18 +01:00
Maxime Coste
76c58aa022 Dont use constexpr to fix OSX compilation 2016-12-30 13:29:57 +00:00
Maxime Coste
190a04d6c8 Add a ncurses_change_colors option that can disable color palette change
Closes #1057
2016-12-30 07:01:13 +00:00
Maxime Coste
ea6994dd3b Use a struct WorstMatch instead of varargs for the fallback option_add
varargs cannot handle non pod types.
2016-12-30 06:43:32 +00:00
Maxime Coste
4f98677642 Use 'not empty' in place of 'length > 0' 2016-12-27 22:01:11 +00:00
Maxime Coste
84c2ca1cdc Merge remote-tracking branch 'leira/empty_param_crash' 2016-12-27 22:00:32 +00:00
Maxime Coste
923665fab4 Merge remote-tracking branch 'kballard/readonly_warning_msg' 2016-12-27 21:54:26 +00:00
Maxime Coste
243bcf6a6d Support set -add on flag types
Fixes #1082
2016-12-27 21:52:53 +00:00
Kevin Ballard
b0c2444466 Change the message when entering insert mode while readonly 2016-12-27 12:23:15 -08:00
Maxime Coste
6beb9b6f02 Fix unmap 4th argument not being optional
Fixes #1078
2016-12-27 06:49:35 +00:00
Maxime Coste
fcd99d9c22 Use absolute distance for relative line numbering
Closes #1068
2016-12-26 22:10:25 +00:00
Leira Hua
f79018cffd Added string length check when checking switch params
Fixes #1051
2016-12-24 17:42:31 -08:00
Maxime Coste
25451ac112 Set the register incrementally as well during incremental search
Fixes #1054
2016-12-23 20:46:50 +00:00
Maxime Coste
33eb93b619 Skip debug buffer when cycling through the buffer list
Fixes #1059
2016-12-23 16:37:54 +00:00
Maxime Coste
d17bed9b80 Display the command prompt in error face when the command is not found
Fixes #1021
2016-12-23 16:23:31 +00:00
Maxime Coste
62df6dbb46 Display a message when entering insert mode while readonly
Fixes #1050
2016-12-21 06:39:58 +00:00
Maxime Coste
3a6167ae62 Merge branch 'master' of git://github.com/akkartik/kakoune 2016-12-20 20:15:54 +00:00
Maxime Coste
0daf7af493 Fix getting path confstr, the returned size includes the zero terminator
Closes #1047
2016-12-20 20:14:35 +00:00
Kartik K. Agaram
0a21426d58 Remain silent on exit without error. 2016-12-20 10:11:13 -08:00
Maxime Coste
c2305e03b3 Small formatting tweak 2016-12-20 12:57:48 +00:00
Maxime Coste
fdb2d83ea1 Ensure we have an EOL after error messages 2016-12-20 12:49:05 +00:00
Maxime Coste
b7a0aa7546 Ensure we return 0 on exit from graceful disconnection
Fixes #1042
2016-12-20 10:34:48 +00:00
Maxime Coste
4b696836d1 Fix hardcoded uses of "/tmp"
Closes #1032
2016-12-20 04:04:47 +00:00
Maxime Coste
cf10f3f0a0 Fix join, we dont have a StringView from char array constructor 2016-12-17 06:06:07 +00:00
Maxime Coste
2bdd361948 Escape the backslash chars as well when joining strings
Fixes #1014
2016-12-17 05:48:42 +00:00
Maxime Coste
dc84cdd538 Add more diagnostic information when failing to bind/listen to socket 2016-12-17 05:46:04 +00:00
Maxime Coste
28ddb3cb1f Ignore eventual / suffix in TMPDIR 2016-12-17 05:25:43 +00:00
Maxime Coste
831887cd3a Improve general security of the unix sockets
* Use the stricky bit on the shared kakoune folder
* Do not allow read/write access to user folder
* Respect $TMPDIR when set

Fixes #1007
2016-12-15 23:47:34 +00:00
Maxime Coste
9a879262a2 Use a POSIX guaranteed way of getting the shell path 2016-12-15 23:04:53 +00:00
Maxime Coste
4fd12164dd Merge remote-tracking branch 'Delapouite/prompt' 2016-12-15 13:50:12 +00:00
Delapouite
99f38c99ec Fix :prompt command description 2016-12-15 14:42:46 +01:00
Maxime Coste
71cc9f1011 Fix reentrancy in InputeModes::Normal::on_key 2016-12-15 09:46:10 +00:00
Maxime Coste
9ad1c19f69 Validate user text object desc more thorougly
Fixes #992
Fixes #993
Fixes #994
2016-12-15 09:29:38 +00:00
Maxime Coste
430ff37bd6 Fix regex.hh compilation
Repeat after me: I will not blindly push commits that I havent
compiled.

Fixes #990
2016-12-14 23:50:29 +00:00
Maxime Coste
fd82d3e258 Make Regex a class rather than a struct to avoid mismatched tags warnings 2016-12-14 20:59:39 +00:00
Maxime Coste
377046e315 Handle correctly cases where codepoint_width returns -1
Fixes #972
2016-12-14 13:53:30 +00:00
Maxime Coste
dfb030da6e Make container wrapper callback functions mutable
It seems at least std::mem_fn callable wrapper type call operator
is not guaranteed to be const, so we need to be able to call on
a non const object. This should do for now.

Fixes #978
2016-12-14 13:25:55 +00:00
Maxime Coste
85a534fb8a Support inserting esc characters through <c-v>
As requested in #960
2016-12-14 00:34:53 +00:00
Maxime Coste
735b1e1dc5 Add support for readline like <c-k> and <c-u> in prompts 2016-12-14 00:28:46 +00:00
Maxime Coste
e44129577a Fix one definition rule violation in ncurses_ui.hh
The memory domain of Vector<DisplayBuffer> was different depending
on if display_buffer.hh has been included or not.
2016-12-10 13:43:41 +00:00
Maxime Coste
5d9f3b7f3f Ensure the line is correctly clamped in scroll_window
Seems like the previous implementation was not always doing that
correctly, so just use an obviously correct method.

Fixes #951
2016-12-10 13:33:42 +00:00
Maxime Coste
03eb128536 Ensure content of expanded strings in modelinefmt is not interpreted as markup 2016-12-07 20:07:32 +00:00
Maxime Coste
bc8b30c988 Replace some string concatenations with a format call 2016-12-07 13:57:16 +00:00
Maxime Coste
1383614a5f Fix markup parsing handling of antislash escapes
Antislashes did not need to immediately precede a face spec to
escape it, it could be in any characters before it.
2016-12-07 13:43:27 +00:00
Maxime Coste
2f704eab16 Small command parsing refactoring 2016-12-07 13:26:11 +00:00
Maxime Coste
d9679db9b6 Fix scrolling generating invalid buffer coordinates 2016-12-07 00:08:41 +00:00
Maxime Coste
a320dcec28 Small formating fix 2016-12-06 23:08:18 +00:00
Maxime Coste
e9349cdc92 Ensure timers are still alive when trying to run them 2016-12-06 13:55:53 +00:00
Maxime Coste
b3ac733f33 Fix buffer reload info box not being shown anymore 2016-12-05 23:40:23 +00:00
Maxime Coste
9a986b8d47 Hide eventual info box when returning to normal mode 2016-12-04 23:27:04 +00:00
Maxime Coste
4d538fb423 Only hide menu/info if the insert completer did display it
Avoid hiding info boxes opened by other places in the code.
2016-12-04 13:37:33 +00:00
Maxime Coste
e2fae522e5 Small include fix 2016-12-03 13:18:11 +00:00
Maxime Coste
bc8c5522e2 Change ValueId to just be an enum class, it does not need any operators 2016-12-03 13:17:42 +00:00
Maxime Coste
8a74ef9804 Read as much as possible data from shell processes on each read event
We were reading at most 1024 bytes every time, going back to the event
loop.
2016-12-03 12:41:36 +00:00
Maxime Coste
75986911f8 Refactor RefPtr handling to use a policy class
THe previous overload based system was pretty complex for no good
reason.
2016-12-03 12:32:16 +00:00
Maxime Coste
5ff8245cc8 Display non breaking spaces with ⍽ in show_whitespaces hihglighter
Fixes #167
2016-12-02 13:59:34 +00:00
Maxime Coste
089ee8ac0a Fix crash when quitting the first client while another client is connected 2016-12-01 20:55:28 +00:00
Maxime Coste
a65e8142f3 Rework handling of initial coordinates so that init commands can change them
Fixes #944
2016-12-01 20:55:20 +00:00
Maxime Coste
8c862c4eea Only write to remote socket when we know they are writable
Buffer data (in an horribly innefficient way for now), and use the
event manager to watch for the socket being ready for a write.

Fixes #945
2016-12-01 20:11:09 +00:00
Maxime Coste
95c1528342 Fix crash when a client sends a packet advertising a wrong size
If the given size is less than the header size, the message is
clearly invalid, disconnect the client in that case.
2016-12-01 19:45:23 +00:00
Maxime Coste
7defdd3039 Make FDWatcher support Read, Write and Except events, instead of just Read 2016-12-01 19:44:07 +00:00
Maxime Coste
99a3388e41 Hide the waiting for shell message once the shell returns 2016-11-30 13:46:20 +00:00
Maxime Coste
61b3dfd184 Use a Timer for Shell waiting notification
Without a timer we were relying on other event sources to wake us
up to display the information, which was usually a NormalIdle or
a filesystem check timer.
2016-11-30 09:55:05 +00:00
Maxime Coste
540e504e68 Ensure all available input is handled before going back to main loop
We were not handling keys that could have been generated while handling
other keys (like during a shell evaluation).
2016-11-30 09:47:38 +00:00
Maxime Coste
3a81260917 Simplify greatly UI input handling
This round trip through an input callback expected to call
is_key_available and get_key was overcomplicated, just send the
keys as they arrive, the client is already buffering due to urgent
event mode.
2016-11-29 21:59:36 +00:00
Maxime Coste
2fd1414b05 Clean up includes of user_interface.hh 2016-11-29 19:53:11 +00:00
Maxime Coste
0dff8a7d3f Small remote code cleanup 2016-11-29 19:52:57 +00:00
Maxime Coste
db86c6cbc9 Small cleanup in BufferManager code 2016-11-29 19:12:10 +00:00
Maxime Coste
12856066b1 Cleanup include dependencies a bit 2016-11-28 23:58:08 +00:00
Maxime Coste
da6d7f4530 Always consider end of selection is not and eol for keep
Fixes #921
2016-11-28 21:07:24 +00:00
Maxime Coste
719eb16a5e Fix matching flags not being forwarded to regex_search
Still does not fully fix #921
2016-11-28 20:02:40 +00:00
Maxime Coste
2f3a7112ea Add more memory domains to certain data 2016-11-28 13:59:55 +00:00
Maxime Coste
54d540021c Add support for mouse in insert mode
Fixes #940
2016-11-28 13:15:12 +00:00
Maxime Coste
a4738ace5f :prompt and :onkey (renamed :on-key) now use values instead of registers
:prompt provides the entered text in the `text` value, :on-key provides
the entered key in the `key` value.

Closes #938
2016-11-27 20:57:04 +00:00
Maxime Coste
b337f99ca7 Add a 'keys' debug flag, showing the keystrokes comming to clients 2016-11-26 13:29:17 +00:00
Maxime Coste
e340e0ed39 Forward client name to contexts created for write-all
Fixes #937
2016-11-24 13:35:42 +00:00