mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-04 20:56:44 +02:00
refactor chat history to allow scrolling
This commit is contained in:
@ -49,6 +49,7 @@
|
||||
#define CURS_Y_OFFSET 3 /* y-axis cursor offset for chat contexts */
|
||||
#define CHATBOX_HEIGHT 4
|
||||
#define KEY_IDENT_DIGITS 2 /* number of hex digits to display for the pub-key based identifier */
|
||||
#define TIME_STR_SIZE 16
|
||||
|
||||
#define EXIT_SUCCESS 0
|
||||
#define EXIT_FAILURE 1
|
||||
@ -60,6 +61,7 @@
|
||||
#define T_KEY_PREV 0x0F /* ctrl-o */
|
||||
#define T_KEY_C_E 0x05 /* ctrl-e */
|
||||
#define T_KEY_C_A 0x01 /* ctrl-a */
|
||||
#define T_KEY_ESC 0x1B /* ESC key */
|
||||
|
||||
/* Curses foreground colours (background is black) */
|
||||
enum {
|
||||
@ -80,6 +82,11 @@ enum {
|
||||
WINDOW_ALERT_2,
|
||||
};
|
||||
|
||||
enum {
|
||||
MOVE_UP,
|
||||
MOVE_DOWN,
|
||||
};
|
||||
|
||||
/* Fixes text color problem on some terminals.
|
||||
Uncomment if necessary */
|
||||
/* #define URXVT_FIX */
|
||||
@ -176,13 +183,13 @@ struct ChatContext {
|
||||
size_t pos;
|
||||
size_t len;
|
||||
|
||||
wchar_t ln_history[MAX_LINE_HIST][MAX_STR_SIZE];
|
||||
wchar_t ln_history[MAX_LINE_HIST][MAX_STR_SIZE]; /* history for input lines/commands */
|
||||
int hst_pos;
|
||||
int hst_tot;
|
||||
|
||||
uint8_t self_is_typing;
|
||||
|
||||
struct history *hst;
|
||||
struct chatlog *log;
|
||||
uint8_t self_is_typing;
|
||||
|
||||
WINDOW *history;
|
||||
WINDOW *linewin;
|
||||
@ -203,7 +210,9 @@ struct PromptBuf {
|
||||
int hst_pos;
|
||||
int hst_tot;
|
||||
|
||||
struct history *hst;
|
||||
struct chatlog *log;
|
||||
|
||||
WINDOW *linewin;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user