m0viefreak
4c4baede51
'brackets': Don't highlight corresponding bracket on accept-line
8 anos atrás
Daniel Shahaf
c793e0dcea
highlighters: Rename entry points.
This tracks the API change made in the previous commit, as suggested in the
(#if 0'd) deprecation warning.
8 anos atrás
Daniel Shahaf
def8c0da83
Bump copyright years.
8 anos atrás
m0viefreak
5fe8fd8bdc
'brackets': Fix for one-based indexing
Use correct indexing also for cursor-matchingbracket.
Fixup for 95d82568d8
8 anos atrás
Matthew Martin
b5955213b9
tests: Add tests for 'brackets' and 'pattern'
8 anos atrás
Matthew Martin
f73f3d53d3
'brackets': Allow unset ZSH_HIGHLIGHT_STYLES
Without this when bracket_color_size is 0,
$(( (levelpos[$pos] - 1) % bracket_color_size + 1 ))
errors with division by zero.
8 anos atrás
Matthew Martin
eaa4335c34
tests: Set ZSH_HIGHLIGHT_STYLES=() during tests
Since the _zsh_highlight_add_highlight that the tests use ignores
ZSH_HIGHLIGHT_STYLES, we can test both an injective mapping and an empty
mapping at once.
8 anos atrás
Matthew Martin
ccaf6f48a1
brackets: Fix bug introduced in 95d8256
8 anos atrás
Matthew Martin
e05b8e88ad
'brackets': Check if brackets match on first pass
This removes the need for the typepos array.
8 anos atrás
Matthew Martin
95d82568d8
'brackets': Use one-based indexing
zsh arrays start at one, and this will make the next commit easier.
8 anos atrás
Matthew Martin
f4d3dcb42f
'brackets': Move highlight call outside conditional
8 anos atrás
Matthew Martin
fd84010252
'brackets': Lift local declarations from inside loops
8 anos atrás
Matthew Martin
4da9889d15
tests: Use 'NONE' to denote no highlighting
'none' is a valid highlighting type. Since by convention styles are all
lowercase, 'NONE' shouldn't conflict with anything.
Closes #289 .
8 anos atrás
Matthew Martin
341a3ae1f0
highlighters: Use _zsh_highlight_add_highlight
_zsh_highlight_add_highlight appends to region_highlight $1 $2 and the
next non-null parameter. If there is no non-null parameter, do nothing,
This is so that highlighters can add a style with fallbacks if the most
specific style is not defined. If none of the applicable styles are
defined, do the right thing and don't add an invalid entry to
region_highlight.
The pattern highlighter doesn't use this function as it'd need too large
of an API change.
8 anos atrás
Matthew Martin
089329660b
highlighters: Pass around the style key instead of the style itself
8 anos atrás
Matthew Martin
a830613467
tests: Specify the style key instead of the style itself
8 anos atrás
Daniel Shahaf
b52a485c5c
brackets: Optimize a tiny bit.
Compute «${#BUFFER}» just once. I haven't measured the effect of this, but
it might just avoid a strlen() every time around the loop, which could add
up for large ${BUFFER}s.
See issue #295 .
8 anos atrás
Matthew Martin
31ac2b36a9
tests: Quote style in expected_region_highlight
8 anos atrás
Matthew Martin
8e115052e9
docs: Fix broken symlinks
8 anos atrás
Matthew Martin
0ab450ae47
docs: Move docs into docs/
8 anos atrás
Matthew Martin
35e0b0ca69
docs: Remove duplicate 'How to activate it' sections
8 anos atrás
Matthew Martin
2dd6923c30
docs: Move highlighter headers down one level
8 anos atrás
Daniel Shahaf
6e99128987
docs copyedit: minor: Spelling/punctuation fix.
8 anos atrás
Daniel Shahaf
3f163a2fd4
docs copyedit: Rewrap to 80 columns, part 2.
8 anos atrás
Daniel Shahaf
8ea392e361
docs copyedit: Restyle bold-italic to fixed-width.
8 anos atrás
Daniel Shahaf
91e4a576fb
docs copyedit: Port 6d93ea07fd
to the other highlighters' README's.
8 anos atrás
Daniel Shahaf
6c033e62e9
docs copyedit: Whitespace.
8 anos atrás
Daniel Shahaf
c30301d474
Drop unnecessary shebang lines.
All these files should be sourced, not executed; and Debian's lintian complains:
W: zsh-syntax-highlighting: script-not-executable usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
9 anos atrás
Daniel Shahaf
9e80fe8f02
Bump copyright years.
9 anos atrás
Daniel Shahaf
c46b8d169e
test harness: Fix off-by-one discrepancy between observed and expected.
Fixes issue #195 .
9 anos atrás
Randy
e8cc271314
Resolves slow performance in brackets highlighter
10 anos atrás
Jan M. Binder
732b7d6e65
Fix bracket highlighter
12 anos atrás
Andreas Gahr
b1b65dc486
bracket highlighter: small typo in testcase - document new style
13 anos atrás
Andreas Gahr
06ad03e32c
bracket highlighter: simplify
13 anos atrás
Andreas Gahr
8375ef6e72
bracket highlighter: make the style configurable, when cursor is on bracket
13 anos atrás
Andreas Gahr
24243becba
bracket highlighter: fix typo from last commit
13 anos atrás
Andreas Gahr
e1ed255c0a
bracket highlighter: start loops with 0 which is more natural and also more in line whith the other highlighters
13 anos atrás
Andreas Gahr
0d55207c78
simple testcases for bracket highlighter - actually add files
13 anos atrás
garinger
e7ab165310
* optimize discrimination of bracket-type
* use a nicer variable name
13 anos atrás
garinger
f1eb5aeef7
skip all brackets inside quotes (" and ')
13 anos atrás
garinger
2fe9505647
simplify check for bracket under cursor
13 anos atrás
garinger
05e4a031c7
* remove a safety belt - no need to check if array has elements, as defaults are provided
* reuse $pos instead of using another variable
* remove declaration forgotten in last commit
13 anos atrás
garinger
d4acac9837
eliminate a variable and simplify
13 anos atrás
garinger
ef74d2b611
Only match brackets of the same type
13 anos atrás
garinger
48c30a805a
highlight opening bracket with "bracket-error" style, if the closing bracket is still missing
13 anos atrás
Julien Nicoulaud
ef4f5ed638
Fix READMEs
13 anos atrás
Julien Nicoulaud
0772ddd346
Big refactoring.
* Don't override user defined styles
* Better modularisation of highlighters
* Allow to define which highlighters are activated
* Allow to define the order in which they are defined
* Minor performance optimizations
* Fixed some variables leak
* Improve documentation
* Brackets highlighter: use ZSH_HIGHLIGHT_STYLES instead of a specific array
13 anos atrás