diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/tui.sh | 10 |
1 files changed, 7 insertions, 3 deletions
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 |