TNT/include/tui.h
m1ngsama d3ebe25973
Some checks failed
CI / build-and-test (macos-latest) (push) Has been cancelled
CI / build-and-test (ubuntu-latest) (push) Has been cancelled
Deploy / test (push) Has been cancelled
Deploy / deploy (push) Has been cancelled
tui: dedicated MOTD renderer (M7-5)
The MOTD used to ride on tui_render_command_output's coattails — text
got stuffed into client->command_output prefixed by "=== 公告 / MOTD ==="
and rendered under a reverse-video " COMMAND OUTPUT " title bar.  Two
different things (a transient command result vs. a one-shot service
notice) wearing the same chrome.

Now MOTD has its own renderer with its own aesthetic:

    ╭─ 公告 / MOTD ────────────────────────────────╮

      欢迎来到 TNT 公共聊天室。
      请互相尊重,不要刷屏。
      管理员:m1ng

    ╰─ 按任意键继续 / press any key ────────────────╯

- title chip embedded in the top border (bright cyan)
- footer hint embedded in the bottom border (dim grey)
- 2-column left padding on body lines, blank top/bottom pad rows
- dim cyan borders, no full-line reverse anywhere

Wiring:
- new tui_render_motd() declared in tui.h
- new client_t.show_motd flag selects the renderer; command_output
  remains the text storage (no extra buffer needed)
- input.c MOTD path sets show_motd = true and calls tui_render_motd()
- handle_key's dismiss path clears show_motd alongside command_output
- main-loop redraw dispatch checks show_motd before command_output[0]
2026-05-17 13:16:37 +08:00

38 lines
1.1 KiB
C

#ifndef TUI_H
#define TUI_H
#include "common.h"
#include "message.h"
/* Client structure (forward declaration) */
struct client;
/* Render the main screen */
void tui_render_screen(struct client *client);
/* Render the help screen */
void tui_render_help(struct client *client);
/* Render the command output screen */
void tui_render_command_output(struct client *client);
/* Render the MOTD screen. Reads the message text from
* client->command_output (shared storage); the show_motd flag selects
* this renderer over tui_render_command_output. */
void tui_render_motd(struct client *client);
/* Render the input line */
void tui_render_input(struct client *client, const char *input);
/* Clear the screen */
void tui_clear_screen(struct client *client);
/* Render the pre-login welcome banner. Centered, framed, shown once before
* the username prompt. Caller is responsible for printing the prompt
* itself afterwards. */
void tui_render_welcome(struct client *client);
/* Get help text based on language */
const char* tui_get_help_text(help_lang_t lang);
#endif /* TUI_H */