Commit graph

204 commits

Author SHA1 Message Date
Austin Traver b00be5f741 driver: Be resilient to KSH_ARRAYS being set in the calling scope
The «emulate» call isn't sufficient, since these lines are parsed before
it takes effect.

Fixes #689 (née #622).

See also #688 for preventing these gymnastics from being needed in the
first place.

See also https://github.com/junegunn/fzf/pull/1924 for an inter-plugin
interaction that this probably fixes.
2020-03-13 16:18:07 +00:00
Daniel Shahaf 4a043b4d15 noop: Whitespace changes only.
./.editorconfig is already set correctly.
2020-02-22 15:12:24 +00:00
Oliver Kiddle be3882aeb0 driver: adjust region end for vi command mode 2019-10-17 21:18:56 +00:00
Matthew Martin b55832c5f8 main: Drop X_ from X_ZSH_HIGHLIGHT_DIRS_BLACKLIST 2019-07-24 07:27:54 -05:00
Matthew Martin 972ad197c1 driver: Disable BASH_REMATCH
Fixes #612.
2019-04-14 08:26:03 -05:00
dana 55f846c673 driver: Avoid warn_create_global warnings 2018-12-20 12:48:14 +00:00
Julien Nicoulaud 3a7ddcda0b
#535: locally enable BARE_GLOB_QUAL option when loading highlighters 2018-09-22 22:50:46 +02:00
Adam Johnson 42d396d819 driver: Exclude yank-pop again (#183). 2018-09-07 18:21:53 +00:00
Bengt Brodersen db6cac391b main: Add glob qualifier to work around zsh/macOS bug
zsh/macOS bug: http://www.zsh.org/cgi-bin/mla/redirect?WORKERNUMBER=42891
2018-06-03 08:43:02 +02:00
Matthew Martin 2c0c75a8ee driver, main: Add -z to autoload calls 2018-03-06 11:35:40 -06:00
Matthew Martin ff85c7e01b driver: Do not highlight newlines or past BUFFER for zle standout 2018-02-10 13:24:49 -06:00
Matthew Martin 84f0507cf6 driver: Replace eval with ${(P) 2018-02-10 13:24:49 -06:00
Matthew Martin b07ada1255 driver: Run under emulate -L zsh and add zsyh_user_options 2017-12-16 09:33:51 -06:00
Daniel Shahaf e4352f98bb driver: Revert previous commit, unbreaking the build on zsh<5.0.8. 2017-11-05 15:58:58 +00:00
Daniel Shahaf 9d9e9662cf driver: Correctly escape assoc key pattern 2017-11-05 14:38:05 +00:00
Matthew Martin a9ce931439 Default possibly unset variables to empty 2017-11-04 20:26:07 -05:00
Daniel Shahaf a2a899b41b driver: _zsh_highlight_bind_widgets: Be resilient to NO_UNSET being set in the calling scope.
Fixes #449.
2017-11-02 17:07:10 +00:00
m0viefreak 3c43da5ffe driver: Improve comment about ^r pattern match bug
The bug is not specific to 5.3.1.
2017-07-30 19:08:21 +02:00
m0viefreak f2ba507bbc driver: Adjust zsh version for probing for pattern match bug 2017-07-30 19:08:21 +02:00
jsoizo ad522a0914 driver: Fix printing error message to file when cannot resolve highlighters directory location
Fixes #426.

Review-by: Matthew Martin, me
2017-04-09 16:47:42 +00:00
Daniel Shahaf 462779629a driver: Workaround pattern isearch bug in zsh ≤ 5.3.1, already fixed upstream.
Merge remote-tracking branch 'upstream/pr/415'

* upstream/pr/415:
  workaround for PAT_STATIC bug in zsh
2017-03-29 09:18:59 +00:00
Daniel Shahaf be083d7f37 driver: Improve «unhandled ZLE widget 'foo'» error message.
Fixes #409.
2017-03-05 14:38:52 +00:00
Christian Höltje 835fec7f3c workaround for PAT_STATIC bug in zsh
ZSH versions less than 5.3.2 (or 5.4) have a bug that prevents
`history-incremental-pattern-search-backward` for working
correctly (the history stops searching after the first found item).

Closes #407
2017-02-09 17:58:36 -05:00
vinter aac4a44238 driver: Fix duplicated slash in error message
Fixes #400.
2016-12-16 10:20:04 +00:00
Daniel Shahaf 74949c2d91 driver: Don't undefine aliases that begin with a '+', to workaround an upstream bug.
Fixes #392.
2016-12-03 13:54:47 +00:00
Daniel Shahaf 8d5afe47f7 driver: Be immune to 'alias' having been redefined. 2016-12-01 09:06:32 +00:00
Daniel Shahaf 2dce602727 driver: Be immune to weird aliases in the calling scope.
Fixes #390.
2016-11-11 08:35:19 +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
Alyssa Ross da60234fb2 driver: Declare global variables
This caused warnings with `setopt warn_create_global`.
2016-08-31 16:26:09 +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 11c9081967 *: error messages: Fix quoting. 2016-08-16 19:01:25 +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 a3d5dfcbda driver: Rename highlighter entry points
This updates the docs and the driver, in a manner backwards compatible with
existing highlighters.  (None of the highlighters are touched by this change,
yet tests continue to pass.)

Part of issue #329.
2016-08-16 17:51:43 +00:00
Daniel Shahaf f91a7b885e driver: Followup to 80148f6c840299f0980f4359ec5307ca63837dff: don't squat on the highlighters' namespace. 2016-08-16 17:49:18 +00:00
Daniel Shahaf f3242cbd6a driver: Followup to d711563fe1bf8fa6810bc34ac92a2fd3150290ed: actually make the driver reentrant.
Re-fixes #305.
2016-08-16 17:22:39 +00:00
Daniel Shahaf 295d62ec88 driver: Followup to last: make the value more unique.
Part of issue #305.
2016-08-12 09:43:54 +00:00
Daniel Shahaf d711563fe1 driver: Make it reentrant.
This fixes an infinite recursion in zsh without zle-line-pre-redraw [≤5.2] in
the following situation:

% source zsh-syntax-highlighting.zsh
% eval "my-self-insert() { zle -M 'foobar'; ${(q)widgets[self-insert]#*:} \"\$@\" }"
% zle -N self-insert my-self-insert
% source zsh-syntax-highlighting.zsh

Fixes #305.
2016-08-12 09:19:36 +00:00
m0viefreak 4ad311ec0a driver: Enable highlighting during isearch under zsh≥5.3.
This patch causes a behaviour difference in the [i257] scenario:

- Before this change, the zle_highlight[isearch] is applied and z-sy-h's
  highlighting isn't.

- With this change, both zle_highlight[isearch] and z-sy-h's
  highlighting are applied, so «echo foo» renders the first word in green
  underline (fg=green from ZSH_HIGHLIGHT_STYLES[builtin], underline from
  zle_highlight[isearch]).

This patch causes the presuppositional FAQ entry added in
a8fe22d422 to be correct.

This is part of #261, of which #288 was a spin-off.

[i257] https://github.com/zsh-users/zsh-syntax-highlighting/pull/257#issuecomment-168394665
2016-07-30 20:08:12 +00:00
m0viefreak a8fe22d422 driver: Don't highlight in isearch
zsh version 5.2 and lower don't support ISEARCHMATCH_ACTIVE and
we are unable to re-apply zle_highlight on top. Therefore it is
impossible to see the underlined matched area.

Since that information is more important, completely disable
highlighting in isearch in that case.

To do that, we need to make sure we are actually called when
something changes in isearch.

Trumps #257.

The FAQ entry presupposes #245 will be fixed (in time for the release) too.
2016-07-29 21:07:48 +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
m0viefreak 9e569bb0fe driver: Widget binding: Support binding incomplete/nonexistent widgets 2016-07-29 20:41:06 +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 3e59ab41b6 driver: Change a variable name to avoid squatting the highlighters' namespace.
Part of issue #329.
2016-07-12 06:50:49 +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
m0viefreak b9112aec79 driver: Widget binding: Use ${(k)widgets} instead of $(zle -la)
Avoids a fork.
2016-06-20 18:37:11 +00:00
Daniel Shahaf 750aebc553 driver: Stop requiring function_argzero.
Instead, use the %N prompt expando, as suggested by Bart in users/21637.

Avoid the `print -P %N` syntax to save a fork on Cygwin, at the expense
of not supporting zsh's from 2001 through c. 2004 vintages.

Fixes #338.
2016-06-10 15:18:46 +00:00
Daniel Shahaf 4b77af73fb minor: Fix typo in comment.
Two instances.
2016-06-03 08:41:45 +00:00
m0viefreak 3ce01076b5 driver: load zsh/parameter if available 2016-05-13 02:24:57 +00:00
Daniel Shahaf a7a7f8b422 Support linewise region.
Fixes #267.
2016-05-09 04:10:02 +00:00
Daniel Shahaf 15db71abd0 driver: Track rename of an unreleased upstream API.
ISEARCH_ACTIVE was renamed ISEARCHMATCH_ACTIVE in workers/38921
(commit f06be0ffcf2c to zsh itself).

Fixes #299.
2016-05-09 03:38:27 +00:00