summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2015-10-28 23:30:01 (EDT)
committer P. J. McDermott <pj@pehjota.net>2015-10-28 23:30:01 (EDT)
commit1c45a2d3446486fd54e3d21f2abacba2312d4b14 (patch)
treeb21a86b003a058b3ed63004962d7984547a698bb /src/ui
parent52b04ebbfff75da90a7a374298f63e0264486701 (diff)
downloadfirman.sh-1c45a2d3446486fd54e3d21f2abacba2312d4b14.zip
firman.sh-1c45a2d3446486fd54e3d21f2abacba2312d4b14.tar.gz
firman.sh-1c45a2d3446486fd54e3d21f2abacba2312d4b14.tar.bz2
_tui_box(): Output position
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/tui.sh10
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