Commit Graph

4240 Commits

Author SHA1 Message Date
Maxime Coste
af21d4ca1e regex: track CompiledRegex::StartDesc in the Regex memory domain 2018-02-24 16:29:24 +11: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