1 ### vim:ft=zsh:foldmethod=marker
2 ## Copyright: 2009, Frank Terbeck <ft@bewatermyfriend.org>
4 LOOKUP_guard || return 1
6 if [[ $1 != '-f' ]] ; then
7 (( lookup_help == 0 )) && return 1
12 local line use_pager pager_auto pager
13 local -i prompt_height
16 zstyle -t "${lookup_context}" use-pager && use_pager='yes' || use_pager='no'
17 zstyle -t "${lookup_context}" pager-auto && pager_auto='yes' || pager_auto='no'
18 zstyle -s "${lookup_context}" pager pager || pager=${PAGER:-more}
19 zstyle -s "${lookup_context}" prompt-height prompt_height || prompt_height=1
20 (( prompt_height == 0 )) && prompt_height=1
22 if [[ ${LINES} != [0-9]## ]] || [[ ${LINES} -eq 0 ]] ; then
23 # $LINES is either 0, empty or other rubbish that's not a positive integer.
27 if [[ ${use_pager} == 'no' ]] ; then
28 LOOKUP_help_${backend}
32 if [[ ${use_pager} == 'yes' ]] && [[ ${pager_auto} == 'no' ]] ; then
33 LOOKUP_help_${backend} | ${=pager}
37 # use-pager: true, pager-auto: true
39 LOOKUP_help_${backend} | while IFS='' read -r line; do
43 if (( ${#lines} > LINES - prompt_height )); then
44 print -l -- "${lines[@]}" | ${=pager}
46 print -l -- "${lines[@]}"