Commit graph

276 commits

Author SHA1 Message Date
Daniel Shahaf
035d3eb095 Follow-up to 28d7056a7a: Fix test expectations. 2016-10-22 17:46:42 +00:00
Daniel Shahaf
28d7056a7a 'main': Escape '!' within double-quoted strings. 2016-10-19 23:56:25 +00:00
Daniel Shahaf
7d38d07255 'main': Followup to fdaeec4514: Update comment.
That revision was itself a followup to 51614ca2c9.
2016-10-17 20:46:46 +00:00
Daniel Shahaf
094329eb14 'main': Introduce style fallback for the command word.
Fixes #316.

* danielsh/i316-v2:
  'main': Enable fallback to the 'arg0' style.
  'main': Set fallback style for the 'arg0' style.
2016-09-28 13:25:05 +00:00
Daniel Shahaf
bccc3dc269 'main': Enable fallback to the 'arg0' style. 2016-09-28 13:22:29 +00:00
Daniel Shahaf
b4537a972e 'main': Set fallback style for the 'arg0' style.
The fallback style name uses '_' in anticipation of a future auto-fallback
feature keyed on style names.

'arg0' was previously known as 'commandtypefromthefuture'.
2016-09-28 13:22:09 +00:00
Daniel Shahaf
79198759b3 tests: Also test arguments to an anonymous function. 2016-09-25 18:08:45 +00:00
Daniel Shahaf
dd51b7bebe Merge remote-tracking branch 'upstream/pr/374' into HEAD
* upstream/pr/374:
  'main': Directly count spaces to skip, don't leverage proc_buf length
2016-09-25 15:58:35 +00:00
Sebastian Gniazdowski
15461e7d21 'main': Directly count spaces to skip, don't leverage proc_buf length
Main highlighter run on itself, on the optimized version:

- optimized (8 runs, 3 last noted):
1.1201650000
1.1074430000
1.1263810000

- unoptimized (8 runs, 3 last noted):
1.5746400000
1.5115250000
1.5155440000

Average difference: 0.415907
2016-09-25 17:52:56 +02:00
Daniel Shahaf
44ef6e38e5 'main': Highlight several more special (non-alphabetic) parameters. 2016-09-25 14:51:02 +00:00
Daniel Shahaf
4afe670f7a 'main': Highlight shell's PID ($$) inside double quotes. 2016-09-25 14:40:58 +00:00
Daniel Shahaf
c3913e0d8e 'main': Highlight command substitutions inside double quotes.
Part of issue #139.
2016-09-25 14:40:02 +00:00
Daniel Shahaf
4fc35362ee 'main': Permit subshells to end at command position.
Fixes #344.
2016-09-25 12:06:39 +00:00
Daniel Shahaf
2bb8f0703d 'main': Highlight mismatched foreach/end.
Fixes #96.
2016-09-25 11:52:15 +00:00
Daniel Shahaf
b2733a64da 'main': Highlight mismatched do/done. 2016-09-25 11:38:54 +00:00
Daniel Shahaf
2755438e80 'main': Yet another test for mismatched braces. 2016-09-25 11:38:52 +00:00
Sebastian Gniazdowski
c6b6513ac0 'main' / *_check_path: Precompute $#BUFFER and use it for speed gain
Running main highlighter on itself (both runs are on the optimized
version):

- clean (8 runs, last 3 noted):
1.7007670000
1.7330720000
1.7038810000

- optimized (8 runs, last 3 noted):
1.5007230000
1.5142960000
1.4973320000

Average difference: 0.208456

When parsing main-highlighter with itself, the *_check_path function is
called 426 times. Note that there are 686 region_highlight resulting
entries.
2016-09-25 12:35:28 +02:00
Daniel Shahaf
a053768627 dev tools: Remove a superfluous empty line. 2016-09-25 08:11:01 +00:00
Daniel Shahaf
e5782e4ddf 'main': Highlight 'always' blocks.
Fixes #335.
2016-09-25 08:11:01 +00:00
Daniel Shahaf
8bf423d16d 'main': Don't find command positions within multiline array literals.
Fixes #333.
2016-09-24 17:55:18 +00:00
Daniel Shahaf
a4196eda5e 'main': Restore compatibility with zsh-4.3.14 and older (after e3182c18de8f).
Fixes #368.
2016-09-23 15:55:06 +00:00
Daniel Shahaf
6f91850a01 'main': Highlight first command word in named functions defined in the sh syntax when MULTI_FUNC_DEF is set.
Fixes a subset of issue #237.
2016-09-23 06:37:26 +00:00
Daniel Shahaf
2fabf7ca64 'main': More tests for mismstached parentheses and braces. 2016-09-22 11:12:42 +00:00
Daniel Shahaf
51b9d79c3b 'main': Highlight mismatched parentheses and braces. 2016-09-22 11:12:42 +00:00
Daniel Shahaf
02807f1826 'main': Support the IGNORE_BRACES option.
This is related to a future "unbalanced { ( ) }" check for issue #344.
2016-09-22 03:45:04 +00:00
Daniel Shahaf
a8a6384356 'main': Add tests for the IGNORE_BRACES option.
Also adds an XFail test for balanced braces for issue #344.
2016-09-22 03:41:53 +00:00
Daniel Shahaf
fdaeec4514 'main': Followup to 51614ca2c9: Run cheaper conditions first.
This was suggested on #355.
2016-09-08 19:09:29 +00:00
Daniel Shahaf
51614ca2c9 'main': Avoid triggering a zsh bug related to hashed commands.
This manifested in completion of the form «./foo<TAB>» where there happened to
be a program called 'foo' in $PATH.

Fixes #354.
Closes #355.
2016-08-30 02:56:23 +00:00
Daniel Shahaf
c7f7d2ff16 *: Change highlighters' namespace.
Fixes #329.

Merge remote-tracking branch 'danielsh/i329-v1'

* danielsh/i329-v1:
  highlighters: Rename entry points.
  driver: Rename highlighter entry points
2016-08-16 17:53:01 +00:00
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.
2016-08-16 17:51:43 +00:00
Daniel Shahaf
2c002f9f89 noop: Add comments. 2016-08-16 13:40:31 +00:00
Daniel Shahaf
757d047f09 'main': The word after 'sudo' is only a non-command word if it is an option. 2016-08-16 13:31:05 +00:00
Daniel Shahaf
179b8e753f 'main': Test for redirection earlier.
This is a prerequisite for the next commit.

The incumbent code was wrong: the test of $in_redirection in the first hunk
would never have seen «(( in_redirection == 2 ))».  That had no visible
effect since options to sudo don't look like redirection operators.
2016-08-16 13:27:36 +00:00
Daniel Shahaf
6e2ef574c8 noop: Restructure code for clarity.
The structure now mirrors the stall construct at the top of the loop.
2016-08-16 13:25:43 +00:00
Daniel Shahaf
d1c773faa7 noop: Fix indentation. 2016-08-16 13:00:55 +00:00
Daniel Shahaf
171a4eec2d Merge remote-tracking branch 'danielsh/m0vie-i288-v2' (revised version of upstream/pr/288)
* danielsh/m0vie-i288-v2:
  driver: Don't highlight in isearch
  driver: Always bind zle-line-finish and use it instead of accept-*
  driver: Widget binding: Support binding incomplete/nonexistent widgets
2016-07-29 21:09:31 +00:00
m0viefreak
5bae621900 driver: Always bind zle-line-finish and use it instead of accept-*
Special handling for cursor imprint or partial path highlighting
is needed in more cases than accept-*. For example when accepting
a line from isearch, no accept-* widget is invoked.

The proper way is to use zle-line-finish.

Trumps #259.
Fixes #284.
2016-07-29 20:41:06 +00:00
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