lotsa improvements to markslider
This commit is contained in:
@@ -24,7 +24,7 @@ function display_slide {
|
|||||||
!/^# /{
|
!/^# /{
|
||||||
print $0;
|
print $0;
|
||||||
}
|
}
|
||||||
' "$1" | sed -n '/^'$2'# /,/^'$j'# /p' | grep -v "^$j# " | sed 's,^'$i'\(# .*\),'$H'\1'$Z',' | eval sed $REGEX
|
' "$1" | sed -n '/^'$2'# /,/^'$j'# /p' | grep -v "^$j# " | sed -e 's,^'$i'\(# .*\),'$H'\1'$Z',' -e ${HROW}'s/^\(.*\)/'$H$Y'\1'$Z'/' | eval sed $REGEX
|
||||||
}
|
}
|
||||||
function slide_exec {
|
function slide_exec {
|
||||||
# find executables in the slide
|
# find executables in the slide
|
||||||
@@ -94,12 +94,14 @@ REGEX="$REGEX -e 's/^\$(\([^)]\{20\}\).*)/\$(\1...)/g'"
|
|||||||
|
|
||||||
i=1
|
i=1
|
||||||
MENU=1
|
MENU=1
|
||||||
|
HROW=1
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
# print slide $i
|
# print slide $i
|
||||||
NO_SLIDES=$( grep -ce "^# " "$1" )
|
NO_SLIDES=$( grep -ce "^# " "$1" )
|
||||||
SLIDE_CHARS=$(( ${#i} + ${#NO_SLIDES} +1 ))
|
SLIDE_CHARS=$(( ${#i} + ${#NO_SLIDES} +1 ))
|
||||||
COLS=$(( $( tput cols ) - $SLIDE_CHARS ))
|
COLS=$(( $( tput cols ) - $SLIDE_CHARS ))
|
||||||
|
LINES=$( tput lines )
|
||||||
[ "$cmd" = "e" ] && read -N 1 foo
|
[ "$cmd" = "e" ] && read -N 1 foo
|
||||||
display_slide "$1" $i
|
display_slide "$1" $i
|
||||||
# save cursor location
|
# save cursor location
|
||||||
@@ -119,13 +121,23 @@ do
|
|||||||
[ "$cmd" = "" ] && read -s -N 2 cmd
|
[ "$cmd" = "" ] && read -s -N 2 cmd
|
||||||
|
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
2|"[D")
|
2|"[D"|"[5")
|
||||||
i=$(( $i - 1 ))
|
i=$(( $i - 1 ))
|
||||||
[ $i -lt 1 ] && i=1
|
[ $i -lt 1 ] && i=1
|
||||||
|
HROW=1
|
||||||
;;
|
;;
|
||||||
1|"[C"|"")
|
1|"[C"|"[6"|"")
|
||||||
i=$(( $i + 1 ))
|
i=$(( $i + 1 ))
|
||||||
[ $i -gt $NO_SLIDES ] && i=$NO_SLIDES
|
[ $i -gt $NO_SLIDES ] && i=$NO_SLIDES
|
||||||
|
HROW=1
|
||||||
|
;;
|
||||||
|
4|"[A")
|
||||||
|
HROW=$(( $HROW - 1 ))
|
||||||
|
[ $HROW -lt 1 ] && HROW=1
|
||||||
|
;;
|
||||||
|
3|"[B")
|
||||||
|
HROW=$(( $HROW + 1 ))
|
||||||
|
[ $HROW -gt $LINES ] && HROW=$LINES
|
||||||
;;
|
;;
|
||||||
m)
|
m)
|
||||||
[ -z "$MENU" ] && {
|
[ -z "$MENU" ] && {
|
||||||
|
|||||||
Reference in New Issue
Block a user