From 1c45a2d3446486fd54e3d21f2abacba2312d4b14 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Wed, 28 Oct 2015 23:30:01 -0400 Subject: _tui_box(): Output position --- (limited to 'src/ui') diff --git a/src/ui/tui.sh b/src/ui/tui.sh index acac483..11c552e 100644 --- a/src/ui/tui.sh +++ b/src/ui/tui.sh @@ -38,13 +38,16 @@ _tui_box() local w=${1} local h=${2} shift 2 + local y= + local x= local i= local line='' # Clear the screen and set the cursor position to center the box. term_clear - term_cursor_position $(expr \( $(term_lines) - ${h} \) / 2) \ - $(expr \( $(term_columns) - ${w} \) / 2) + y=$(expr \( $(term_lines) - ${h} \) / 2) + x=$(expr \( $(term_columns) - ${w} \) / 2) + term_cursor_position ${y} ${x} # Build the line. i=0 @@ -67,6 +70,7 @@ _tui_box() # Reset the cursor to the top-left corner of the box. term_cursor_up ${h} + printf '%d %d' ${y} ${x} return 0 } @@ -81,7 +85,7 @@ _tui_dialog() msg="$(printf "${fmt}" "${@}")" # Draw the box. - _tui_box $(expr ${#msg} + 8) 5 + _tui_box $(expr ${#msg} + 8) 5 >/dev/null # Draw an icon. term_cursor_forward 2 -- cgit v0.9.1