Commit Graph

153 Commits

Author SHA1 Message Date
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
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
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
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
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
11c060ab76 test harness: Fix a bug whereby 'todo' state would propagate to all subsequent test points.
Update expectations on the subshell test (which triggered this bug, since it has
a passing test point following a 'todo' test point).
2015-10-23 04:26:51 +00:00
Daniel Shahaf
b2ac98b981 Fix issue #216: test failure with HOME=/nonexistent.
Make the test pass by setting explicitly the global state (existing $HOME) it
depends on.  Test another value of the global state (a non-existing $HOME).
2015-10-23 03:51:06 +00:00
Antony Lee
22c8736e2b Add XFAIL test for issue #160, "subshells highlighted incorrectly". 2015-10-23 03:31:00 +00:00
Daniel Shahaf
c687bddea3 Drop unnecessary shebang lines, part 2.
Follow-up to the last commit.

E: zsh-syntax-highlighting: missing-dep-for-interpreter zsh => zsh | zsh-beta (usr/share/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh)
W: zsh-syntax-highlighting: executable-not-elf-or-script usr/share/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh
2015-10-20 12:06:07 +00:00
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
2015-10-20 11:49:51 +00:00
Daniel Shahaf
e138cfd765 command word: Protect against the case that the command word starts with a minus. 2015-10-02 13:27:21 +00:00
Daniel Shahaf
07fd773d7e noop: Add comments. 2015-09-30 01:26:27 +00:00
Daniel Shahaf
5cd1fb26c0 Resolve tilde expansions in command word.
This causes '~/bin/foo' to highlight as a command, rather than as a file.

Part of issue #201.
2015-09-30 00:49:34 +00:00
Daniel Shahaf
faed2fa49e internal: Fix docstrings. 2015-09-29 23:45:44 +00:00
Daniel Shahaf
69203b1a1d Don't highlight escaped globbing.
Fixes zsh-users/zsh-syntax-highlighting#193.
2015-09-29 23:44:57 +00:00
Daniel Shahaf
800158745a Highlight quoted command words correctly.
Fixes zsh-users/zsh-syntax-highlighting#147.
2015-09-28 19:49:39 +00:00
Daniel Shahaf
7b4598a764 Highlight arithmetic expansions.
Fixes zsh-users/zsh-syntax-highlighting#188 in the case that both the
opening '((' and closing '))' have been typed,  The case that only the
opening '((' have been typed is also fixed, but requires a zsh development
build (zsh-5.1.1-52-g4bed2cf or newer); see comments within.
2015-09-28 13:55:38 +00:00
Daniel Shahaf
52a2ef644b Don't highlight escaped globbing.
Fixes zsh-users/zsh-syntax-highlighting#193.
2015-09-27 16:28:32 +00:00
Daniel Shahaf
6488284814 back-dollar-quoted-argument: Highlight incomplete escape sequences as unknown-token
Followup to 219184f046, which fixed issue #196.
2015-09-27 15:59:04 +00:00
Daniel Shahaf
f657406159 minor: Fix comment in last ocmmit. 2015-09-26 18:59:16 +00:00
Daniel Shahaf
8b728522de Add test for empty commands.
Related to issue #205.
2015-09-26 18:28:56 +00:00
Daniel Shahaf
79e8c2dd48 Don't highlight syntax elements as paths.
Without this, redirections, history expansions, and command separators would
be matched by path_approx.

A test case is simply LBUFFER="<" RBUFFER="" (highlighted as redirection with this
fix and as path_approx without it).

Fixes zsh-users/zsh-syntax-highlighting#204.
2015-09-26 18:28:48 +00:00
Daniel Shahaf
4ec821b2b1 Highlight redirections.
Fixes zsh-users/zsh-syntax-highlighting#23.

* danielsh/i23-highlight-redirections:
  Highlight redirections.
2015-09-26 17:58:07 +00:00
Daniel Shahaf
6732783d46 back-dollar-quoted-argument: Correct an off-by-one.
Highlight the last character of a «\xHH» escape when it is the last thing in
LBUFFER.  This is similar to what b0cc02ed86 did
for issue #186.
2015-09-26 01:09:37 +00:00
Daniel Shahaf
0788514cbd back-dollar-quoted-argument: Correct octal escape syntax.
A leading zero, as in '\0NNN', is permitted by 'echo' but not by 'print',
and «$''» follows 'print'.
2015-09-25 21:54:37 +00:00
Daniel Shahaf
8a43bd2cd9 back-dollar-quoted-argument: Highlight \uHHHH and \UHHHHHHHH escapes. 2015-09-25 21:45:38 +00:00
Daniel Shahaf
98366ade11 back-dollar-quoted-argument: Don't consider \0xHH a hex escape sequence.
A leading zero is not permitted in the '\xHH' syntax.
2015-09-25 21:45:38 +00:00
Daniel Shahaf
78ad649d47 back-dollar-quoted-argument: Don't consider comma a hex character.
Character class syntax does not ignore commas between ranges.
2015-09-25 21:45:38 +00:00
Daniel Shahaf
69fcb40275 Highlight backslash escapes within $'' strings.
Correct highlighting of backslash escapes within "" strings: highlight only
the four specific escape sequences defined there.

Fixes zsh-users/zsh-syntax-highlighting#196.
2015-09-25 21:45:38 +00:00
Daniel Shahaf
f4164ac86c internal: Document a function-local variable. 2015-09-25 21:22:09 +00:00
Daniel Shahaf
9c7a1109c8 WARN_CREATE_GLOBAL: don't leak the arithmetic for loop's index variable.
Found by code inspection; WARN_CREATE_GLOBAL missed this.
2015-09-25 20:57:51 +00:00
Daniel Shahaf
040df93c01 Highlight redirections.
Fixes zsh-users/zsh-syntax-highlighting#23.
2015-09-25 12:42:34 +00:00
Daniel Shahaf
66eb801358 dollar-double-quoted-argument: Handle «"foo$"» correctly. 2015-09-24 19:03:17 +00:00
Daniel Shahaf
b0cc02ed86 dollar-double-quoted-argument: Highlight "$foo" better.
Now, «"$42foo"» doesn't highlight the «foo», and «"$bar» highlights the «r».
2015-09-24 19:03:00 +00:00
Daniel Shahaf
908c4fe150 Stop leaking variables into global namespace.
Set WARN_CREATE_GLOBAL to prevent recurrence.

Fixes zsh-users/zsh-syntax-highlighting#192.
2015-09-24 18:01:06 +00:00