Commit graph

283 commits

Author SHA1 Message Date
Daniel Shahaf
fa57633d81 'main': Enable test for issue #238. 2016-07-28 08:14:23 +00:00
Daniel Shahaf
0d41933c61 'main': Add test for issue #343, concerning the 'command' precommand. 2016-07-28 07:54:28 +00:00
Daniel Shahaf
e6fb61c42b 'main': Highlight a broken symlink as a file.
Merge remote-tracking branch 'upstream/pr/342'

* upstream/pr/342:
  'main': Highlight a broken symlink as a file.
  tests: Add an XFail test for issue #342.
2016-07-22 16:09:06 +00:00
Daniel Shahaf
6b69389bd9 'main': New test, related to issue #328.
The test passes so I'm adding it directly to master.
2016-07-22 15:52:43 +00:00
Daniel Shahaf
3409a2e4d2 *: s/echo/print/
Just in case one of the interpolated variables contains a backslash.
2016-07-21 04:01:50 +00:00
Daniel Shahaf
53083da821 'main': Highlight a broken symlink as a file.
Fixes #342.
2016-07-20 02:01:15 +00:00
Daniel Shahaf
95f7206a93 tests: Add an XFail test for issue #342. 2016-07-20 02:00:28 +00:00
Daniel Shahaf
d13da0cf00 'main': Support vi linewise region (REGION_ACTIVE == 2).
Merge remote-tracking branch 'danielshahaf/i267-linewise-region-v1'

* danielsh/i267-linewise-region-v1:
  tests: Add a regression test for issue #267, concerning highlighting a vi linewise region.
  Support linewise region.
2016-07-01 02:00:10 +00:00
Daniel Shahaf
ee07588cfd tests: Add a regression test for issue #267, concerning highlighting a vi linewise region. 2016-07-01 01:59:37 +00:00
m0viefreak
9a934d291e 'main': Path separators: Leave styles empty by default
If the separator feature is disabled, this makes it possible to
change the main 'path' styles in a running session without the
need to touch the '_pathseparator' styles, too.
2016-06-11 14:19:17 +02:00
Daniel Shahaf
d9e07b5082 'main': simple parameter expansions at command word: Don't use an undefined value.
Causes such expansions to be highlighted as [unknown-token] rather than as default (absent from $region_highlight).

Fixes #337.
2016-06-10 14:31:57 +00:00
Daniel Shahaf
da91264122 'main': Add missing arguments.
Part of #337.
2016-06-10 14:31:57 +00:00
Daniel Shahaf
e35a0b256e 'main': Try the "non-command word" codepath when a word may be either a command word or a non-command word.
Merge remote-tracking branch 'upstream/pr/331'

* upstream/pr/331:
  'main': Try the "non-command word" codepath when a word may be either a command word or a non-command word.
2016-06-05 16:58:12 +00:00
Daniel Shahaf
47144ad974 'main': Fix issue #290, «Mishighlights "longloops" 'repeat'».
* upstream/pr/319:
  tests: Extend issue #290 test with another variant.
  'main': Fix issue #290, «Mishighlights "longloops" 'repeat'».
  tests: New test for issue #290, «Mishighlights "longloops" 'repeat'».
2016-06-03 04:32:25 +00:00
Daniel Shahaf
7fb6f99791 'main': Try the "non-command word" codepath when a word may be either a command word or a non-command word.
Fixes #231.
Fixes #330.
2016-06-03 04:25:00 +00:00
Daniel Shahaf
29b30e0ca7 'main': Add XFail test for issue #330, concerning command word after array assignment. 2016-06-03 03:42:12 +00:00
Daniel Shahaf
f4036a09ce 'main': Highlight scalar assignments to argv
Assignments to positional parameters using scalar assignment syntax is
a feature: it is covered by upstream's test suite ("append to positional
parameter" in Test/A06assign.ztst).
2016-06-03 03:27:52 +00:00
Daniel Shahaf
14711a51f3 tests: Explicitly test 'default' style inside an array assignment. 2016-06-03 02:41:10 +00:00
Matthew Martin
91fa057a39 minor: 'main': Only search for prefixes if :h is a directory 2016-06-01 00:54:30 -05:00
Daniel Shahaf
f060622dc6 'main': Internal cleanup: drop $style_override.
Merge remote-tracking branch 'upstream/pr/326'

* upstream/pr/326:
  'main': Internal cleanup: drop $style_override.

Conflicts:
	highlighters/main/main-highlighter.zsh (context lines only)
2016-06-01 05:45:39 +00:00
m0viefreak
6cd39e7c70 'main': Highlight path separators
This commit is based on the work done by
Jorge Israel Peña (blaenk) in #136.

Changes:
* Adjusted to changes on the latest master branch.
* Use regular path highlighter colors by default.
* Break out early if the separator color is the same to
  improve performance.
* Tests.
2016-05-31 15:06:12 +00:00
Daniel Shahaf
a5b8bc0ef0 'main': Internal cleanup: drop $style_override.
Changes the interface of _zsh_highlight_main_highlighter_check_path().

Suggested-by: m0viefreak
2016-05-27 10:21:28 +00:00
m0viefreak
3b67e656bf 'main': Implement simple command type cache 2016-05-24 23:08:11 +02:00
m0viefreak
12b879caf7 'main': Use zsh/parameter instead of type -w
If possible, try to use the zsh/parameter module to get
information about a shell words.

This avoids subshells and is a huge speed improvement
on systems such as cygwin.

Note 1:
$commands does not know about PATH_DIRS. So in case
PATH_DIRS is set, 'type -w' is still used if nothing
else matches.

Note 2:
zsh/parameter can't distinguish between 'command' and
'hashed'. Adjusted the test for that case to XFAIL.

The ideal solution would be if whence had an option to
put the result in REPLY instead of printing it to stdout.
2016-05-13 20:25:07 +02:00
m0viefreak
61f43255ab 'main': Support multiple styles in _zsh_highlight_main_add_region_highlight 2016-05-13 20:25:04 +02:00
Daniel Shahaf
6362c757b6 tests: Extend issue #290 test with another variant.
The test being extended is highlighters/main/test-data/control-flow2.zsh.
2016-05-13 04:28:43 +00:00
Daniel Shahaf
ef68f50c04 'main': Fix issue #290, «Mishighlights "longloops" 'repeat'». 2016-05-13 03:30:11 +00:00
Daniel Shahaf
4832f18c50 tests: New test for issue #290, «Mishighlights "longloops" 'repeat'». 2016-05-13 02:50:24 +00:00
Daniel Shahaf
f146651913 Merge part of PR #298
* commit '2f18ba':
  'main': use zsh/parameter to resolve alias
  driver: load zsh/parameter if available
2016-05-13 02:27:29 +00:00
m0viefreak
2f18ba64e3 'main': use zsh/parameter to resolve alias
If possible, use zsh/parameter to avoid forks.

Fixes #263.
2016-05-13 02:27:03 +00:00
Daniel Shahaf
def8c0da83 Bump copyright years. 2016-05-13 01:29:49 +00:00
Daniel Shahaf
4f5bb6cf96 Merge remote-tracking branch 'upstream/pr/308' into HEAD
* upstream/pr/308:
  'main': Fix issue #302, "Process substitution misparsed as redirection".
  'main': Factor out common code.  No functional change.
  'main': Add a regression test for issue #302, "Process substitution misparsed as redirection".
2016-05-13 01:24:01 +00:00
Daniel Shahaf
7b82b88a71 'main': Don't leak the PATH_DIRS options.
Found-by: m0viefreak
(in #298)
2016-05-12 19:24:00 +00:00
Sebastian Gniazdowski
ef4bfe5bcc 'main': 2nd optimization that in my tests shows 2.2s -> 2.0s 2016-05-12 19:22:29 +00:00
Daniel Shahaf
5a98cd3a10 Merge remote-tracking branch 'upstream/pr/315' into HEAD
* upstream/pr/315:
  'main': optimization that in my tests shows 2.7s -> 2.2s
2016-05-12 18:30:50 +00:00
Sebastian Gniazdowski
02229ebd63 'main': optimization that in my tests shows 2.7s -> 2.2s
Consider indexing long buffers (say 300 chars). E.g. following line:
      integer offset=${${buf[start_pos+1,len]}[(i)$needle]}
will gradually go into large indices for first index [a,] and be kept
at large index for second index [,b]. Instead, we can remove already
processed characters from buf:
    proc_buf="${proc_buf[offset + $#arg + 1,-1]}"
$offset and $#arg are small, first index will not be large. $proc_buf
will be smaller and smaller and the second index [,-1] will run shorter
and shorter.
2016-05-12 18:29:09 +00:00
Daniel Shahaf
62f1c108f3 tests: New test to capture off-by-ones.
Inspired by #312.
2016-05-11 20:36:18 +00:00
m0viefreak
5fe8fd8bdc 'brackets': Fix for one-based indexing
Use correct indexing also for cursor-matchingbracket.

Fixup for 95d82568d8
2016-05-11 01:11:49 +02:00
Daniel Shahaf
fc9c892a3f 'main': Fix issue #302, "Process substitution misparsed as redirection". 2016-05-09 03:29:27 +00:00
Daniel Shahaf
bfabffbf97 'main': Factor out common code. No functional change. 2016-05-09 03:26:29 +00:00
Daniel Shahaf
6889ff6bd2 'main': Add a regression test for issue #302, "Process substitution misparsed as redirection". 2016-05-09 03:26:06 +00:00
Matthew Martin
b5955213b9 tests: Add tests for 'brackets' and 'pattern' 2016-05-05 15:36:33 -05:00
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.
2016-05-05 13:56:09 -05:00
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.
2016-05-05 12:31:52 -05:00
Matthew Martin
d3678ec7a8 tests: Remove unused_highlight 2016-05-05 12:28:43 -05:00
Matthew Martin
ccaf6f48a1 brackets: Fix bug introduced in 95d8256 2016-05-05 09:59:26 -05:00
Matthew Martin
e05b8e88ad 'brackets': Check if brackets match on first pass
This removes the need for the typepos array.
2016-05-04 20:50:55 -05:00
Matthew Martin
95d82568d8 'brackets': Use one-based indexing
zsh arrays start at one, and this will make the next commit easier.
2016-05-04 20:50:55 -05:00
Matthew Martin
f4d3dcb42f 'brackets': Move highlight call outside conditional 2016-05-04 20:50:55 -05:00
Matthew Martin
fd84010252 'brackets': Lift local declarations from inside loops 2016-05-04 20:50:55 -05:00