Commit Graph

270 Commits

Author SHA1 Message Date
Maxime Coste
1af82e2e24 Tweak regex constructor calls 2015-07-25 11:15:03 +01:00
Maxime Coste
2946504a17 Improve column highlighter to cooperate better with other highlighters
Fixes #268
2015-07-23 13:58:23 +01:00
Maxime Coste
17e3be48a5 Transform boost/std regex_error to Kakoune::regex_error at Regex construction
Fixes #318
2015-07-14 21:06:41 +01:00
Maxime Coste
1d1927647a Fix formatting 2015-07-09 13:53:21 +01:00
Maxime Coste
6870895374 Add support for hex formatting 2015-06-22 13:56:00 +01:00
Maxime Coste
2c15dbe6b2 Fix regions highlighter docstring 2015-06-11 19:04:30 +01:00
Maxime Coste
f19bb4fe6d Port more code to use the format function instead of adhoc string concat 2015-06-01 19:06:35 +01:00
Maxime Coste
993e842fdf Retreat ! go back to C++11 only code
This reverts commit b42de85031.
2015-05-26 18:42:09 +01:00
Maxime Coste
7b7427e1a6 Add missing 'override' specifiers 2015-05-25 13:54:18 +01:00
Maxime Coste
b42de85031 Migrate code to c++14 2015-05-25 13:51:17 +01:00
Maxime Coste
0ee95d02c4 line highlighter highlights up to window's end 2015-05-05 20:21:17 +01:00
Maxime Coste
1a1db1cb3a {line,column}_option highlighters use an expanded string instead of an option name
That allows access to non option values, such as cursor_column or cursor_line with
:addhl line '%val{cursor_line}' default,rgb:404040

Fixes #38
2015-05-04 17:12:51 +01:00
Maxime Coste
7f0588c02c Dont use a regex to match face spec for regex highlighter 2015-05-03 18:22:49 +01:00
Maxime Coste
4e89cbfe83 Add a column_option highlighter that highlight a column given in an option 2015-04-30 19:18:20 +01:00
Maxime Coste
5bff742e0a Replace some String temporaries with StringViews 2015-04-27 16:46:57 +01:00
Maxime Coste
bbefde9379 Move Colors enum class as NamedColor enum inside Color struct 2015-04-25 10:47:39 +01:00
Maxime Coste
4e1ed13f25 Use a struct for RangeAndMatches 2015-04-23 21:44:20 +01:00
Maxime Coste
045272ab8a Use a struct for BufferRange rather than std::pair 2015-04-23 21:38:45 +01:00
Maxime Coste
e0f7a6f0be Remove simple_factory for highlighters 2015-04-23 20:27:52 +01:00
Maxime Coste
f714766854 Fix search highlighter wrong code 2015-04-19 15:19:39 +01:00
Maxime Coste
d1b81c8f8a minor cleanup 2015-03-27 13:47:02 +00:00
Maxime Coste
c2150dd163 Rework show_matching highlighter implementation 2015-03-27 13:18:06 +00:00
Maxime Coste
4188335b51 Fix segfault in highlighting 2015-03-23 19:21:35 +00:00
Maxime Coste
f5da1671fd Refactor number_line higlighter, use a switch to higlhight the cursor line 2015-03-19 00:31:11 +00:00
Maxime Coste
006f8ca588 Merge remote-tracking branch 'ekie/relative_line_numbers' 2015-03-19 00:03:59 +00:00
Eike Plack
5627d33ac3 Add support for relative line numbers 2015-03-18 22:07:57 +01:00
Maxime Coste
b5854ece43 Change ParameterParser switch interface, use an Optional<StringView>
Merge has_option and option_value into a single method get_switch.
2015-03-14 19:16:46 +00:00
Maxime Coste
65fd0df041 More code style cleanup 2015-03-14 17:30:44 +00:00
Maxime Coste
3c1a325b6f Refactor String, use a common StringOps interface, hide std::string 2015-03-10 19:50:22 +00:00
Maxime Coste
1cec8df45e ArrayView content is not const anymore
As in upcoming std c++ array_view, ArrayView<T> points to mutable
data, use ArrayView<const T> or alias ConstArrayView<T> for const
data.
2015-03-09 13:54:09 +00:00
Maxime Coste
6c65c5e080 Add docstrings to highlighters, displayed by addhl help 2015-02-19 13:54:03 +00:00
Maxime Coste
fd3365deb1 Remove unused RegionMatch::timestamp 2015-02-17 13:56:26 +00:00
Maxime Coste
59177c12f9 Replace vector of vector in RegexHighlighter with a single vector. 2015-02-17 13:50:31 +00:00
Maxime Coste
2f890f12c6 Fix RegexHighlighter cache invalidation when changing the regex 2015-02-16 22:43:14 +00:00
Maxime Coste
8f6dab08d6 Try to limit the quantity of buffer reparsed by RegexHighlighter 2015-02-16 19:13:55 +00:00
Maxime Coste
ce950ec9f7 Fix RegexHighlighter in a few corner cases 2015-02-16 13:25:17 +00:00
Maxime Coste
53f1c35013 Fix caching of regex highlighter matches
The previous method was constantly invalidating cache when used in
conjunction with region highlighters.
2015-02-15 19:42:48 +00:00
Maxime Coste
2a28260f87 Extend line numbering max width to 15 char 2015-02-03 13:44:42 +00:00
Maxime Coste
b4442055e8 Fix recursive regions matching when a recursive matches just before an end
%sh{ $test {} $test } was incorrrectly closing the %sh block at the first {
because it was immediatly followed by a }.
2015-02-02 13:48:27 +00:00
Maxime Coste
09fc14be4b Small refactor in highlighters.cc 2015-02-01 23:30:58 +00:00
Maxime Coste
4d6b8a70e1 Fix highlighter update with new LineModification behaviour 2015-02-01 23:19:07 +00:00
Maxime Coste
0b4ecef2d2 Rewrite line modifications, hopefully with easier to comprehend code 2015-01-31 23:50:24 +00:00
Maxime Coste
19797ae8d6 Fix flag line highlighting 2015-01-12 19:35:31 +00:00
Maxime Coste
da562e03a0 replace all std::vector with Vector 2015-01-12 13:58:41 +00:00
Maxime Coste
0bdf1778cb Some more memory tracking 2015-01-12 13:32:14 +00:00
Maxime Coste
295a97f2a6 Rename memoryview to ArrayView 2015-01-06 13:43:37 +00:00
Maxime Coste
c698032ace Style tweak 2014-12-31 13:09:35 +00:00
Maxime Coste
b0fef1a962 Rename id_map to IdMap 2014-12-23 22:51:00 +00:00
Maxime Coste
fb611e2f62 Use an id_map directly for HighlighterRegistry rather than the FunctionRegistry class 2014-12-23 22:15:53 +00:00
Maxime Coste
b6ff15aa75 Unify completion from container content logic 2014-12-23 13:54:09 +00:00
Maxime Coste
ebecd60eb8 Rework hashing, use a more extensible framework similar to n3876 proposal
std::hash specialization is a pain to work with, stop using that, and
just specialize a 'size_t hash_value(const T&)' free function.
2014-12-16 18:57:19 +00:00
Maxime Coste
def4221ac7 Pass a BufferRange to highlighters, fix subregions
Regions highlighter can now correctly be applied to only subrange
of the buffer, fixing some corner cases in recursive regions.
2014-12-02 19:56:17 +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
b2e90fe21e Refactor highlighters, use an interface with virtual methods 2014-10-22 13:54:03 +01:00
Maxime Coste
fa85f0fc32 Refactor regex uses, do not reference boost except in regex.hh 2014-10-13 13:14:23 +01:00
Maxime Coste
d4a84125ef Use InternedStrings for buffer contents 2014-10-03 13:39:13 +01:00
Maxime Coste
f738316689 small refactor in highlighters 2014-09-19 13:45:11 +01:00
Maxime Coste
5092494427 Add support for target column preservation
Fixes #64
2014-09-09 19:42:57 +01:00
Maxime Coste
032b621150 Use strongly typed enum for Face Attribute, add Dim 2014-07-15 20:11:47 +01:00
Maxime Coste
ac5cbba0ae Remove region highlighter, rename multi_regions to regions, cleanup 2014-07-14 21:42:19 +01:00
Maxime Coste
ec37adc523 Fix bug in nested highlighting 2014-07-14 21:41:29 +01:00
Maxime Coste
d5d76721b0 Avoid infinite loop in MultiRegionHighlighter when regexes generate empty matches 2014-07-14 20:46:46 +01:00
Maxime Coste
cbfceba149 Do not resolve faces in highlighter factories, defer to actual highlighting 2014-07-13 16:52:51 +01:00
Maxime Coste
d78ece490f Rename RegexColorizer to RegexHighlighter 2014-07-12 13:57:16 +01:00
Maxime Coste
72ccb9bce6 Refactor RegexColorizers face handling 2014-07-12 11:19:35 +01:00
Maxime Coste
a32b49acd1 Rename ColorPair to Face and ColorRegistry to FaceRegistry
Face also stores the attributes
2014-07-11 00:27:43 +01:00
Maxime Coste
ed68d1ff28 utf8: use end of sequence iterators for more security 2014-07-05 12:10:06 +01:00
Maxime Coste
7aa78d726a fix potential infinite loop in show_matching highlighter 2014-06-27 21:10:09 +01:00
Maxime Coste
7235180614 Use main selection index as default when accessing only one register value
Fixes #117
2014-06-21 11:31:08 +01:00
Maxime Coste
e202b7af50 Add a line_option highlighter that highlight the line stored in an int option
Use it to highlight the current error in the *make* buffer
2014-06-18 20:50:39 +01:00
Maxime Coste
6f2569ff30 Color Default now means 'keep as is' for most highlighters 2014-06-18 20:33:23 +01:00
Maxime Coste
54590f5d79 Minor code cleanup in highlighters 2014-06-18 20:31:49 +01:00
Maxime Coste
fc6a16a571 Fix corner cases in region highlighting 2014-06-16 19:41:07 +01:00
Maxime Coste
51da452dc4 Merge branch 'master' into hierarchical-highlighters 2014-06-16 01:06:09 +01:00
Maxime Coste
2acfe85281 Highlight selection cursors in a second pass
This allows cursors to overlap on next selection and still be
visible.
2014-06-16 00:59:05 +01:00
Maxime Coste
205e8b2889 Refactor highlighter command completions 2014-06-15 16:04:38 +01:00
Maxime Coste
9130f0334b Remove defhl, use addhl -group 2014-06-12 22:35:40 +01:00
Maxime Coste
dac5e89e14 Add MultiRegionHighlighter
MultiRegionHighlighter provides a way to segment the buffer in
logical regions using the common left-most rule for finding the
next region. It then provides highlighting groups for each region
that can be filled.
2014-06-11 23:29:23 +01:00
Maxime Coste
0faf7ff5e6 Refactor region highlighter, extract code to helper classes 2014-06-11 23:29:15 +01:00
Maxime Coste
0a76fe3040 Add support for recursion in region highlighter
An optional parameter defines the recursion regex, that match
potential closers.

For example, %sh{ ... } blocks support nested { }, so defining \{
as the recurse regex make the region highlighter correctly match
%sh{ ... { ... } ... } constructs
2014-06-11 00:23:44 +01:00
Maxime Coste
37d66b1e0b Convert Region highlighter to a HierarchicalHighlighter
add a region using addhl region <id> <begin_regex> <end_regex>
then fill the region with addhl -group <id>/content ...
2014-06-10 22:02:42 +01:00
Maxime Coste
4c942c4a3a ref highlighter tolerates unexisting reference 2014-06-10 22:02:08 +01:00
Maxime Coste
ca93ae807d Add a fill highlighter that just fills the display buffer 2014-06-10 21:46:16 +01:00
Maxime Coste
479c31b571 Replace FunctionGroup template with HighlighterGroup class 2014-06-10 19:58:02 +01:00
Maxime Coste
8d9ed5e8c7 Fix in region highlighter 2014-06-02 15:42:03 +01:00
Maxime Coste
ce469398c5 Revert "Use Modification for region highlighter"
This reverts commit aa64851de6.

Conflicts:
	src/highlighters.cc
2014-05-26 21:02:09 +01:00
Maxime Coste
0a060b62a2 Merge branch 'master' into remove-buffer-change-listener 2014-05-25 20:01:55 +01:00
Maxime Coste
fc0700d1fd Fix segfault in region highlighter 2014-05-24 17:17:14 +01:00
Maxime Coste
aa64851de6 Use Modification for region highlighter 2014-05-21 23:35:11 +01:00
Maxime Coste
55959f2cb1 Make expand_unprintable more tolerant to invalid utf8 2014-05-21 00:24:58 +01:00
Maxime Coste
03e5264df4 Remove per lines timestamp in Buffer 2014-05-17 12:17:05 +01:00
Maxime Coste
211b78f536 Merge branch 'master' into remove-buffer-change-listener
Conflicts:
	src/highlighters.cc
2014-05-17 11:39:56 +01:00
Maxime Coste
2f1388df7b replace LineChangeWatcher with a free function compute_line_modifications 2014-05-14 21:19:19 +01:00
Maxime Coste
34e1c2ddd5 Fix RegexColorizer cache handling 2014-05-14 19:22:42 +01:00
Maxime Coste
016ede38d1 Fix show_matching highlighter when opening char is the first buffer char
Fixes #119
2014-05-13 19:45:32 +01:00
Maxime Coste
6b42c48c3f Refactor DynamicRegexHighlighter, search hl uses Search colalias
fixes #122
2014-05-13 19:35:28 +01:00
Maxime Coste
c7d24ac7db Add a show_whitespaces highlighter 2014-05-09 13:50:12 +01:00
Maxime Coste
8546788b43 Refactor LineAndColumn coordinates
BufferCoord -> ByteCoord
DisplayCoord -> CharCoord

Moved their definition along with LineAndColumn into coord.hh
2014-05-07 19:53:45 +01:00
Maxime Coste
26dd21706e Replace some typedefs with usings 2014-05-01 19:03:13 +01:00
Maxime Coste
49bc7f8767 minor formatting cleanup 2014-04-27 12:37:58 +01:00