Matthew Martin
b62aeb6168
Autoload highlighters
il y a 4 ans
Daniel Shahaf
cdd7f899cb
brackets: Optimize the character iteration
Test case: See the first comment of issue #295 .
Before:
num calls time self name
-----------------------------------------------------------------------------------
1) 14 284.67 20.33 82.84% 284.67 20.33 82.84% _zsh_highlight_highlighter_brackets_paint
2) 15 313.72 20.91 91.30% 26.62 1.77 7.75% _zsh_highlight
3) 14 318.68 22.76 92.74% 7.41 0.53 2.16% _zsh_highlight_call_widget
After:
num calls time self name
-----------------------------------------------------------------------------------
1) 15 57.25 3.82 45.33% 28.30 1.89 22.41% _zsh_highlight
2) 14 81.96 5.85 64.90% 27.02 1.93 21.40% _zsh_highlight_call_widget
3) 14 26.31 1.88 20.84% 26.31 1.88 20.84% _zsh_highlight_highlighter_brackets_paint
4) 2 10.66 5.33 8.44% 8.97 4.49 7.10% VCS_INFO_formats
5) 2 25.92 12.96 20.52% 7.72 3.86 6.11% VCS_INFO_get_data_git
(That's not in my everyday configuration but in my minimal testing
setup, which runs vcs_info with the default settings.)
il y a 4 ans
Daniel Shahaf
8652a8f4e4
Bump copyright years.
il y a 6 ans
Matthew Martin
ecdda36ef5
brackets: Ignore quotes
Closes #112 . Closes #138 .
il y a 6 ans
Matthew Martin
1f77ed8369
brackets: Use idiomatic set check
il y a 6 ans
Matthew Martin
9dcfacc4a5
brackets: Disallow negative nesting level
il y a 6 ans
Matthew Martin
ac90970edc
brackets: Don't call _zsh_highlight_add_highlight with empty style
il y a 6 ans
m0viefreak
4c4baede51
'brackets': Don't highlight corresponding bracket on accept-line
il y a 8 ans
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.
il y a 8 ans
Daniel Shahaf
def8c0da83
Bump copyright years.
il y a 8 ans
m0viefreak
5fe8fd8bdc
'brackets': Fix for one-based indexing
Use correct indexing also for cursor-matchingbracket.
Fixup for 95d82568d8
il y a 8 ans
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.
il y a 8 ans
Matthew Martin
ccaf6f48a1
brackets: Fix bug introduced in 95d8256
il y a 8 ans
Matthew Martin
e05b8e88ad
'brackets': Check if brackets match on first pass
This removes the need for the typepos array.
il y a 8 ans
Matthew Martin
95d82568d8
'brackets': Use one-based indexing
zsh arrays start at one, and this will make the next commit easier.
il y a 8 ans
Matthew Martin
f4d3dcb42f
'brackets': Move highlight call outside conditional
il y a 8 ans
Matthew Martin
fd84010252
'brackets': Lift local declarations from inside loops
il y a 8 ans
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.
il y a 8 ans
Matthew Martin
089329660b
highlighters: Pass around the style key instead of the style itself
il y a 8 ans
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 .
il y a 8 ans
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
il y a 9 ans
Randy
e8cc271314
Resolves slow performance in brackets highlighter
il y a 10 ans
Jan M. Binder
732b7d6e65
Fix bracket highlighter
il y a 12 ans
Andreas Gahr
06ad03e32c
bracket highlighter: simplify
il y a 13 ans
Andreas Gahr
8375ef6e72
bracket highlighter: make the style configurable, when cursor is on bracket
il y a 13 ans
Andreas Gahr
24243becba
bracket highlighter: fix typo from last commit
il y a 13 ans
Andreas Gahr
e1ed255c0a
bracket highlighter: start loops with 0 which is more natural and also more in line whith the other highlighters
il y a 13 ans
garinger
e7ab165310
* optimize discrimination of bracket-type
* use a nicer variable name
il y a 13 ans
garinger
f1eb5aeef7
skip all brackets inside quotes (" and ')
il y a 13 ans
garinger
2fe9505647
simplify check for bracket under cursor
il y a 13 ans
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
il y a 13 ans
garinger
d4acac9837
eliminate a variable and simplify
il y a 13 ans
garinger
ef74d2b611
Only match brackets of the same type
il y a 13 ans
garinger
48c30a805a
highlight opening bracket with "bracket-error" style, if the closing bracket is still missing
il y a 13 ans
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
il y a 13 ans
Julien Nicoulaud
bc788f3f19
Start splitting highlighters to separate files.
The script still works on its own, highlighters in highlighters/ are
loaded as addons if present.
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
il y a 13 ans
Julien Nicoulaud
2670c93e05
Make sure functions names match _zsh_highlight_*
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
il y a 13 ans
Julien Nicoulaud
dd84bff854
Code style
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
il y a 13 ans
Takeshi Banse
bb5f41ef6d
Add contrib/keyword.zsh
Signed-off-by: Takeshi Banse <takebi@laafc.net>
il y a 13 ans
Julien Nicoulaud
ea792cbf87
Add a mechanism for testing the correctness of the highlighting.
Feel free to add more test data !
Signed-off-by: Julien Nicoulaud <julien.nicoulaud@gmail.com>
il y a 13 ans