1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-26 05:51:08 +02:00
Commit graph

109 commits

Author SHA1 Message Date
Oliver Kiddle
05c7b21e2b 52646: extend support for highlight groups to completion explanation strings and WATCHFMT 2024-03-05 00:11:02 +01:00
Oliver Kiddle
14c230dc32 52533: add module to provide alternate readonly views of the content of .zle.hlgroups 2024-02-15 14:48:04 +01:00
Mikael Magnusson
653be0823d 52517: ensure that %H is followed by {
The previous code would accept any character after %H assuming it
was a {, which was probably also a buffer overrun sometimes.
2024-02-04 16:48:44 +01:00
Mikael Magnusson
ec446a6f34 52516: fix crash in %H when hlgroups is empty
typeset -A .zle.hlgroups; print -P %H
2024-02-04 16:48:02 +01:00
Oliver Kiddle
85545af42b 52500: add layer token to zle attributes
This provide control over the precedence of highlighting where
different regions overlap.
2024-01-28 00:47:36 +01:00
Oliver Kiddle
3c5dacd503 52499: support highlight groups
These are defined in a .zle.hlgroups associative array and referenced
using %H in prompt strings or hl= in zle_highlight/region_highlight.
2024-01-28 00:34:21 +01:00
Oliver Kiddle
be2c91bbc3 51291: support for highlighting ellipses in the line editor 2023-01-10 21:13:52 +01:00
Oliver Kiddle
cc672f1c3b 51289: don't disable non-colour attributes in prompts for SINGLE_LINE_ZLE and remove superfluous extra escapes to disable attributes 2023-01-10 21:06:55 +01:00
Oliver Kiddle
c01479a2ed 51280: add support for italic and faint fonts in the line editor 2023-01-10 20:57:03 +01:00
Oliver Kiddle
667ead3a64 51258, 51272: refactor handling of terminal attributes, removing OFF flags in zattr 2023-01-10 20:53:17 +01:00
Oliver Kiddle
a73c705b0c 51212: remove STOUC() macro
This served as a workaround for ancient compilers where casts to
unsigned char were broken.
2022-12-16 23:28:10 +01:00
Peter Stephenson
c5a891a29d 50049: care with signed characters
Some signed-to-unsigned casts needed for a couple of cases of pointers
used as indices.
2022-04-25 17:51:59 +01:00
Oliver Kiddle
c3ea1e5d52 security/41: Don't perform PROMPT_SUBST evaluation on %F/%K arguments
Mitigates CVE-2021-45444

(cherry picked from commit c187154f47)
2022-02-12 10:29:55 -06:00
Oliver Kiddle
91b7baf259 49646: allow colors in WATCHFMT with %F/%K 2021-12-13 21:06:57 +01:00
Oliver Kiddle
0721060f36 47510: drop code that avoided termcap for named colours
The inconsistency caused test failures where TERM is e.g. rxvt-unicode.
This also makes a couple of bits available in zattr by removing flags
indicating whether to use termcap which is not an attribute as such.
2021-04-03 00:58:45 +02:00
Stephane Chazelas
24a82b9dad 47352 (+ extra test cases): fix %<n>K prompt expansion
Fixed a regression introduced by workers/30496 (5.0.3) whereby %2K would
no longer be the equivalent of %K{2} (%K{green}) in prompt expansion.

That was one missing case where the is_fg flag was not passed along to
match_colour() after code factorisation.

Add tests for the different syntax variants, using echoti
as a reference.
2020-09-10 07:34:56 +01:00
Daniel Shahaf
dd6e702ee4 46068 (tweaked) (was: github #57): region_highlight: Add memo= support.
This is useful when multiple plugins add region_highlight entries and
subsequently want to remove only their own entries.  Without this
functionality, recognizing one's region_highlight entries is not trivial
because the 'start' and 'end' offsets are modified by editing of $BUFFER
and the highlight specification may not be unique or distinctive.

The tweaks are as follows:

- Change zfree() to zsfree() per workers/46070.

- Remove the mem.c hunk, as it changed the signature of only one out of
  two alternative definitions of zsfree().  (The definition that hunk
  touched is the one that's not used by default.)
2020-06-25 11:50:33 +00:00
Martijn Dekker
c578f0a08b 45004: Fix typos in comments 2019-12-11 02:37:39 +00:00
romkatv
80aa807a61 fix multiple bugs in countprompt
1. Height off by one in the presence of meta characters at the end of the line.

The following prompt has height 2 but countprompt used to return 3.

    PROMPT="${(pl.$COLUMNS..-.)}%f"$'\n'

You can observe the effects of the bug with esc-x followed by reset-prompt.

2. Width off by one when a line is broken in the middle of a wide character.

Assuming COLUMNS=79, the following prompt has width 2 but countprompt used to return 0.

    PROMPT="${(pl.40..\u3050.)}" zsh -df

Press ctrl-r or type ls<tab> to observe the effects of the bug.

3. Width off by 1-7 when a line is broken in the middle of a tab.

Assuming COLUMNS=79, the following prompt has width 1 but countprompt used to return 0.

    PROMPT="${(pl.10..\t.)}" zsh -df

Press Ctrl-R or type ls<TAB> to observe the effects of the bug.
2019-06-19 15:56:05 +01:00
dana
64d1373835 43288: fix line-broken prompts
Without re-breaking the case where a newline character lands in column 0.
2019-04-18 20:54:19 +02:00
dana
ed4c8f3d5e 44030: prompt: Return error for unrecognised colour name 2019-02-03 11:55:40 -06:00
Mikael Magnusson
d683d278c7 44011: Only use fg_start_code for non-truecolor
The sequence for truecolor uses a different prefix from palette colors
2019-01-23 11:51:42 +01:00
Peter Stephenson
de31fe1f93 users/23809: ZLE_HIGHLIGHT extensions.
Allow non-termcap use of colours > 7.
Add tests.
2018-12-30 18:18:34 +00:00
Oliver Kiddle
5a70701788 43805: make nearcolor module use the default colour rather than black as a fallback 2018-11-08 11:01:36 +01:00
Oliver Kiddle
9eba4d3a44 43804: also need to be able to turn colour attributes back into hex triples for region_highlight variable 2018-11-08 11:01:29 +01:00
Oliver Kiddle
50597692e0 43759: add support for true colour terminals 2018-11-05 22:24:12 +01:00
Oliver Kiddle
37d0005a9e 43747: new module to map colours from hex triplets to the nearest matching colour 2018-11-05 22:24:05 +01:00
dana
394f3a47e4 43075: Support nanosecond-precision time formatting
* Teach ztrftime() %9. and %N for nanoseconds
* Update prompt expansion to pass sub-second times for time formatting
* Update zsh/stat to pass sub-second times for atime/mtime/ctime

Patch heavily based on Oliver's earlier work @ workers/24059
2018-06-20 17:29:56 -05:00
Warepire
d8d9fee137 42285: off by one fix in multiple prompts 2018-01-16 09:31:16 +00:00
Barton E. Schaefer
de6a293159 42136: empty string check in %~ / %C prompt expansions 2018-01-14 03:15:49 -08:00
Peter Stephenson
263a0c2476 41078: Empty psvar could cause bad dereference in prompt expansion 2017-05-09 09:46:23 +01:00
Paulo Andrade
8d4c98540d 40260: zero new space allocated in prompt buffer 2017-01-03 12:00:18 +00:00
Peter Stephenson
4ab3fcc90d 39545: Add some missing unqueue_signals().
All of these are added simply to fit existing logic in other branches.
2016-10-03 13:43:20 +01:00
Daniel Shahaf
f9b1703511 38971: Start using the new arrlen_ge() / arrlen_le() helpers. 2016-08-01 08:01:29 +00:00
Oliver Kiddle
e87aa8941f 38809: fix tracking of colour attributes and restore them when turning bold off 2016-07-08 22:28:15 +02:00
Jun-ichi Takimoto
a4020e10a3 37868: add 'static' to file local variables 2016-02-03 01:25:33 +09:00
Peter Stephenson
f8164fb647 36227: attempt to fix metafication problem with ztrftime.
fmt is treated as metafied on entry; use returned length to ensure
we metafy or output the correct length if there are embedded nulls.
2015-08-18 16:20:48 +01:00
Peter Stephenson
f1923bdfa6 Add non-metafied character length handling.
Use this in regex module and add test using $'\ua0'.

Rename mb_metacharinit() to mb_charinit() as it does not involve
metafied characters.
2015-06-12 09:30:39 +01:00
Peter Stephenson
c6c9f5daf2 34322: bug with interface to parsestr() etc.
Was showing up in places like ${(e)...} where command substitution
could reallocate the token string, but actually there was never any
guarantee that the lexer wouldn't do that, so this was always
a bit iffy.
2015-01-18 22:38:57 +00:00
Peter Stephenson
d067ebcacd 33876: etc.: Separate errors and keyboards interrupts
Combination of 12 commits from interrupt_abort branch.

Basic strategy is to introduce bits to errflag and to set and
reset them separately.

Remove interrupt status on return to main keymap.

Turn off ERRFLAG_INT for always block.

Restore bit thereafter: we probably need a new variable in order
to allow user interrupts to be reset in the always block.

Add TRY_BLOCK_INTERRUPT

This works the same as TRY_BLOCK_ERROR, but for a SIGINT, too.

Ensure propagation of SIGINT from exited job.

If received by foreground job, shell uses ERRFLAG_INT, not
ERRFLAG_ERROR, to set the new state.

Reset errflag before precmd()

Add always block in _main_completion to fix ZLS_COLORS

Ensures we get the right state of $ZLS_COLORS at the end of _main_complete
even if there's an interrupt.  However, the "right state" is a bit messy
as it depends on styles.
2014-12-11 09:41:17 +00:00
Barton E. Schaefer
7cabee52d8 33256: fix prompttrunc() counting of %{ %} spans 2014-09-27 09:26:21 -07:00
Barton E. Schaefer
5b57f28256 33070: add %(e..) based on %e 2014-08-30 14:11:58 -07:00
Peter Stephenson
711e1427b5 33057: %e in prompts shows evaluation / execution depth 2014-08-29 09:46:34 +01:00
Barton E. Schaefer
6fc3b67b80 32971: negative argument with %(l..) and with %<< or %>> calculates space available before right margin 2014-08-07 09:26:09 -07:00
Peter Stephenson
d3d0910293 32918: add %. to ztrftime for use in prompts 2014-07-30 12:10:15 +01:00
Mikael Magnusson
8a9b141652 30496: Parse argument to %F and %K as prompt sequences 2013-03-10 12:33:04 +00:00
Peter Stephenson
86f8e8de69 30307 plus tweak suggsted by Wayne: use %lld for zlong when long long 2012-03-05 10:06:28 +00:00
Peter Stephenson
d89361739a 29165: use term.h globally if needed at all. 2011-05-09 09:49:08 +00:00
Frank Terbeck
2eac105770 28853: Fix typo: preceed -> precede 2011-03-04 13:25:25 +00:00
Peter Stephenson
4ad0a25af1 27983: colours could be output twice 2010-06-03 19:36:16 +00:00