summaryrefslogtreecommitdiffstats
path: root/src/ui/tui.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/tui.sh')
-rw-r--r--src/ui/tui.sh22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/ui/tui.sh b/src/ui/tui.sh
index 4aec0d1..75ef4e6 100644
--- a/src/ui/tui.sh
+++ b/src/ui/tui.sh
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+_tui_msg=''
+
tui_init_ui()
{
term_init
@@ -33,6 +35,16 @@ tui_exit_ui()
term_cooked
}
+tui_message()
+{
+ local msg="${1}"
+ shift 1
+
+ _tui_msg="${msg}"
+
+ return 0
+}
+
_tui_box()
{
local w=${1}
@@ -43,10 +55,16 @@ _tui_box()
local i=
local line=''
- # Clear the screen and set the cursor position to center the box.
+ # Reset SGR and clear the screen.
term_attr_reset
term_clear
- y=$(expr \( $(term_lines) - ${h} \) / 2 + 1)
+
+ # Write the persistent message (if any).
+ term_cursor_position $(expr $(term_lines) - 1) 3
+ term_write "${_tui_msg}"
+
+ # Set the cursor position to center the box.
+ y=$(expr \( $(term_lines) - ${_tui_msg+3} - ${h} \) / 2 + 1)
x=$(expr \( $(term_columns) - ${w} \) / 2 + 1)
term_cursor_position ${y} ${x}