Commit Graph

411 Commits

Author SHA1 Message Date
Daniel Shahaf
1ac39b0af1 comments: Mark prematurely-terminated command as an error.
This is already done for commands prematurely terminated by ";".
2015-10-30 08:38:45 +02:00
Daniel Shahaf
693de99a90 comments: Fix issue #163 and #167: Highlight comments. 2015-10-30 08:38:44 +02:00
Daniel Shahaf
e76f208cf8 comments: Add a PASSing test for the NO_INTERACTIVE_COMMENTS case. 2015-10-30 08:38:39 +02:00
Daniel Shahaf
e9ceb2017e comments: Add XFail tests from issues #163 and #167.
These tests are based on the patches contributed in those issues:

    commit 9d9df4fe80 (upstream/pr/167)
    Author:     Miciah Masters <miciah.masters@gmail.com>
    AuthorDate: Thu Apr 23 20:28:24 2015 -0400
    Commit:     Miciah Dashiel Butler Masters <mmasters@redhat.com>
    CommitDate: Thu Apr 23 20:28:24 2015 -0400

        Highlight comments

    M       highlighters/main/main-highlighter.zsh
    A       highlighters/main/test-data/comments.zsh

    commit d94f1a037f (upstream/pr/163)
    Author:     sonnym <michaud.sonny@gmail.com>
    AuthorDate: Fri Mar 6 18:27:57 2015 -0500
    Commit:     sonnym <michaud.sonny@gmail.com>
    CommitDate: Fri Mar 6 21:16:27 2015 -0500

        highlight comments when interactive_comments is on

    M       highlighters/main/main-highlighter.zsh
    A       highlighters/main/test-data/comment-embedded.zsh
    A       highlighters/main/test-data/comment-leading.zsh

Patch-by: sonnym <michaud.sonny@gmail.com>
Patch-by: Miciah Masters <miciah.masters@gmail.com>
(corrected and refreshed for harness changes by me)
2015-10-29 18:08:30 +02:00
Daniel Shahaf
2f05620b19 sudo: Flag an error when a required argument is missing. 2015-10-29 12:01:13 +00:00
Daniel Shahaf
9cb87473cc sudo: Tweak state computations.
This causes the ':start:' state to be set in $next_word in iteration N-1,
rather than to only be added to $this_word in iteration N.
2015-10-29 12:01:13 +00:00
Daniel Shahaf
f49f3bf0c0 sudo: Extend tests. 2015-10-29 12:01:13 +00:00
Daniel Shahaf
a3047a9121 sudo: Highlight an empty sudo; as an error.
The word following 'sudo' was considered :regular:, although it isn't.
2015-10-29 12:01:13 +00:00
Daniel Shahaf
86e9249709 sudo/redirections: Fix remaining part of issue #221, "sudo and redirection don't mix". 2015-10-29 12:01:13 +00:00
Daniel Shahaf
0d1bfbcbfa Highlight subshells and anonymous functions correctly.
Fixes zsh-users/zsh-syntax-highlighting#166.
Fixes zsh-users/zsh-syntax-highlighting#194.
Builds upon the issue #207 work.
2015-10-29 12:01:13 +00:00
Daniel Shahaf
c216242b46 command word: Highlight more reserved words. Part of issue #207. 2015-10-29 12:01:13 +00:00
Daniel Shahaf
2218e26bf8 command word: Highlight 'else' correctly. Part of issue #207. 2015-10-29 12:01:13 +00:00
Daniel Shahaf
b397b12ac1 command word: Start fixing issue #207, "Word following certain reserved words should be a command word". 2015-10-29 12:01:13 +00:00
Daniel Shahaf
87deac3062 command word: Add an XFail test for issue #207. 2015-10-29 12:01:13 +00:00
Daniel Shahaf
01d7eeb3c7 Fix issue #205, "';' after assignment is highlighted as unknown-token". 2015-10-29 12:01:13 +00:00
Daniel Shahaf
6d6fb8b03e redirections: Document handling of redirections and possibly fix a latent bug.
The change of behaviour is triggered by test-data/sudo-redirection.zsh: the iteration
on "otheruser" sets $next_word to ":regular::sudo_opt::start::sudo_opt::start:" before
this patch, but to ":regular::sudo_opt::start:" after it (note the deduplication).
2015-10-29 12:01:13 +00:00
Daniel Shahaf
be006aded5 sudo/redirections: Fix part of issue #221, "sudo and redirection don't mix". 2015-10-29 12:01:11 +00:00
Daniel Shahaf
c6355a31b7 Followup to last: re-fix issue #9 and add test for it.
The fix for issue #9 was accidentally broken by the penultimate commit.

Note that we don't care about aliases to ZSH_HIGHLIGHT_TOKENS_COMMANDSEPARATOR
entries, since the code deals with aliases at command position.
2015-10-29 12:01:11 +00:00
Daniel Shahaf
018bc45f21 Followup to last: tighten the fix and ask a question. 2015-10-29 12:01:11 +00:00
Daniel Shahaf
2c9f8c8c95 Fix issue #209, "precommand modifiers at non-command-word position". 2015-10-29 12:01:11 +00:00
Daniel Shahaf
88cf98d9c4 states work: Documents the various states. 2015-10-29 12:01:11 +00:00
Daniel Shahaf
0aa6a5db78 states work: Convert $new_expression parsing. 2015-10-29 12:01:11 +00:00
Daniel Shahaf
10b1da64e6 states work: Convert sudo parsing. 2015-10-29 12:01:11 +00:00
Daniel Shahaf
80d692c400 command word: Add an XFail test for issue #194, "Highlight anonymous functions". 2015-10-29 12:01:11 +00:00
Daniel Shahaf
e49251b6fa sudo/redirections: Add two XFail tests for issue #221, "sudo and redirection don't mix". 2015-10-29 12:01:09 +00:00
Daniel Shahaf
2080a441ac minor: Remove redundant setting of $highlight_glob. 2015-10-28 09:58:13 +02:00
Daniel Shahaf
59fbdda64c main: Refresh highlighting upon accept-* widgets (accept-line et al).
Use this to remove [path_prefix] highlighting during accept-* widgets.
This causes ": file.tx<CR>" to remove the underline from "file.tx", like
": file.tx<SPACE>" already does.  (Assume 'file.txt' exists.)
2015-10-28 09:24:08 +02:00
Daniel Shahaf
7723edf4f5 Add an XFail test for accept-line semantics. 2015-10-28 08:30:05 +02:00
Daniel Shahaf
c808d2187a wrapping: Don't add '--' when invoking widgets.
It's the widget's caller's responsibility, not ours, to add '--' where due.  If
we do it, two instances of '--' might result.  (I haven't been able to provoke
this problem.)

If this commit causes problems, the cause would be widget-callers that don't
pass '--' although they should.
2015-10-28 08:30:05 +02:00
Daniel Shahaf
7e6d960a08 noop: Break out a helper function. 2015-10-28 08:30:05 +02:00
Daniel Shahaf
feec9f58c9 Followup to last: Fix issue number in comment. 2015-10-27 13:38:40 +02:00
Daniel Shahaf
ed6d229b1c Add XFail test for issue #208, 'precommand modifiers at non-command-word position'. 2015-10-27 12:33:11 +02:00
Daniel Shahaf
fb5ce43799 noop: Rename a local variable for clarity. 2015-10-27 11:59:25 +02:00
Daniel Shahaf
6fe07c0961 'make test': Fix breakage introduced by 4d3da30f8b726c6e0eeb3adda06adc9eaa329b3b:
test failure would not be reflected by the exit code of 'make'.

Setting a shell parameter in the left-hand side of a pipe is not visible to
commands after the pipe, because the left-hand side forks.  (That's true both
in 'sh' used by 'make' and in 'zsh' that runs tests/test-highlighting.zsh, at
least on my system.)  Therefore, move the colorizing hook to where it doesn't
interfere with setting the $something_failed (in tests/test-highlighting.zsh)
and $result (in Makefile) parameters.
2015-10-27 11:59:20 +02:00
Daniel Shahaf
4513eaea71 'make perf': New target. 2015-10-27 09:47:09 +02:00
Daniel Shahaf
9816fcf055 redirections: Test an infix redirection. 2015-10-27 05:20:24 +00:00
Daniel Shahaf
871af68082 sudo: Extend test to cover all codepaths. 2015-10-27 05:09:13 +00:00
Daniel Shahaf
7d45f3e3ec changelog: Update through HEAD (98aee7f8b9). 2015-10-27 07:00:39 +02:00
Daniel Shahaf
98aee7f8b9 Remove path_approx.
Fixes zsh-users/zsh-syntax-highlighting#187.
Adds a test for zsh-users/zsh-syntax-highlighting#204.
2015-10-27 04:29:05 +00:00
Daniel Shahaf
4d3da30f8b 'make test': Colorize output.
Color is only added when "make test"'s stdout is a tty.
2015-10-26 14:31:21 +00:00
Daniel Shahaf
557bb7e0c6 'make test': Allow specifying the zsh binary to use. 2015-10-26 14:18:54 +00:00
Daniel Shahaf
57624bb9f6 Add screenshot.
preview-smaller.png is derived from preview.png by 50% downscaling.

Prior art: 66c18e6b71
2015-10-24 10:59:20 +00:00
Daniel Shahaf
663c760cc9 minor: test harness: Convert some global failure modes to TAP "Bail out" mode. 2015-10-23 05:34:15 +00:00
Daniel Shahaf
20d106bd4d noop: Associate an XFAIL test with its issue. 2015-10-23 04:57:05 +00:00
Daniel Shahaf
d66113c1ed Add XFAIL test for issue #205, "';' highlighted as unknown-token". 2015-10-23 04:56:02 +00:00
Daniel Shahaf
728ed66ff9 Fix copyright year.
Followup to b2ac98b981.
2015-10-23 04:53:06 +00:00
Daniel Shahaf
8b8b19d91f test harness: Fix a bug with empty actual or expected results.
Fixes zsh-users/zsh-syntax-highlighting#217.
2015-10-23 04:48:16 +00:00
Daniel Shahaf
a18a7427fd README: Document 'make install'.
Fixes zsh-users/zsh-syntax-highlighting#218.
2015-10-23 04:45:18 +00:00
Daniel Shahaf
187371a459 chamgelog: Update through HEAD 2015-10-23 04:44:39 +00:00
Daniel Shahaf
c4a9fe9379 test harness: Exit 1 if a 'todo' test passed. 2015-10-23 04:30:00 +00:00