Maxime Coste
ec3d7c3104
Add support for removing from options
...
`set -remove ...` will remove from the current option value, substracting
from int, removing elements from vectors and maps.
2020-09-09 21:00:30 +10:00
Maxime Coste
f75d49e9ef
Do not include non-primitive option value in *SetOption hook filter
...
Only include the value for int/str/bool options, for the rest just
write '<option name>=...'.
This should reduce the cost of some patterns such as repeatedly adding
a value inside a list option.
It seems very unlikely that the actual value would be matched by
a hook regex string for non primitive types.
2020-06-09 21:38:47 +10:00
Maxime Coste
346c78f5e0
Header and dependency cleanup
2019-01-24 21:22:20 +11:00
Maxime Coste
ae69759a53
Defer deletion of unsetted option to return to main loop
...
Fixes #2572
2019-01-20 22:46:40 +11:00
Maxime Coste
16908bf091
Fix hooks triggering on unset-option even if parent has same value
2018-11-28 21:45:40 +11:00
Maxime Coste
68aba9e353
Use shell specific quoting for env vars
...
Add a test case to validate roundtrips between Kakoune and the
shell.
2018-08-29 07:53:59 +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
b5693c6253
Refactor option_from_string to return directly the option value
2018-05-27 13:00:50 +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
327d8ad759
Mark Client, Window, Buffer and OptionManager as final
...
Avoids warning about non virtual destructor calls on them,
as they have a vtable due to OptionManagerWatcher.
2018-05-09 23:01:40 +10:00
Maxime Coste
435b5b7ff9
Unify code that validates identifiers in Kakoune
...
Session/Client/User modes names are now requiered to be "identifiers"
they must be in [a-zA-Z0-9_-]. Option names are the same except they
do not allow '-' as they need to be made available through the env vars
and '-' is not supported there.
Fixes #1946
2018-03-25 16:35:33 +11:00
Maxime Coste
a480e566dc
ranges: Add transform overload taking directly a pointer to member
...
This overload will forward to the general transform implementation
using std::mem_fn to generate a callable.
2018-03-13 14:24:03 +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
6ada6e6d77
Move all non-core string code to string_utils.{hh,cc}
2017-10-10 10:52:32 +08:00
Maxime Coste
ab6a999431
Rename containers.hh to ranges.hh (and Container to Range)
2017-08-29 15:23:03 +07:00
Maxime Coste
7a79cbbc81
Migrate code to c++14
2017-07-19 08:47:14 +02: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
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
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
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
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
89fa6d4fbf
Small code simplification
2017-03-07 16:11:40 +00:00
Maxime Coste
dcd8f6ef01
Apply clang-tidy modernize to the codebase
2017-01-08 22:39:01 +00:00
Maxime Coste
1b9eb2c6ba
Validate option names to be in [a-zA-Z0-9_]
...
Closes #824
2016-09-27 09:54:55 +01:00
Maxime Coste
a0c20a924a
OptionDescs are const in OptionRegistry
2016-09-26 22:59:02 +01:00
Maxime Coste
0de4fc75d0
Dont consider OptionManager watcher list as part of the state of the option manager
2016-08-21 20:24:18 +01:00
Maxime Coste
ac0c746072
Tweak format of option docstrings
2016-08-07 10:47:26 +01:00
Maxime Coste
f73e89a716
Add information of types of options
2016-08-06 09:05:50 +01:00
Maxime Coste
f1a93a0e61
Replace some const String& with StringView in option_manager.hh
2016-08-06 06:52:11 +01:00
Maxime Coste
3a699c8ac3
Include tweak
2016-03-14 13:41:20 +00:00
Maxime Coste
986c91a835
Support validating some options values before setting them
...
Fixes #583
2016-02-11 22:07:18 +00:00
Maxime Coste
4cb74623bb
Store the buffer timestamp in line flags options respect it for highlighting
...
Option content is auto updated to match current buffer, so that line flags
are updated according to buffer modifications.
2015-12-12 11:45:45 +00:00
Maxime Coste
70250fc1e3
Pass directly the StringView to option_add and let it do the option parsing
2015-12-12 11:26:34 +00:00
Maxime Coste
94ec1cdde7
Add an unset command to remove an option value (falling back to parent)
...
unset is not applicable to global scope.
2015-08-10 13:54:52 +01:00
Maxime Coste
10d8cf64cf
Move option docstring obtention to OptionRegistry
2015-08-10 13:53:30 +01:00
Maxime Coste
bfb116b8b4
Move option name completion to the OptionRegistry
...
Option names are the same for every option manager.
2015-08-10 13:38:06 +01:00
Maxime Coste
ea02467564
Disable notifications when disabling an option temporarly
2015-07-23 23:42:48 +01:00
Maxime Coste
8f6fc6a0f3
Port even more code to use format function
2015-06-01 21:15:59 +01:00
Maxime Coste
720c54c759
Move option_not_found exception to the cpp file
2015-04-26 20:40:32 +01:00
Maxime Coste
0bdf1778cb
Some more memory tracking
2015-01-12 13:32:14 +00:00
Maxime Coste
b6ff15aa75
Unify completion from container content logic
2014-12-23 13:54:09 +00:00
Maxime Coste
064fb81b8d
Move containers utils to containers.hh and add filtered/transformed utils
2014-12-23 13:40:26 +00:00
Maxime Coste
f32ab5793e
Remove unneeded includes
2014-12-11 13:10:41 +00:00
Maxime Coste
b43f0fb853
Yet more StringView params, less const String&
2014-11-16 20:55:36 +00:00
Maxime Coste
ece03c3599
More const String& to StringView
2014-11-15 18:45:56 +00:00
Maxime Coste
abfc016321
Remove AutoRegister util template
2014-11-02 16:04:24 +00:00
Maxime Coste
e38ba6ce3d
Add scope class and encapsulate Options, Keymaps, Aliases and Hooks in it
2014-10-30 14:04:57 +00:00
Maxime Coste
3e797a3d15
centralize bit operation support for enum used as flags
2014-10-23 19:02:39 +01:00