From ad882a84d07671a656dfe78c2a26f5c2691956c6 Mon Sep 17 00:00:00 2001 From: LANDON TEITSORT Date: Wed, 8 Apr 2026 10:31:45 -0500 Subject: [PATCH] Updated Textbox to look nicer --- ct.1 | 3 +++ main.cc | 28 ++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ct.1 b/ct.1 index 30f216e..cb5ea55 100644 --- a/ct.1 +++ b/ct.1 @@ -20,3 +20,6 @@ to initiate a session and the other for a "client" user to join the host. .LP Messages are sent as buffered plain text with minimal processing, if any. + +.LP +The program is intialized in server mode and waits for a client the send a message in the textbox diff --git a/main.cc b/main.cc index 31b1991..87273b8 100644 --- a/main.cc +++ b/main.cc @@ -105,6 +105,23 @@ main(int argc, char *argv[]) } while (!exit) { + clear(); + + //Draw outer chat border + box(stdscr, 0, 0); + + // Get screen size + int height, width; + getmaxyx(stdscr, height, width); + + // Draw separator line above input + mvhline(height - 3, 1, 0, width - 2); + + // Labels + mvprintw(0, 2, " Chat "); + mvprintw(height - 3, 2, " Input "); + + //Display Chat Log displayFile(logFileName, linePos, LOG_LENGTH); // scroll along the screen if and when required so that it stays @@ -112,10 +129,13 @@ main(int argc, char *argv[]) if (linesInFile(logFileName) > LOG_LENGTH) linePos++; - /* clear message box / reset cursor */ - move(12, 0); - printw(">\t\t\t"); - move(12, 2); + // Input area + move(height - 2, 2); + clrtoeol(); + printw("You: "); + move(height - 2, 7); + + refresh(); getstr(userInput); writeToFile(logFileName, userInput);