709 Commits

Author SHA1 Message Date
Paul Ackersviller
ac0b03f59a Little bit cleaner method of calling add-zle-hook-widget with no_unset. 2016-12-24 15:59:40 -05:00
Paul Ackersviller
b68c2701d0 Remove stray leftover debug option. 2016-12-21 19:44:18 -05:00
Paul Ackersviller
275943a3eb Allow for all tests to run with no_unset option, and use it via -u flag in makefile. 2016-12-21 19:12:03 -05:00
Paul Ackersviller
a5a28a194a reverse my inital changes to put on branch instead 2016-12-18 23:34:58 -05:00
Paul Ackersviller
b46769b181 synced up to latest 2016-12-18 23:30:55 -05:00
Daniel Shahaf
8dbe1209ca Merge remote-tracking branch 'upstream/pr/356'
Fixes #356 (the pull request being merged).
Fixes #245 (the meta-issue for the following redrawhook issues).
Fixes #40.
Fixes #90.
Fixes #150.
Fixes #154.
Fixes #183.
Fixes #377.

* upstream/pr/356:
  test harness: Actually test the new code.
  driver: Rewrite without a state variable
  noop: Make a whitespace-only change to reduce noise in the next commit.
  docs: Rewrap.
  docs: Update FAQ answer per changes on this branch.
  redo _zsh_highlight__function_callable_p
  driver: Use a different way of checking whether add-zle-hook-widget is present.
  changelog: Use a more specific link.
  changelog: Note the effect of fixing #245/#90 and an alternative.
  driver: Pass zle-line-finish arguments on to _zsh_highlight.
  driver: Hook zle-line-finish.
  driver: Reimplement using 'add-zle-hook-widget zle-line-pre-redraw'
  wrappers: Reimplement using Mikachu's zle-line-pre-redraw hook (workers/36650).
2016-10-17 22:43:27 +00:00
Daniel Shahaf
7d38d07255 'main': Followup to fdaeec45146b: Update comment.
That revision was itself a followup to 51614ca2c994.
2016-10-17 20:46:46 +00:00
Daniel Shahaf
efa432241d test harness: Actually test the new code.
Currently, without zsh/zle loaded, the tests silently fall back to the
5.2-and-earlier codepath; see:
.
    https://github.com/zsh-users/zsh-syntax-highlighting/pull/356#issuecomment-243651251
2016-10-17 17:51:04 +00:00
Daniel Shahaf
2cf6a48096 Merge remote-tracking branch 'upstream/master' into upstream/pr/356
* upstream/master:
  'main': Enable fallback to the 'arg0' style.
  'main': Set fallback style for the 'arg0' style.
  dev tools: Automagically handle newlines (\n) in $BUFFER.
  tests: Also test arguments to an anonymous function.
  'main': Directly count spaces to skip, don't leverage proc_buf length
  'main': Highlight several more special (non-alphabetic) parameters.
  'main': Highlight shell's PID ($$) inside double quotes.
  'main': Highlight command substitutions inside double quotes.
  'main': Permit subshells to end at command position.
  'main': Highlight mismatched foreach/end.
  dev tools: Add a TODO to introduce code reuse.
  'main': Highlight mismatched do/done.
  'main': Yet another test for mismatched braces.
  'main' / *_check_path: Precompute $#BUFFER and use it for speed gain
  dev tools: Remove a superfluous empty line.
  'main': Highlight 'always' blocks.
  'main': Don't find command positions within multiline array literals.
  dev tools: Stage the copyright block to make diffs smaller.
  dev tools: Tolerate invalid input.
  'main': Restore compatibility with zsh-4.3.14 and older (after e3182c18de8f).
  dev tools: Automate a recurring step: Set year correctly for new tests.
  'main': Highlight first command word in named functions defined in the sh syntax when MULTI_FUNC_DEF is set.
  'main': More tests for mismstached parentheses and braces.
  'main': Highlight mismatched parentheses and braces.
  driver: Warn just once when a highlighter is missing.
  'main': Support the IGNORE_BRACES option.
  'main': Add tests for the IGNORE_BRACES option.
  'main': Followup to 51614ca2c994: Run cheaper conditions first.
  'brackets': Don't highlight corresponding bracket on accept-line
  driver: Declare global variables
  'main': Avoid triggering a zsh bug related to hashed commands.
  *: error messages: Fix quoting.
  highlighters: Rename entry points.
  driver: Rename highlighter entry points
  driver: Followup to 80148f6c840299f0980f4359ec5307ca63837dff: don't squat on the highlighters' namespace.
  driver: Followup to d711563fe1bf8fa6810bc34ac92a2fd3150290ed: actually make the driver reentrant.
  noop: Rewrap.
  README: Add a reference to upstream's documentation.
  README: Rephrase a question non-negatively^W neutrally.
  noop: Add comments.
  'main': The word after 'sudo' is only a non-command word if it is an option.
  'main': Test for redirection earlier.
  noop: Restructure code for clarity.
  noop: Fix indentation.
  driver: Followup to last: make the value more unique.
  driver: Make it reentrant.
  minor: Fix typo in development usage message.
  driver: Enable highlighting during isearch under zsh≥5.3.
  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
  dev tools: Extend tests/generate.zsh.
  dev tools: Add a script that generates a test-data file.
  'main': Enable test for issue #238.
  'main': Add test for issue #343, concerning the 'command' precommand.
  'main': New test, related to issue #328.
  *: s/echo/print/
  'main': Highlight a broken symlink as a file.
  tests: Add an XFail test for issue #342.
  docs: Minor tweak.
  docs: State highlighters' designated namespace.
  docs: s/myhighlighter/acme/g
  driver: Change a variable name to avoid squatting the highlighters' namespace.
  tests: Add a regression test for issue #267, concerning highlighting a vi linewise region.
  driver: Widget binding: Use ${(k)widgets} instead of $(zle -la)
  Support linewise region.

Conflicts:
	README.md
	zsh-syntax-highlighting.zsh
2016-10-17 17:45:02 +00:00
Daniel Shahaf
5591e2adb1 driver: Rewrite without a state variable
Suggested-by: m0viefreak
2016-10-17 15:13:19 +00:00
Daniel Shahaf
9872a186bc noop: Make a whitespace-only change to reduce noise in the next commit. 2016-10-17 14:49:53 +00:00
Paul Ackersviller
0bac9581bb more ERR trap fixes 2016-10-13 20:54:51 -04:00
Paul Ackersviller
4d0c5604d9 nother error trap to prevent 2016-10-12 23:34:29 -04:00
Paul Ackersviller
8c47e82475 run error at sdf 2016-10-12 21:07:47 -04:00
Paul Ackersviller
b267c7b4e7 Quieten non-zero commands reported by err trap. 2016-10-09 23:47:17 -04:00
Daniel Shahaf
89bf578590 docs: Rewrap. 2016-10-07 14:22:49 +00:00
Daniel Shahaf
29c6834e70 docs: Update FAQ answer per changes on this branch. 2016-10-07 14:21:57 +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
2b303f01b6 dev tools: Automagically handle newlines (\n) in $BUFFER. 2016-09-27 22:55:16 +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
a2876fb57d dev tools: Add a TODO to introduce code reuse. 2016-09-25 11:38:54 +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
5627fd2045 dev tools: Stage the copyright block to make diffs smaller. 2016-09-24 17:07:01 +00:00
Daniel Shahaf
987c133486 dev tools: Tolerate invalid input. 2016-09-24 17:06:21 +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
e15a09840e dev tools: Automate a recurring step: Set year correctly for new tests. 2016-09-23 06:37:28 +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
0a9b347483 driver: Warn just once when a highlighter is missing.
The heretofore code warned once per keypress.
2016-09-22 04:10:28 +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
a8b842bddb redo _zsh_highlight__function_callable_p 2016-09-16 05:12:20 +00:00
Daniel Shahaf
b30e5b593e driver: Use a different way of checking whether add-zle-hook-widget is present.
Based on code by Bart Schaefer (reference within).

Tested with zsh 5.0.7-5 (debian package) and with 5b4cbcc842c6 (39158,
5.3-to-be of today).
2016-09-16 04:25:14 +00:00
Daniel Shahaf
1f8b1755d9 changelog: Use a more specific link. 2016-09-16 04:25:05 +00:00
Daniel Shahaf
487b6bf63d changelog: Note the effect of fixing #245/#90 and an alternative. 2016-09-16 04:25:05 +00:00