1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-21 16:21:37 +02:00
Commit graph

191 commits

Author SHA1 Message Date
Jun-ichi Takimoto
baa12a413f 50080: add missing STOUC() in casemodify() 2022-04-20 21:01:08 +09:00
Bart Schaefer
bdd37b4c14 49990: casemodify() avoids metafying characters that it otherwise did not touch 2022-04-04 13:20:45 -07:00
Oliver Kiddle
78958c08bf 49601: don't create ambiguous history file entries for lines ending with a backslash 2021-11-28 20:49:30 +01:00
Jun-ichi Takimoto
138f5bf144 49586: fix :a and :A modifiers (with PWD="/") on Cygwin⁩ 2021-11-22 18:21:29 +09:00
Peter Stephenson
50dc7f2913 49182: Turn off correction inside command substition.
In "A=$(PWD)" we dont't have the information to correct at the level of the
PWD subcommand, so don't try to do it as this causes a crash.
2021-07-23 20:27:38 +01:00
Oliver Kiddle
704d10989e 48504: use SEEK_ macros in fseek() calls 2021-04-11 22:26:36 +02:00
Michael Stapelberg
6388156233 45396: readhistfile: avoid thousands of lseek(2) syscalls via ftell() 2021-04-11 21:38:27 +02:00
Daniel Shahaf
12414d8052 45583/0003: chrealpath: Let caller decide how the return value should be allocated. 2020-03-25 23:49:01 +00:00
Daniel Shahaf
38b0e1ff7e 45583/0002: chrealpath: Make symlink resolution optional. 2020-03-25 23:49:01 +00:00
Peter Stephenson
c557cee1a6 24581: Fix array assignments in shell word splitting and completion.
Assignments after the first were not recognised as such as without
the full parser the state didn't return to command position.
Fix this in bufferwords() and the completion miniparser.
2019-12-31 18:35:06 +00:00
Martijn Dekker
c578f0a08b 45004: Fix typos in comments 2019-12-11 02:37:39 +00:00
Peter Stephenson
88d14451b0 users/24445: Add :P modifier to history code.
This was in the glob qualifier and variable code but got missed out
of the separate history modifier function.
2019-11-18 15:26:17 +00:00
Peter Stephenson
b8dc5a7f6d 44435: Handling digita arguments for :h and :t.
Pick number of leading or trailing path components to substitute.
Active in history, brace parameters, glob qualifiers.

Add tests for all three environments.
2019-06-20 11:13:05 +01:00
Peter Stephenson
73b29f079b 44142: Fix hist_reduce_spaces bug.
When there were as an unstripped comment on the line the
pointer for stripping spaces could be bogus.  Don't do
any editing in that case.
2019-03-19 13:44:47 +00:00
Yutian Li
0afe9dc02a 44067: Make history read safer on interrupt.
Record if a read was interrupted and if so process it in full
next time a read is needed.
2019-02-18 10:10:00 +00:00
Peter Stephenson
3517e4a9a5 42581(?): Fix ZLE inline history expansion.
Seen with magic-space.

If there's a parse error in command subtitution we need to complete
reading history to ensure the command line buffer is finished.
2018-04-04 18:33:00 +01:00
Peter Stephenson
758966502c 42322 (tweaked): Fix interactive_comments history with just a coment.
Don't discard the line from the history merely because it produced
no synactic words.
2018-01-24 17:40:56 +00:00
Peter Stephenson
36fcaeb167 42245: Abort last word on interactve comment.
Last recorded word should be the previous one.
2018-01-08 17:26:33 +00:00
Peter Stephenson
7d4b41b52a 41747: Don't create hash entry if just checking existence.
Pass a flag in indicating this case.
2017-09-25 20:03:05 +01:00
Peter Stephenson
d4947e67cc 41239: Save and restore default history event on context stack.
This ensures that the default event set by an expansion in ZLE
doesn't propagate to the command line expansion.
2017-06-07 10:03:41 +01:00
Peter Stephenson
151a4660e2 41164: Don't free a history entry if it's curline.
This replaces 41113 / 94014ff65b with a simple local change for the
immediate problem.  It's not entirely clear if this reflects wider
changes in the structure of the history code.
2017-05-30 09:39:32 +01:00
Peter Stephenson
94014ff65b 41113 (tweaked): Save current line linkage to history ring.
When saving history state save whether the current history line
is linked into the ring and remove it, and restore as appropriate
later.  This avoids surprises where the history ring is freed
and incorrectly frees the current state in curline, which has
a different allocation strategy.

Original patch tweaked to make restoring more logical.
2017-05-18 09:33:08 +01:00
Barton E. Schaefer
d0f7a3b2d6 40248: suppress errors from zshaddhistoryhook
and do not call it if no history entry will be written
2017-01-03 14:43:32 -08:00
Eitan Adler
110ffae9fe 40035: Cosmetic fixes for comments and documentation.
Mostly fixes to doubled words.
2016-11-29 17:13:52 +00:00
Peter Stephenson
a62e1640bc 39958: Add extra byte to PATH_MAX allocations.
This ensures we've got enough space for a null, although this
isn't always needed.
2016-11-17 19:49:17 +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
Jun-ichi Takimoto
ca3bc0d95d 37838: use UNUSED() consistently 2016-01-30 00:26:23 +09:00
Barton E. Schaefer
d18476ce5c 37819: zshaddhistory hook works for any history file write, even upon keyboard interrupt 2016-01-27 22:10:38 -08:00
Barton E. Schaefer
5cb75f0d41 36909: in getargs(), sanity-check the offsets for start and end of the requested words, in case of overflow 2015-10-21 15:13:17 -07:00
Peter Stephenson
86229fdf09 36468: Fix infinite loop exiting from Zle widget.
If the exit was while we were waiting to complete a lexical expression
we might not exit from the loop.
2015-09-10 16:02:27 +01:00
Peter Stephenson
8f8b82bc6c 35883: Don't attempt to back up over history if expanding alias 2015-07-24 10:19:00 +01:00
Peter Stephenson
49ff2e00dc 35854: ensure history character unget doesn't recurse infinitely 2015-07-23 09:32:24 +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
Barton E. Schaefer
f8fb6ebae8 34961: clean up declarations of quote() and quotebreak() 2015-04-25 10:51:54 -07:00
Peter Stephenson
f1c702f2a4 34817: Catch some errors earlier when reading history.
Mostly for the case of an interrupt.

Don't try to process words when we know something's gone wrong.

Also abort history reading earlier on an interrupt.
2015-03-29 19:47:01 +01:00
Peter Stephenson
a22cb7cad2 34776: improve suppression of alias expansions from history.
Now uses the mechanism in use for other forms of suppression of
sections of input.
2015-03-25 18:00:25 +00:00
Peter Stephenson
f6be7bc19f 34759: improve implementation of last commit 2015-03-22 19:21:10 +00:00
Peter Stephenson
4fb669a72d 34758: fix yet more history / command subst interaction.
In general we need to wind back over the history text input
inside command substitution because there's no level of
the input mechanism between history and the lexer.
2015-03-22 18:44:56 +00:00
Peter Stephenson
f48457a695 34742: history expansion inside command substitution failed.
Needs the case of alias expansion separating out.
2015-03-19 11:10:49 +00:00
Peter Stephenson
c96606cc06 34623: free history more often if "remetafying" 2015-02-23 17:38:16 +00:00
Mikael Magnusson
ed43cf2768 34615 + 34619: Remeta one frame earlier 2015-02-23 18:09:47 +01:00
Peter Stephenson
bcc4ab792d 34604: Work around problem with changes in Meta characters.
If reading in a file that contains characters that should be
metafied but are not, fix up on the fly.  Only need when using
HIST_LEX_WORDS.
2015-02-22 20:22:40 +00:00
Barton E. Schaefer
2546c86244 34389: fix parsing of ">!" when read from histfile with HIST_LEX_WORDS 2015-01-25 13:15:34 -08:00
Peter Stephenson
4688de1677 34365: History lockfile backoff: randomised time.
Time doubles on each lock failure.

zsleep() provides microsecond resolution for sleep; uses nanosleep() if
available, else select via means of existing tty poll function.
2015-01-25 20:29:18 +00:00
Peter Stephenson
e34ce85151 34319: fix alias expansion in history for command substitution 2015-01-18 16:43:26 +00:00
Peter Stephenson
aa503b592b unposted: another dubious comment in hist.c fixed 2015-01-16 20:35:41 +00:00
Peter Stephenson
0f60d18249 unposted: improve comment on hist_in_word().
Commit f2a2f28f7 was a bit less clear about how hist_in_word()
was used than it could be.
2015-01-16 20:31:11 +00:00
Peter Stephenson
f2a2f28f7b 32413: turn off history word marking in cmd subst 2015-01-16 20:12:40 +00:00
Mikael Magnusson
7dcaa2ff60 hist: remove wrong NULL terminator
This actually writes a NULL to some arbitrary location in the caller function's stack. Found by Coverity (Issue 1255746).
2015-01-10 08:48:18 +01:00
Peter Stephenson
cfd91eac07 Rearrange context saving.
Variables are now associated with the module that declares them, being
initialised and saved/restored there.  However, as many variables are
used for communication between modules, many of them are set in multiple
places, so the assignment is ambiguous.
2015-01-09 21:33:39 +00:00