Maxime Coste
cde0c51cd6
Tweak comment to make it less ambiguous
2018-07-08 16:58:19 +10:00
Maxime Coste
b6933a2bdb
Fix infinite loop on SIGHUP with the NCursesUI
...
Fixes #2126
2018-07-08 15:54:01 +10:00
Maxime Coste
f89ea657ef
Fix asserts with -sync flag handling and slight code cleanup
2018-07-05 08:30:57 +10:00
Maxime Coste
63d4c8c311
Change a
on end of line behaviour to be consistent
...
`a` will just jump on next line, `a` on last end of line opens a new
line beneath it.
Fixes #1164
2018-07-05 08:00:14 +10:00
Maxime Coste
55a5ec3bbd
Tweak how highlighter names are auto-generated
2018-07-05 07:54:28 +10:00
Maxime Coste
2e0e206951
Make recurse regex opt-in with a -recurse switch instead of opt-out
2018-07-05 07:54:28 +10:00
Maxime Coste
f9fda70de6
Fix add-highlighter docstring
2018-07-05 07:54:28 +10:00
Maxime Coste
63d7984b89
Fix bug in recursive region highlighting
2018-07-05 07:54:28 +10:00
Maxime Coste
6993b0f347
Fix region highlighters validation that the delegate type exists
2018-07-05 07:54:28 +10:00
Maxime Coste
96c9718144
Parse unknown switches as positional for region highlighters
2018-07-05 07:54:28 +10:00
Maxime Coste
073b630e7a
Prevent adding region/default-region highlighters to non-regions parents
2018-07-05 07:54:28 +10:00
Maxime Coste
711150f4ac
Allow removing region from regions highlighter
2018-07-05 07:54:28 +10:00
Maxime Coste
1574748d4e
Invalidate cache when RegionsHighlighter subregions are modified
2018-07-05 07:54:28 +10:00
Maxime Coste
64d0fd91ae
Auto-generate highlighter name if only path is given
2018-07-05 07:54:28 +10:00
Maxime Coste
b0ccf97b44
Refactor RegionsHighlighters to define each region as a separate command
2018-07-05 07:54:28 +10:00
Maxime Coste
c9cdae4364
Add HashMap::items to access item list
2018-07-05 07:54:28 +10:00
Maxime Coste
d6b0297ac8
Fix ParameterParser::position_from with arbitrary indices
2018-07-05 07:54:28 +10:00
Maxime Coste
b4b335155e
Refactor add-highlighter to make naming explicit
...
The highlighter name must be given as part of the path of the
highlighter, as the last element.
Fixes #1712
2018-07-05 07:54:28 +10:00
Maxime Coste
18dfecfa9d
Introduce a "double_up" function for doubling up escaping
2018-07-05 07:54:28 +10:00
Maxime Coste
6a31d0ebc7
Fix auto escaping of command argument completion
2018-07-05 07:54:28 +10:00
Maxime Coste
7abf04babd
Improve highlighting of Kakrc string regions
...
Unfortunately Strings that start with a quoted quote (like '''str')
are still incorrectly highlighted, a deeper refactoring of the regions
highlighter will be necessary.
2018-07-05 07:54:28 +10:00
Maxime Coste
eab98c88bd
Refactor handling of startup info to make it configurable
...
A new `status_info_version` option allows user to disable info
message regarding changes that happened at that version or
earlier.
2018-07-05 07:54:28 +10:00
Maxime Coste
74e4925de0
Expand %reg{} inside double quotes only to the main selection value
2018-07-05 07:54:28 +10:00
Maxime Coste
124a5d4905
Tolerate restoring invalid coordinates from register
...
Clamp those selection after updating them to the current timestamp
Fixes #2078
2018-07-05 07:54:28 +10:00
Maxime Coste
ed123a2cc9
Reference the big breaking refactoring in the startup message
2018-07-05 07:54:28 +10:00
Maxime Coste
27163106c7
Make register expansions expand to the full register content
...
Now that we have a nice standard way to express lists of strings,
registers can be fully exposed. An new $kak_main_reg_... env var
was added to provide the previous behaviour which is relied on by
doc.kak.
2018-07-05 07:54:28 +10:00
Maxime Coste
d6c6ed9bbf
Store each selection as a separate element in a register
...
It makes more sense to use the list nature of the register to store
the selections instead of storing them as a single string separated
by spaces.
2018-07-05 07:54:28 +10:00
Maxime Coste
8aba0b3cb4
Change set-register command to take a list of values
...
Registers are lists of strings, so this make it possible to set
the whole list instead of forcing registers to a single element
when going through the set-register command.
2018-07-05 07:54:28 +10:00
Maxime Coste
183f32803b
Fix selection save/restore from registers post selection list syntax change
2018-07-05 07:54:28 +10:00
Maxime Coste
087a940fbe
Add 'skip(size_t)' range utility to skip a number of elements
2018-07-05 07:54:28 +10:00
Maxime Coste
76093f252c
Change env vars that are lists to use the general list syntax
2018-07-05 07:54:28 +10:00
Maxime Coste
8b2e5ea862
Make selection lists use the option list syntax
2018-07-05 07:54:28 +10:00
Maxime Coste
b548dd3a6f
Change option lists to be specified as separate arguments on commands line
...
Option lists and maps are specified using separate arguments, avoiding
the need for additional escaping of their separator and reusing the
existing command line spliting logic instead.
As discussed on #2087 , this should make it much easier to work with
list options, and make the general option system feel cleaner.
2018-07-05 07:54:28 +10:00
Maxime Coste
5eeec8bd4d
Make expansion of strings support quoting of % by doubling up
2018-07-05 07:54:28 +10:00
Maxime Coste
c829595d01
Refactor command line parsing
...
Command line parsing now works as follow:
* Quoted strings ('...', "..." and %~...~ with '~' non nestable)
use 'doubling-up' for escaping their delimiter, if the delimiter
appears twice in a row, it is considered as part of the string and
represent one delimiter character. So 'abc''def' == "abc'def". No
other escaping takes place in those strings.
* Balanced strings (%{...}) do not support any kind of escaping, but
finds the matching closing delimiter by taking nesting into account.
So %{abc{def}} == "abc{def}".
* Non quoted words support escaping of `;` and whitespaces with `\`,
`%`, `'` and '"` can be escaped with `\` at the start of the word,
they do not need escaping (and will not be escaped) else where in
a word where they are treated literally. Any other use of '\' is a
literal '\'. So \%abc%\;\ def == "%abc%; def"
As discussed in #2046 this should make our command line syntax more
robust, provide a simple programmatic way to escape a string content
(s/<delim>/<delim><delim>/g), be well defined instead of ad-hoc
undocumented behaviour, and interact nicely with other common
escaping by avoiding escaping hell (:grep <regex> can in most case
be written with the regex unquoted).
2018-07-05 07:54:28 +10:00
Maxime Coste
24d8a58b0d
Add -with-hooks to execute-keys and make -no-hooks evaluate-commands specific
2018-07-05 07:54:28 +10:00
Maxime Coste
9082564ab7
Make -with-maps only available for execute-keys command
...
It does not make a lot of sense to have this switch for
evaluate-commands.
2018-07-05 07:54:28 +10:00
Maxime Coste
5902c7b790
Do not save any registers by default in evaluate-commands
2018-07-05 07:54:28 +10:00
Maxime Coste
ec16969609
Do not reparse %sh{...} strings
...
Automatic reparsing of %sh{...}, while convenient in many cases,
can be surprising as well, and can lead to security problems:
'echo %sh{ printf "foo\necho bar" }' runs 'echo foo', then 'echo bar'.
we make this danger explicit, and we fix the 'nop %sh{...}' pattern.
To reparse %sh{...} strings, they can be passed to evaluate-commands,
which has been fixed to work in every cases where %sh{...} reparsing
was used..
2018-07-05 07:54:28 +10:00
Maxime Coste
3b9818c10b
Merge remote-tracking branch 'lenormf/edit-readonly-flag'
2018-07-04 19:47:05 +10:00
Maxime Coste
86616c207d
Merge remote-tracking branch 'lenormf/synchronized-write'
2018-07-04 19:46:40 +10:00
Frank LENORMAND
5309b7b5e5
src: Add a -sync
flag to the write commands
2018-07-04 09:49:53 +03:00
Frank LENORMAND
dd17b20bbf
src: Allow the edit
command to create readonly buffers
2018-07-03 14:34:48 +03:00
dahlbaek
2a509ba73f
Mark unused variables with the [[gnu::unused]] attribute
2018-07-02 19:33:52 +02:00
Frank LENORMAND
266ce73de7
src: Make C
skip empty lines
...
This commits changes the way `C` behaves when the next line is empty:
instead of stopping the selection, it will now jump to the next line
that can hold a selection as big as the current one.
The primitive's count parameter holds the maximum amount of selections
that should be added to the current one.
Closes #2061
2018-06-30 14:39:15 +03:00
Frank LENORMAND
1cb51cacb7
src: Fix cycle hogging when using C
at EOF
2018-06-30 11:53:28 +03:00
Maxime Coste
43b72770ec
Fix wrong logic for moving filedescriptors leading to closed stdin
...
With this fix, tests can now use /dev/null as stdin.
Fixes #2165
2018-06-28 22:56:50 +10:00
Olivier Perret
67655de947
Use a dedicated vm op for dot when match-newline is false
2018-06-24 12:41:50 +02:00
Olivier Perret
b5ee1db1c4
Use bit-flags for storing regex regex options
2018-06-24 12:41:50 +02:00
Olivier Perret
8edef8b3f1
Add support for regex flag to toggle dot-matches-newline
2018-06-24 12:41:50 +02:00
Maxime Coste
667777521b
Refactor the way main selection is determined after rotating contents
...
Fixes #2133
2018-06-21 08:07:17 +10:00
dahlbaek
52a3e9a84d
Pass in OpenBSD binary path using preprocessor option
...
Alternative to hard coding binary path for OpenBSD
2018-06-20 14:20:55 +02:00
Patrick Marchand
dc3e4823a5
Remove extraneous include for openbsd
...
Forgot to remove this before pushing.
2018-06-20 14:20:55 +02:00
Patrick Marchand
2789857f32
Adds openbsd support
...
Seems to work on openbsd 6.3-current but needs more testing. Had to
hardcode the binary path as openbsd considers getting the executable
path at runtime a security flaw.
2018-06-20 14:20:55 +02:00
Maxime Coste
3d4ee7d201
Tweak search style menu completion display
2018-06-20 20:20:11 +10:00
Maxime Coste
b82d31016b
Do not draw menu if it would hide prompt content
2018-06-20 08:12:53 +10:00
Maxime Coste
226db75aeb
Change Search completion to display on top of the modeline
2018-06-19 21:02:24 +10:00
Maxime Coste
6dca67c674
Fix two <s-tab> requiered to access last completion in prompt
...
A single <s-tab> should be enough.
2018-06-19 07:40:52 +10:00
Delapouite
0bfdaf7d3e
Improve unmap command key-completer
2018-06-15 15:16:08 +02:00
Maxime Coste
665d3fa196
Fix edit -fifo without -scroll when the buffer is already opened
...
Scrolling was taking place in that case even though it was not
desired.
2018-06-13 07:11:03 +10:00
Maxime Coste
ee19497d37
Fix crash when adapting window position post buffer modifications
2018-06-13 05:00:35 +10:00
Maxime Coste
0bdde991ea
Remove unneeded Window::m_range post refactoring
2018-06-12 06:48:48 +10:00
Maxime Coste
0d3a1b5955
Try to keep window position fixed when buffer gets modified
...
Adapt window position to the changes that happened in the buffer
since last redraw.
Fixes #1989
2018-06-11 15:10:30 +10:00
Maxime Coste
df90ba5984
Extract update_ranges_ifn as a general utility function
2018-06-11 15:10:30 +10:00
Maxime Coste
539832bf29
Add position offset to Window to limit moves with search menu style
...
Window can be resized with an "offset_pos" flag, which means that
the resize took place on the top left corner of the window, leading
to a change in current window position. This is treated as temporary
and the position change is stored in a m_position_offset field.
That allows the ncurses UI to offset the position when it displays
a Search menu, so that the window does not constantly scroll when
the search menu open/closes. The window will only scroll if it needs
to in order to keep the main selectin visible.
2018-06-11 15:10:30 +10:00
Maxime Coste
60cf71bc24
Pass DisplaySetup through the HighlightContext
2018-06-11 15:10:30 +10:00
Maxime Coste
97af2ffc84
Merge remote-tracking branch 'alyssais/patch-2'
2018-06-03 12:19:09 +10:00
Maxime Coste
310e5e3bcd
NCursesUI: Use only 3 line menu for MenuStyle::Search
2018-06-03 12:17:38 +10:00
Maxime Coste
2bdbf7e379
Add MenuStyle::Search that prevents the menu from hiding buffer text
...
Fixes #2042
2018-06-03 12:17:38 +10:00
Maxime Coste
56e5322b45
EventManager: Never block if a forced file descriptor is present
2018-06-03 12:17:38 +10:00
Maxime Coste
c63502c7c6
Code cleanup and slight refactor in NCursesUI menu code
2018-06-03 12:17:38 +10:00
Alyssa Ross
7685a657ca
Fix grammar in highlight error message
2018-06-01 13:02:38 +02:00
Delapouite
b60ed6ca53
docs: fix missing ]
in wrap hl -marker switch docstring
...
Also add the related changelog entry
2018-05-30 18:11:19 +02:00
Alyssa Ross
2deb2c0294
Fix typos in add-highlighter range help
2018-05-28 13:19:12 +02:00
Maxime Coste
f06badcfd3
Fix clang compilation
2018-05-28 08:26:19 +10:00
Maxime Coste
b5693c6253
Refactor option_from_string to return directly the option value
2018-05-27 13:00:50 +10:00
Maxime Coste
2617f5e022
Add unit test for option parsing
2018-05-27 13:00:48 +10:00
Maxime Coste
f1c1de834a
Add a -marker <marker_text> switch support to the wrap highlighter
...
This makes wrapped lines very explicit.
Fixes #2065
2018-05-26 22:22:00 +10:00
Maxime Coste
68fb3ba88f
Rework fail
command not to display command call stack
...
`fail` triggers "expected" errors, and hence should just display
the provided message.
2018-05-26 21:31:17 +10:00
Maxime Coste
54b62cbef7
Do not expose C++ typeid().name to user facing errors on wrong option type
...
Fixes #2079
2018-05-26 10:01:26 +10:00
Maxime Coste
9b89652b0b
Fix potential assert on itersel selection restoration
...
We cannot guarantee after an itersel that selections are going to
still be in ascending order, but we were calling a SelectionList
constructor that was assuming this was the case.
2018-05-24 08:08:51 +10:00
Maxime Coste
4ef5c80724
Fix Kakoune client busy looping on SIGHUP
...
Pure clients never quitted when they got SIGHUP after recent changes
to add is_ok to UserInterface. run_client now tracks the UI state as
well and quits if the UI gets killed.
2018-05-23 08:16:35 +10:00
Maxime Coste
56e2174cf6
Do not reuse m_buffer_trash to store dying buffers in ~BufferManager
...
Doing that clears m_buffer_trash, deleting buffers contained there,
but we are not ready to have Buffer destructors running yet as we
did not clear the ClientManager, meaning we might have free windows
pointing to buffers in the buffer trash.
2018-05-21 20:30:24 +10:00
Maxime Coste
d4e36958f8
Gather options in a vector when running Buffer::on_option_changed
...
on_option_changed might trigger hooks that will mutate the option
managers, invalidating the iterators we use.
2018-05-21 20:07:25 +10:00
Maxime Coste
919b7ce645
Fix also the implementation of to_string(size_t) change
2018-05-21 20:01:19 +10:00
Maxime Coste
edc53de8cc
Small code cleanup
2018-05-21 07:55:07 +10:00
Maxime Coste
b7dabf11f2
Fix incompatible to_string function declaration when size_t is unsigned int
2018-05-21 07:53:21 +10:00
Maxime Coste
ec0f8fe574
Extend try
command to support multiple catches.
...
If a catch command fails, and another catch is availabe following
it, that following catch gets executed.
2018-05-19 14:15:16 +10:00
Maxime Coste
243cfbc4ae
Fix behaviour of extending to next match when wrapping
...
If the search wraps to get to next match, drop that selection when
extending.
2018-05-19 14:15:16 +10:00
Maxime Coste
14d12fac04
Rename -allow-override switch to -override
...
Closes #2057
2018-05-19 14:15:16 +10:00
Maxime Coste
c9a8658671
Fix assert with window small enough so that no part of buffer is displayed
...
Fixes #2056
2018-05-19 14:15:16 +10:00
Maxime Coste
79b60f69a9
Small code cleanups
2018-05-17 22:55:53 +10:00
Maxime Coste
b22c8ad8c7
Fix potential missed redraws
2018-05-17 22:50:11 +10:00
Maxime Coste
b0577d07f6
Merge remote-tracking branch 'Screwtapello/newlines-after-json-errors'
2018-05-17 07:47:34 +10:00
Maxime Coste
9bd3231d9b
Avoid needless constant allocation in StaticRegister::set
2018-05-17 07:41:32 +10:00
Maxime Coste
4cc9c9997e
compute_line_modifications: avoid potentially long iteration
2018-05-17 07:41:32 +10:00
Maxime Coste
fcce76ba57
Handle all pending events before redrawing
...
If new events happen while handling events, take care of those
new events as well before redrawing.
2018-05-17 07:41:32 +10:00
Tim Allen
0af53fb0dc
Print a newline after errors in the JSON UI.
...
This makes them just a little easier to read.
2018-05-16 23:26:05 +10:00
Maxime Coste
75eb293f98
Rename Context::Flags::Transient to Context::Flags::Draft
...
Draft is well establish and all draft context are transient.
2018-05-14 08:23:00 +10:00
Maxime Coste
b204e773d4
Do not push jumps implicitely in transient contexts
...
This should improve performance in draft contexts.
2018-05-14 08:23:00 +10:00