zsh-workers
 help / color / mirror / code / Atom feed
2b96a366e3fc8fe1f187f821599506e86c97ab45 blob 1344 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
 
emulate -L zsh
setopt extendedglob

local opt keys
integer stat

while getopts "k:" opt; do
  case $opt in
    # Read the given number of keys.  This is a bit
    # ropey for more than a single key.
    (k)
    keys=$OPTARG
    ;;

    (*)
    return 1
    ;;
  esac
done
(( OPTIND > 1 )) && shift $(( OPTIND - 1 ))

local readprompt="$1" lbuf_init="$2" rbuf_init="$3"
integer savelim=$UNDO_LIMIT_NO changeno=$UNDO_CHANGE_NO

{
# Use anonymous function to make sure special values get restored,
# even if this function is called as a widget.
# local +h ensures special parameters stay special.
() {
  local pretext="$PREDISPLAY$LBUFFER$RBUFFER$POSTDISPLAY
"
  local +h LBUFFER="$lbuf_init"
  local +h RBUFFER="$rbuf_init"
  local +h PREDISPLAY="$pretext${readprompt:-? }"
  local +h POSTDISPLAY=
  local +h -a region_highlight
  region_highlight=("P${#pretext} ${#PREDISPLAY} bold")

  if [[ -n $keys ]]; then
    zle -R
    read -k $keys
    stat=$?
  else
    local NUMERIC
    unset NUMERIC
    zle split-undo
    UNDO_LIMIT_NO=$UNDO_CHANGE_NO
    zle recursive-edit -K main
    stat=$?
    (( stat )) || REPLY=$BUFFER
  fi
}
} always {
  # This removes the edits relating to the read from the undo history.
  # These aren't useful once we get back to the main editing buffer.
  zle undo $changeno
  UNDO_LIMIT_NO=save_limit
}

return $stat
debug log:

solving 2b96a36 ...
found 2b96a36 in https://inbox.vuxu.org/zsh-workers/17928.1436367453@thecus.kiddle.eu/
found 8fec110 in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 8fec1105e58ea43902621dfb1849dc8704801acf	Functions/Zle/read-from-minibuffer

applying [1/1] https://inbox.vuxu.org/zsh-workers/17928.1436367453@thecus.kiddle.eu/
diff --git a/Functions/Zle/read-from-minibuffer b/Functions/Zle/read-from-minibuffer
index 8fec110..2b96a36 100644

Checking patch Functions/Zle/read-from-minibuffer...
Applied patch Functions/Zle/read-from-minibuffer cleanly.

index at:
100644 2b96a366e3fc8fe1f187f821599506e86c97ab45	Functions/Zle/read-from-minibuffer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).