diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2008-10-24 16:00:48 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2008-10-24 16:00:48 +0000 |
commit | 2f50e20d84e676720674f8a35e1f8df205a42fc3 (patch) | |
tree | 02141446bf67f51ca57fa04425de6a7bd32bd15e | |
parent | 337530b4d6ef96bcd0fb50438256e288cf9b729c (diff) | |
download | zsh-2f50e20d84e676720674f8a35e1f8df205a42fc3.tar.gz zsh-2f50e20d84e676720674f8a35e1f8df205a42fc3.tar.xz zsh-2f50e20d84e676720674f8a35e1f8df205a42fc3.zip |
25931: Test for prompt code reentrancy
users/13400: clarify some ksh-like editing issues
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Doc/Zsh/options.yo | 6 | ||||
-rw-r--r-- | Etc/FAQ.yo | 10 | ||||
-rw-r--r-- | Test/D01prompt.ztst | 54 |
4 files changed, 73 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 9c4e9b839..e677f4819 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2008-10-24 Peter Stephenson <pws@csr.com> + * users/13400: Doc/Zsh/options.yo, Etc/FAQ.yo: clarify some + aspects of ksh-like editing. + + * 25931: Test/D01prompt.zsh: test fix in 25930. + * 25930: Src/prompt.c, Src/utils.c: dynamic directory names may need recursive prompt expansion; memory leak with reverse expansion of dynamic directory names. diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo index e3bc27127..5bc01084d 100644 --- a/Doc/Zsh/options.yo +++ b/Doc/Zsh/options.yo @@ -1515,6 +1515,12 @@ pindex(SINGLE_LINE_ZLE) cindex(editor, single line mode) item(tt(SINGLE_LINE_ZLE) (tt(-M)) <K>)( Use single-line command line editing instead of multi-line. + +Note that although this is on by default in ksh emulation it only +provides superficial compatibility with the ksh line editor and +reduces the effectiveness of the zsh line editor. As it has no +effect on shell syntax, many users may wish to disable this option +when using ksh emulation interactively. ) pindex(VI) item(tt(VI))( diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo index 0ddee2269..faa4741fe 100644 --- a/Etc/FAQ.yo +++ b/Etc/FAQ.yo @@ -298,7 +298,7 @@ sect(On what machines will it run?) sect(What's the latest version?) Zsh 4.2.7 is the latest production version. The latest development - version is 4.3.6; this contains support for multibyte character strings + version is 4.3.7; this contains support for multibyte character strings (such as UTF-8 locales). All the main features for multibyte support are now in place, although there is some debugging work still to be done. @@ -642,7 +642,13 @@ link(2.3)(23). it() mytt(\) does not escape editing chars (use mytt(^V)). it() Not all ksh bindings are set (e.g. mytt(<ESC>#); try mytt(<ESC>q)). it()* mytt(#) in an interactive shell is not treated as a comment by - default. + default. + it() In vi command mode the keys "k" and "j" move the cursor to the + end of the line. To move the cursor to the start instead, use + verb( + bindkey -M vicmd 'k' vi-up-line-or-history + bindkey -M vicmd 'j' vi-down-line-or-history + ) ) it() Built-in commands: itemize( diff --git a/Test/D01prompt.ztst b/Test/D01prompt.ztst index 84f9c7cbe..3074efe60 100644 --- a/Test/D01prompt.ztst +++ b/Test/D01prompt.ztst @@ -147,3 +147,57 @@ >~[scuzzy]/rubbish >~mydir/foo ?(eval):33: no directory expansion: ~[scuzzy] + + ( + zsh_directory_name() { + emulate -L zsh + setopt extendedglob + local -a match mbegin mend + if [[ $1 = n ]]; then + if [[ $2 = *:l ]]; then + reply=(${2%%:l}/very_long_directory_name) + return 0 + else + return 1 + fi + else + if [[ $2 = (#b)(*)/very_long_directory_name ]]; then + reply=(${match[1]}:l ${#2}) + return 0 + else + return 1 + fi + fi + } + parent=$PWD + dir=$parent/very_long_directory_name + mkdir $dir + cd $dir + fn() { + PS4='+%N:%i> ' + setopt localoptions xtrace + # The following is the key to the test. + # It invokes zsh_directory_name which does PS4 output stuff + # while we're doing prompt handling for the parameter + # substitution. This checks recursion works OK. + local d=${(%):-%~} + print ${d//$parent/\<parent\>} + } + fn 2>stderr + # post process error to remove variable contents + while read line; do + # tricky: reply is set to include directory length which is variable + [[ $line = *reply* ]] && continue + print ${line//$parent/\<parent\>} + done <stderr >&2 + ) +0:Recursive use of prompts +>~[<parent>:l] +?+zsh_directory_name:1> emulate -L zsh +?+zsh_directory_name:2> setopt extendedglob +?+zsh_directory_name:3> local -a match mbegin mend +?+zsh_directory_name:4> [[ d == n ]] +?+zsh_directory_name:12> [[ <parent>/very_long_directory_name == (#b)(*)/very_long_directory_name ]] +?+zsh_directory_name:14> return 0 +?+fn:7> local 'd=~[<parent>:l]' +?+fn:8> print '~[<parent>:l]' |