Updated Textbox to look nicer

This commit is contained in:
2026-04-08 10:31:45 -05:00
parent 33f7d4bcc4
commit ad882a84d0
2 changed files with 27 additions and 4 deletions

3
ct.1
View File

@@ -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

28
main.cc
View File

@@ -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);