1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-12 01:11:27 +02:00
Commit graph

134 commits

Author SHA1 Message Date
Peter Stephenson
e4d3ee06b3 25682: terminate history line before passing to zshaddhistory hook 2008-09-18 09:42:44 +00:00
Clint Adams
b62584cbcd 25639: free ptr2 if hsubl is NULL. 2008-09-10 19:02:11 +00:00
Clint Adams
bd915064c3 25610: remove dead code. 2008-09-04 22:27:59 +00:00
Peter Stephenson
0c9830d23c 25345, 25347: neaten interface from main shell to zle 2008-07-31 08:44:16 +00:00
Peter Stephenson
0409391c7d 25272: add zshaddhistory hook 2008-07-17 11:27:55 +00:00
Wayne Davison
c9006a06a3 Only call close(flock_fd) if flock_fd is >= 0. 2008-05-05 14:29:03 +00:00
Wayne Davison
f7b2570e15 Locking simplification and signed/unsigned fixes. 2008-05-05 01:14:04 +00:00
Peter Stephenson
c8b6d1a239 24872: revert to original patch 2008-04-26 19:45:54 +00:00
Peter Stephenson
31ca309299 Jun T. 24872 + 24873: capitalization with combining characters 2008-04-26 18:17:29 +00:00
Peter Stephenson
78ce07b49f 24818: add HIST_FCNTL_LOCK.
unposted: update NEWS with new features
2008-04-17 10:23:45 +00:00
Peter Stephenson
5eb7948f86 24814: suspicious handling of temporary history buffer 2008-04-14 13:42:51 +00:00
Peter Stephenson
e9b11fa9f0 unposted: make test for added space in 24699 safer 2008-03-11 10:00:38 +00:00
Peter Stephenson
25413054c1 24699: bug with ${(Q)...} on initial ">"
bug with ${(z)...} on string with unterminated "("
2008-03-08 01:20:49 +00:00
Wayne Davison
697d170928 History file-handling improvments. 2008-03-06 17:23:00 +00:00
Bart Schaefer
15e8fe245d 24324: do not set ftim when re-entering the history mechanism for string
substitution.
2007-12-31 23:14:17 +00:00
Peter Stephenson
3c75ea5de5 23736: status for file save wasn't initialised 2007-08-01 21:52:35 +00:00
Peter Stephenson
9534c89981 23585: handle errno properly in history save errors 2007-06-23 18:15:14 +00:00
Peter Stephenson
63eaea2238 23581: handle errors writing history file better 2007-06-22 20:32:19 +00:00
Peter Stephenson
9471bbcfa0 22934, modified, see 22937: add HIST_SUBST_PATTERN option
make ${.../#%...} anchor at both ends
2006-11-01 12:25:18 +00:00
Peter Stephenson
6157c14d06 22525: lengths and cases of multibyte strings in parameters and history 2006-06-28 13:12:55 +00:00
Peter Stephenson
dd5602f59b 22474: use variable argument lists to improve error message handling 2006-05-30 22:35:03 +00:00
Wayne Davison
4cb83571c4 Changed some structures to avoid gcc's type-punned warnings. 2006-03-07 21:30:36 +00:00
Wayne Davison
78168105de Two changes in the HIST_SAVE_BY_COPY code: (1) preserve the group
and permissions on the history file, and (2) fail if zsh's euid
differs from the file's uid (since that would change the history
file's owner).
2005-12-17 07:58:12 +00:00
Peter Stephenson
325f9c5dea users/9618, modified: :G for global substution modifier 2005-11-04 16:20:32 +00:00
Peter Stephenson
2a888b3d5a c.f. 21590: metafy_line()/unmetafy_line() now support wide characters 2005-08-10 10:56:40 +00:00
Wayne Davison
bb738368ba Honor the setting of the new HISTSAVEBYCOPY option when rewriting
the history file.
2005-03-18 22:40:28 +00:00
Clint Adams
0038b1a682 * 2073x: Src/Zle/zle_utils.c, Src/hist.c: modify zlegetline() and zlegetline
caller so that the octet-based and wide-character versions should return
   the same string.
2005-01-22 04:03:05 +00:00
Peter Stephenson
88a37cc187 c.f. 20675: improve zle as a basis for Unicode.
unposted: update version to 4.2.3-dev-1
2005-01-14 13:04:47 +00:00
Wayne Davison
3ccc3e4bdc Use the new gettempfile() function. 2004-10-21 00:33:50 +00:00
Wayne Davison
945a40f7e6 - Improved lockhistfile() to use the new gettempname() for a unique
filename instead of a .PID suffix.
- Use bicat() to build the $HISTFILE.LOCK filename.
- Put the $HOST value into $HISTFILE.LOCK in addition to the PID.
2004-10-18 19:07:30 +00:00
Wayne Davison
89eb92d8c2 - Added an arg to saveandpophiststack() to allow the caller to
specify what flags to send to savehistfile().
- Implemented the HFILE_NO_REWRITE support in savehistfile().
2004-10-01 19:48:53 +00:00
Peter Stephenson
6b1dc0f701 20331: Use internal zlong variables for consistency
20332: Add WIDGETSTYLE zle parameter
2004-09-09 10:12:42 +00:00
Wayne Davison
fb0937a69e Marked unused parameters with the new UNUSED() macro. 2004-06-02 22:14:25 +00:00
Wayne Davison
3e7b092bc7 - pushhiststack() now takes a level value and remembers it. If it was
the locallevel (instead of -1), the history list is marked to auto-pop
  on function exit.
- The saveandpophiststack() function now interprets a 0 arg as a request
  to do an auto-pop.
2004-05-21 20:05:12 +00:00
Wayne Davison
e8eca2ee4b - Added functions to push and pop the current history list, allowing
functions to more easily switch to their own private history.
- Changed the existing history push/pop code in savehistfile() (which
  uses a separate history buf to allow it to rewrite the on-disk
  version of the history file without disturbing the in-memory list).
2004-05-20 22:23:02 +00:00
Wayne Davison
319af86611 Added a comment to resizehistents() to explain why the function is
weirder than expected at first glance.
2004-05-18 18:45:05 +00:00
Wayne Davison
1ec2b5c096 Fix the potential for an infinite loop in lockhistfile() if the
link() calls fails for some other reason than EEXIST.
2004-05-11 21:45:36 +00:00
Peter Stephenson
815bc92148 a la 19209: zcalloc -> zshcalloc 2003-10-29 19:17:30 +00:00
Peter Stephenson
e65a811520 18941: history wrong after parse error during alias expansion 2003-08-11 13:19:48 +00:00
Peter Stephenson
98307b767c 17318: ${(z)...} added an extra space when the lexical analyser failed. 2002-06-14 17:52:05 +00:00
Wayne Davison
cbc7abb006 Added "savehistsiz" (for the new SAVEHIST special parameter), and used it
in place of getiparam("SAVEHIST").
2002-03-24 23:52:47 +00:00
Wayne Davison
663c6e794a In putoldhistentryontop(), ensure that we can't return with "next" set to
the value we just put on top.
2002-02-22 20:40:29 +00:00
Wayne Davison
cfcf7bda8d Yet another fix for prepnexthistent(). 2002-02-20 19:25:14 +00:00
Wayne Davison
3b3bafac80 Fixed a just-introduced bug in prepnexthistent() when curline is in
the list.
2002-02-18 19:25:25 +00:00
Wayne Davison
d35af383df When savehistfile() rewrites the history file, there was a potential for
losing the entire history file if we couldn't lock the file for reading
(it timed out) but we could lock the file for write (and wrote nothing).
2002-02-16 09:21:34 +00:00
Wayne Davison
e706f12937 Optimized putoldhistentryontop() so that when resizehistents() calls it
repeatedly while HIST_EXPIRE_DUPS_FIRST is set, it doesn't re-scan the
already-checked hist items (avoiding potentially slow operation).
2002-02-16 09:15:07 +00:00
Wayne Davison
c24a38cdaa Improved resizehistents() so that it honors HISTEXPIREDUPSFIRST. 2002-02-13 18:13:14 +00:00
Clint Adams
7dea9669bb 16577: don't return a single dot as the path head of a slash. 2002-02-06 16:48:28 +00:00
Wayne Davison
c1b837b152 Improved readhistline() to reject binary data better. (16184) 2001-10-26 23:47:10 +00:00
Wayne Davison
34c4e565d0 Fix HIST_NO_SPACE when INTERACTIVE_COMMENTS is set and we get a
comment.
2001-10-15 18:42:52 +00:00
Bart Schaefer
63ecd0332b Fix out-of-memory on corrupt history files. 2001-09-24 15:15:08 +00:00
Wayne Davison
2a754dbb61 With HIST_NO_STORE, don't ignore what looks like a history command if
we're really going to call a user-defined shell function.
2001-09-15 06:28:15 +00:00
Wayne Davison
fc89b8135a + Changed addhistnum() to return firsthist()-1 or curhist+1 on error.
+ Ignore the "r" command if HIST_NO_STORE is set.
2001-09-13 18:19:11 +00:00
Wayne Davison
f7e8ca1d96 When rewriting the history file, set histactive to 0 and restore it
when we're done.  This prevents the loss of the file's last line
when a signal causes us to rewrite it.  Also restore the value of
histsiz.
2001-08-07 19:53:19 +00:00
Wayne Davison
963466358a Have prepnexthistent() remove any HIST_TEMPSTORE entry that is present. 2001-06-28 18:17:14 +00:00
Wayne Davison
b207aeeded Don't mark a HIST_TMPSTORE entry with HIST_OLD so that the HFILE_FAST
algorithm in savehistfile() will recheck this hist num later.
2001-06-08 00:15:18 +00:00
Wayne Davison
f99520aeb0 Don't merge a HIST_TMPSTORE entry with a previous "duplicate" line.
Also, don't call addhistnode() on a HIST_TMPSTORE entry.
2001-05-19 09:22:10 +00:00
Wayne Davison
9f9ced8c62 + Changed histreduceblanks() to preserve spaces at the start of the
line when HISTIGNORESPACE is set.
+ Flag a history entry with HIST_TMPSTORE when should_ignore_line()
  returns true (instead of dropping it from the history immediately).
+ Get rid of old HIST_TMPSTORE entries when a new command is entered.
+ The hist-file-reading code now handles destroying a foreign
  duplicate (when marked as duplicate by addhistnode()).
2001-05-15 16:32:25 +00:00
Wayne Davison
6066bd7eeb Fixed an obscure local-history bug that could make the "history"
command output something that was slightly wrong. (14304)
2001-05-10 23:06:54 +00:00
Bart Schaefer
220ad9aa23 Parameter repairs, mostly for subscripting. 2001-04-20 06:13:35 +00:00
Wayne Davison
6d4a1bbc5c Slightly optimized should_ignore_line() by using getjobtext() rather
than getpermtext().
2001-04-10 18:03:58 +00:00
Sven Wischnowsky
85de1eae0b properly restore noaliases in bufferwords() (13530) 2001-02-26 09:43:08 +00:00
Peter Stephenson
cd02c345af 13280: NewImproved handling of colon modifiers w.r.t. paths 2001-02-19 10:26:52 +00:00
Sven Wischnowsky
757168e2c8 remove 13108 (trap queues); replace with signal queueing to ensure that user signal handlers are only executed when it is safe to run them (13365) 2001-01-16 13:44:18 +00:00
Bart Schaefer
9bf7fb75c5 Fix "vared -h" in shell scripts. 2000-10-21 03:15:36 +00:00
Wayne Davison
4be4c7575c Don't call histreduceblanks() if the line didn't parse right. 2000-10-19 07:12:26 +00:00
Sven Wischnowsky
9bc05a5aa5 isalpha() -> ialpha(); avoid a compiler warning (12439) 2000-07-31 08:12:16 +00:00
Wayne Davison
c6a3c250c1 Renamed shouldIgnoreLine() to should_ignore_line(). 2000-07-20 17:00:19 +00:00
Wayne Davison
01ea5e83c5 Support "builtin" in the HIST_NO_STORE check. 2000-07-20 07:09:34 +00:00
Wayne Davison
1ad69e3d44 Removed remhist() and HA_JUNKED, added an Eprog arg to hend(), and
added the shouldIgnoreLine() function that hend() now calls to figure
out if it needs to save the line or not.
2000-07-19 21:12:06 +00:00
Wayne Davison
b4c5de44f9 + Got rid of the spaceflag variable.
+ Make sure that the curline.histnum variable is accurate at the end
  of our history processing, even if we read in some foreign history
  and/or if we replaced the prior line because it was a duplicate of
  the current one.  This enables the history (fc -l) command to work
  properly, even if the current command was HIST_NO_SPACE-ed away.
+ Don't allow remhist() to remove the last line in the history if we
  didn't store the current command.
2000-07-18 07:55:13 +00:00
Wayne Davison
656bce6bf5 Fix the gethistent() function and enhanced the reliability of the
SHARE_HISTORY option.
2000-07-17 02:07:23 +00:00
Wayne Davison
2b602a93e6 + Needed to call unmeta() in a few spots that used the HISTFILE name.
+ The non-HAVE_LINK code in lockhistfile() was broken in a number of ways.
+ Added an extra unlink() call to the HAVE_LINK code in lockhistfile()
  since (Linix at least says that) O_EXCL over NFS is broken.
2000-07-16 20:12:19 +00:00
Sven Wischnowsky
0982f4ee64 condition parsing with (z) flag 2000-07-13 12:28:12 +00:00
Sven Wischnowsky
c3082d546e slightly improved (z) flag for parsing conditions; recognising glob flags in conditions still doesn't work (12237) 2000-07-13 08:42:10 +00:00
Sven Wischnowsky
d861bb9805 fix for (z) flag, don't take # as comment (12228) 2000-07-12 10:31:29 +00:00
Oliver Kiddle
64d9b83105 AIX depenency fix (11661) 2000-05-30 14:06:30 +00:00
Bart Schaefer
8564aa5c0d Wayne: Fix two history bugs that were causing the
failure of `print -s'.
2000-05-30 03:43:27 +00:00
Sven Wischnowsky
7f9f81f3e2 save and restore more variables in bufferwords(); move gotword() into core (11523) 2000-05-23 08:20:56 +00:00
Sven Wischnowsky
c844ad8712 Wayne: fix for print -s when called from widget; added lines are not immediately available, though (11171) 2000-05-05 07:42:36 +00:00
Sven Wischnowsky
17e79c0157 fix for the (z) flag: report partial word (like `"foo', without a closing quote); mention in manual that (z) is handled lately (11117) 2000-05-03 13:05:39 +00:00
Sven Wischnowsky
70e5b622ff new (z) parameter flag to do shell-word splitting on the value (11113) 2000-05-03 12:21:55 +00:00
Sven Wischnowsky
b1d4a8194a new widget copy-prev-shell-word, like copy-prev-word but uses shell parsing to find word (10685) 2000-04-12 08:24:15 +00:00
Tanaka Akira
e74702b467 Initial revision 1999-04-15 18:05:38 +00:00