Commit graph

398 commits

Author SHA1 Message Date
Daniel Shahaf
dd12dde93a Fix errors with non-reserved-word typeset.
Follow-up to 908c4fe150.

Intended to fix fix zsh-users/zsh-syntax-highlighting#206.
2015-09-25 17:53:22 +00:00
Daniel Shahaf
cb5589db73 Don't wrap set-local-history.
See issue #137.  A reproduction recipe for testing this change:

$ zsh -f
% bindkey -e
% source <the script from http://www.zsh.org/mla/users/2014/msg00321.html users/18584>
% source zsh-syntax-highlighting.zsh
% echo foo
% echo bar
% <^R>echo<^R>

This finds the 'echo foo' with this change but not without it.
2015-09-25 15:35:03 +00:00
Daniel Shahaf
35c4bb7bdc More WARN_CREATE_GLOBAL cleanups.
Followup to 908c4fe150.
Found by test-perfs.zsh.
2015-09-25 13:04:37 +00:00
Daniel Shahaf
040df93c01 Highlight redirections.
Fixes zsh-users/zsh-syntax-highlighting#23.
2015-09-25 12:42:34 +00:00
Daniel Shahaf
86cd337446 README: Document release announcements.
Thanks to tibbs@fedora for setting up anitya.
2015-09-24 23:00:05 +00:00
Daniel Shahaf
c43dc8bd44 dollar-double-quoted-argument: Two patches.
* danielsh/i186-dollar-dquote:
  dollar-double-quoted-argument: Handle «"foo$"» correctly.
  dollar-double-quoted-argument: Highlight "$foo" better.
2015-09-24 19:04:49 +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
4ec0c6d7a7 README: Expand the at-end-of-.zshrc FAQ answer.
Fixes zsh-users/zsh-syntax-highlighting#185.
2015-09-24 18:45:35 +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
Daniel Shahaf
1467eae86d Bump copyright years, part 2. 2015-09-24 16:48:27 +00:00
Daniel Shahaf
9e80fe8f02 Bump copyright years. 2015-09-24 16:46:28 +00:00
Daniel Shahaf
001e6cb404 tests: Cover 'back-quoted-argument'.
This is part of issue zsh-users/zsh-syntax-highlighting#198.
2015-09-23 15:41:17 +00:00
Daniel Shahaf
22fa215e05 Fixup last commit.
* highlighters/main/test-data/hashed-command.zsh:
    Set the right region key.  This makes the test more specific.
    (Issue #184 would have caught this bug.)
2015-09-23 15:39:53 +00:00
Daniel Shahaf
845361ef3d tests: Cover 'hashed-command'.
This is part of issue zsh-users/zsh-syntax-highlighting#198.
2015-09-23 15:35:56 +00:00
Daniel Shahaf
4594d8b7ec Merge remote-tracking branch 'danielsh/i199-semicolon-v1'
* danielsh/i199-semicolon-v1:
  Fix regression: Highlight ';' as commandseparator.
  Follow-up to 547b8be304: Fix $observed_result calculation.

Fixes zsh-syntax-highlghting/zsh-users#199.
2015-09-23 15:23:25 +00:00
Daniel Shahaf
5fb4cb2f72 Fix regression: Highlight ';' as commandseparator.
This was broken by c2b9327b07
and tracked as zsh-users/zsh-syntax-highlighting#199.

This fixes the vanilla-newline.zsh test, which was was (consciously) broken
by the previous commit.
2015-09-23 14:50:22 +00:00
Daniel Shahaf
f7cb4741d6 Followup to previous: Extend the 'alias' test. 2015-09-18 22:04:07 +00:00
Daniel Shahaf
81c8d78d12 tests: Cover 'alias' and 'suffix-alias'.
This is part of issue zsh-users/zsh-syntax-highlighting#198.
2015-09-18 21:42:22 +00:00
Daniel Shahaf
8767e0ef66 tests: Cover 'reserved-word'.
This is part of issue zsh-users/zsh-syntax-highlighting#198.
2015-09-18 20:38:32 +00:00
Daniel Shahaf
b056f592f2 tests: Cover 'path_prefix'.
This is part of issue zsh-users/zsh-syntax-highlighting#198.
2015-09-18 20:21:19 +00:00
Daniel Shahaf
e0a7ddb6ec tests: Cover 'history-expansion'.
This is part of issue zsh-users/zsh-syntax-highlighting#198.
2015-09-18 20:01:10 +00:00
Daniel Shahaf
416934202e tests: Cover 'single-quoted-argument', 'double-hyphen-option', and 'function'.
This is part of issue zsh-users/zsh-syntax-highlighting#198.
2015-09-18 19:21:21 +00:00
Daniel Shahaf
627eb71940 tests: Use $unused_highlight in more places.
Notably, the 'single-hyphen-option' and 'assign' contexts both default to the
'none' style, so before this patch, the tests would not have detected a failure
to apply those two contexts.

For other contexts, using $unused_highlight only helps detect the case where
the right highlight style (e.g., 'fg=yellow') is used as a result of applying
the wrong context — which should be a theoretical failure mode.

This is part of zsh-users/zsh-syntax-highlighting#198.
2015-09-18 18:44:45 +00:00
Daniel Shahaf
00862cf4fa Followup to e5c2a88db0 (merged in 51102bf83f):
Have widgets return EXIT_SUCCESS.
2015-09-18 12:38:24 +00:00
Daniel Shahaf
aab1b8f50f Follow-up to 547b8be304: Fix $observed_result calculation.
In region_highlight, a spec of the form 'i j foo' with i >= j should have no effect.
Before this commit, however, the {$i..$j} range would happily expand to (5 4 3)
if i > j were the case (e.g., i=5 and j=3).

This breaks vanilla-newline.zsh; the next commit will fix that.
2015-09-17 23:40:20 +00:00
Daniel Shahaf
4068413dfe tests: Let each test change the highlight styles.
This way, each test can set custom styles to specific highlight contexts
(to differentiate those contexts) without affecting later tests.
2015-09-17 23:35:44 +00:00
Daniel Shahaf
404d498e1d tests: vanilla-newline.zsh: Fix expectations 2015-09-17 23:33:56 +00:00
Daniel Shahaf
05ab9f7342 tests: Run only *.zsh files.
Otherwise, *.rej patch files would be run by zsh, with unpredictable results.
2015-09-17 20:11:05 +00:00
Daniel Shahaf
0d3a5dadea tests: Add test for escape sequences in double-quoted strings 2015-09-17 20:01:46 +00:00
Daniel Shahaf
51102bf83f Highlight the region and yanks and pastes on top of syntax highlighting.
Fixes zsh-users/zsh-syntax-highlighting#165.
Fixes zsh-users/zsh-syntax-highlighting#175.

* danielsh/i165-region-v1:
  Highlight yanks/pastes on top of syntax highlighting.
  Highlight the region on top of syntax highlighting.
2015-09-17 19:21:25 +00:00
Daniel Shahaf
186536705b tests: path-tilde-named.zsh: Fix expectations
The path string ends at offset 26, not 23.
2015-09-17 19:09:33 +00:00
Daniel Shahaf
547b8be304 test harness: Fix off-by-one discrepancy between observed and expected.
Fixes zsh-users/zsh-syntax-highlighting#195.

The one revision made on master between this branch's creation and merge
already uses correct offsets.

* danielsh/i195-tests-offbyone-v1:
  New test for dollar-double-quoted-argument.
  test harness: Fix off-by-one discrepancy between observed and expected.
2015-09-17 19:08:29 +00:00
Daniel Shahaf
80587e5419 New test for dollar-double-quoted-argument.
This exercises the previous patch.
2015-09-12 20:48:25 +00:00
Daniel Shahaf
c46b8d169e test harness: Fix off-by-one discrepancy between observed and expected.
Fixes issue #195.
2015-09-12 20:48:25 +00:00
Daniel Shahaf
a8afbdf2f5 Support $''-quoted strings.
This does not yet highlight backslash escapes within them.
2015-09-10 20:02:39 +00:00
Daniel Shahaf
6d93ea07fd main highlighter docs: README: Tweak. 2015-09-10 19:46:01 +00:00
Daniel Shahaf
4f5a0fe60b main highlighter docs: Give examples of styles. 2015-09-10 19:44:19 +00:00
Daniel Shahaf
e5c2a88db0 Highlight yanks/pastes on top of syntax highlighting.
Let $zle_highlight[paste] override $region_highlight.
2015-09-10 19:31:36 +00:00
Daniel Shahaf
0e31d6e1a2 Highlight the region on top of syntax highlighting.
Let $zle_highlight[region] override $region_highlight.
2015-09-08 20:22:22 +00:00
Daniel Shahaf
555e142e66 suffix aliases: Highlight differently.
Add an underline, since they are at command word position but will be executed
by something else.

Suggested-by: Daniel Hahler
2015-09-08 10:13:16 +00:00
Daniel Shahaf
e13c5a1611 Highlight 'noglob' correctly in more cases.
Fixes zsh-users/zsh-syntax-highlighting#189.
2015-09-07 18:07:59 +00:00
Daniel Shahaf
8515b7e0c5 Highlight ? as globbing.
Fixes zsh-users/zsh-syntax-highlighting#94.
2015-09-07 18:05:56 +00:00
Daniel Shahaf
dc701501e5 Highlight ? as globbing.
Fixes zsh-users/zsh-syntax-highlighting#94.
2015-09-07 18:03:14 +00:00
Daniel Shahaf
9310d8ae71 Support suffix aliases
Fixes zsh-users/zsh-syntax-highlighting#126.
2015-09-07 17:59:52 +00:00
Daniel Shahaf
b3ceea8511 Highlight 'noglob' correctly in more cases.
Fixes zsh-users/zsh-syntax-highlighting#189.
2015-09-07 09:09:17 +00:00
Daniel Shahaf
a0b5bc6c71 Fix bug in previous commit (d330b49b33)
'local' is a reserved word in zsh 5.1 but not in earlier versions [1].
Therefore, under zsh older than 5.1, quoting is required.

This manifested as random «builtin=''» in emitted to the terminal, and
commands (such as 'echo') highlighted as errors (in red).

[1] https://github.com/zsh-users/zsh/blob/master/README#L46
    (the section "Incompatibilites between 5.0.8 and 5.1")
2015-09-07 01:26:11 +00:00
Daniel Shahaf
d330b49b33 Fix variable leakage into global namespace.
Similar to zsh-users/zsh-syntax-highlighting#97.
2015-09-06 19:20:49 +00:00
Daniel Shahaf
f78919d941 Preserve $? of wrapped widgets. 2015-09-05 21:44:11 +00:00
Daniel Shahaf
eaffd88793 docs: Document homebrew package name.
Fixes zsh-users/zsh-syntax-highlighting#156.
2015-09-05 19:21:52 +00:00