Commit Graph

362 Commits

Author SHA1 Message Date
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
b5693c6253 Refactor option_from_string to return directly the option value 2018-05-27 13:00:50 +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
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
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
2fa553e728 Remove implicit conversion from String to DisplayAtom/DisplayLine 2018-04-29 20:45:53 +10:00
Maxime Coste
57baad4afd Make FaceRegistry scoped
set-face now takes a scope argument, and faces can be overridden on
a buffer or window basis.

colorscheme apply on global scope, which should be good enough for
now.

Fixes #1411
2018-04-07 16:27:50 +10:00
Delapouite
cb02186c77 Make error messages more consistent 2018-04-06 16:56:53 +02:00
Maxime Coste
3c03129c46 Make compute_display_setup methods const 2018-04-06 09:16:59 +10:00
Maxime Coste
0a2807e652 RangesHighlighter: a range that goes up to buffer end is not valid 2018-03-16 23:25:37 +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
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
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
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
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
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
6333ae207f Correctly set the NotBeginOfSubject/NotEndOfSubject flags for regex matching
Fixes #1778
2017-12-29 09:55:53 +11:00
Maxime Coste
a38d6cc3f0 Highlighter: In general, highlight replaced ranges
Fixes #1251
2017-12-21 12:26:25 +11: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
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
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
Maxime Coste
b1115f7469 Wrap: fix scrolling to keep cursor visible logic 2017-11-10 21:17:05 +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
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
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
065bbc8f59 Regex: switch to custom impl, use boost for checking 2017-11-01 14:05:14 +08:00
Maxime Coste
654e3fcb46 Fix regions highlighter infinite loops when regex matches empty ranges 2017-10-25 10:39:35 +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
75d2eb2b79 formatting tweak 2017-10-06 13:47:30 +08:00
Maxime Coste
d5c10472f6 Avoid wrapping between punctuation and word
Fixes #1550
2017-09-18 09:52:24 +09:00
Delapouite
58b0bd6f63 Fix typo: parmeter → parameter 2017-09-14 23:19:55 +02: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
64183b1e4c Make Token a simple aggregate 2017-09-01 17:09:34 +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
7a79cbbc81 Migrate code to c++14 2017-07-19 08:47:14 +02: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
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
4e7a357a47 Fix various undefined behaviours detected by UBSan 2017-06-26 11:27:18 +01:00
Maxime Coste
657e30db1c Use already stored coordinates in show_whitespaces 2017-06-17 14:48:59 +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
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
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