mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-16 04:03:02 +01:00
make C-e and C-aa work like they do in bash and fix/format help messages
This commit is contained in:
parent
6ee1f1ed0f
commit
46b046a209
@ -414,14 +414,14 @@ static void chat_onKey(ToxWindow *self, Tox *m, wint_t key)
|
|||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == KEY_HOME) { /* HOME key: Move cursor to beginning of line */
|
else if (key == KEY_HOME || key == T_KEY_C_A) { /* HOME/C-a key: Move cursor to start of line */
|
||||||
if (ctx->pos > 0) {
|
if (ctx->pos > 0) {
|
||||||
ctx->pos = 0;
|
ctx->pos = 0;
|
||||||
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == KEY_END) { /* END key: move cursor to end of line */
|
else if (key == KEY_END || key == T_KEY_C_E) { /* END/C-e key: move cursor to end of line */
|
||||||
if (ctx->pos != ctx->len) {
|
if (ctx->pos != ctx->len) {
|
||||||
ctx->pos = ctx->len;
|
ctx->pos = ctx->len;
|
||||||
mv_curs_end(self->window, MAX(0, wcswidth(ctx->line, (CHATBOX_HEIGHT-1)*x2)), y2, x2);
|
mv_curs_end(self->window, MAX(0, wcswidth(ctx->line, (CHATBOX_HEIGHT-1)*x2)), y2, x2);
|
||||||
|
@ -54,10 +54,10 @@ void cmd_chat_help(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*arg
|
|||||||
|
|
||||||
wprintw(window, " /invite <n> : Invite friend to a group chat\n");
|
wprintw(window, " /invite <n> : Invite friend to a group chat\n");
|
||||||
wprintw(window, " /join : Join a pending group chat\n");
|
wprintw(window, " /join : Join a pending group chat\n");
|
||||||
wprintw(window, " /log <bool> : Enable/disable logging\n");
|
wprintw(window, " /log <on> or <off> : Enable/disable logging\n");
|
||||||
wprintw(window, " /close : Close the current chat window\n");
|
|
||||||
wprintw(window, " /sendfile <filepath> : Send a file\n");
|
wprintw(window, " /sendfile <filepath> : Send a file\n");
|
||||||
wprintw(window, " /savefile <n> : Receive a file\n");
|
wprintw(window, " /savefile <n> : Receive a file\n");
|
||||||
|
wprintw(window, " /close : Close the current chat window\n");
|
||||||
wprintw(window, " /help : Print this message again\n");
|
wprintw(window, " /help : Print this message again\n");
|
||||||
wprintw(window, " /help global : Show a list of global commands\n");
|
wprintw(window, " /help global : Show a list of global commands\n");
|
||||||
|
|
||||||
|
@ -229,9 +229,9 @@ void cmd_log(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
|
|||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
if (ctx->log.log_on)
|
if (ctx->log.log_on)
|
||||||
wprintw(window, "Logging for this chat is currently enabled. /log 0 to disable.\n");
|
wprintw(window, "Logging for this chat is on. Type \"/log off\" to disable.\n");
|
||||||
else
|
else
|
||||||
wprintw(window, "Logging for this chat is currently disabled. /log 1 to enable.\n");
|
wprintw(window, "Logging for this chat is off. Type \"/log on\" to enable.\n");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -262,7 +262,7 @@ void cmd_log(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wprintw(window, "Invalid option: Use 1 or 0 to enable or disable logging.\n");
|
wprintw(window, "Invalid option. Use \"/log on\" and \"/log off\" to toggle logging.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmd_myid(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
void cmd_myid(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||||
|
@ -136,7 +136,7 @@ static void print_groupchat_help(ChatContext *ctx)
|
|||||||
wprintw(ctx->history, " /note <msg> : Set a personal note\n");
|
wprintw(ctx->history, " /note <msg> : Set a personal note\n");
|
||||||
wprintw(ctx->history, " /nick <nick> : Set your nickname\n");
|
wprintw(ctx->history, " /nick <nick> : Set your nickname\n");
|
||||||
wprintw(ctx->history, " /groupchat : Create a group chat\n");
|
wprintw(ctx->history, " /groupchat : Create a group chat\n");
|
||||||
wprintw(ctx->history, " /log <bool> : Enable/disable logging\n");
|
wprintw(ctx->history, " /log <on> or <off> : Enable/disable logging\n");
|
||||||
wprintw(ctx->history, " /close : Close the current group chat\n");
|
wprintw(ctx->history, " /close : Close the current group chat\n");
|
||||||
wprintw(ctx->history, " /help : Print this message again\n");
|
wprintw(ctx->history, " /help : Print this message again\n");
|
||||||
wprintw(ctx->history, " /help global : Show a list of global commands\n");
|
wprintw(ctx->history, " /help global : Show a list of global commands\n");
|
||||||
@ -410,14 +410,14 @@ static void groupchat_onKey(ToxWindow *self, Tox *m, wint_t key)
|
|||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == KEY_HOME) { /* HOME key: Move cursor to beginning of line */
|
else if (key == KEY_HOME || key == T_KEY_C_A) { /* HOME/C-a key: Move cursor to start of line */
|
||||||
if (ctx->pos > 0) {
|
if (ctx->pos > 0) {
|
||||||
ctx->pos = 0;
|
ctx->pos = 0;
|
||||||
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
wmove(self->window, y2 - CURS_Y_OFFSET, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == KEY_END) { /* END key: move cursor to end of line */
|
else if (key == KEY_END || key == T_KEY_C_E) { /* END/C-e key: move cursor to end of line */
|
||||||
if (ctx->pos != ctx->len) {
|
if (ctx->pos != ctx->len) {
|
||||||
ctx->pos = ctx->len;
|
ctx->pos = ctx->len;
|
||||||
mv_curs_end(self->window, MAX(0, wcswidth(ctx->line, (CHATBOX_HEIGHT-1)*x2)), y2, x2);
|
mv_curs_end(self->window, MAX(0, wcswidth(ctx->line, (CHATBOX_HEIGHT-1)*x2)), y2, x2);
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* gets the log path by appending to the config dir the name and a pseudo-unique identity */
|
/* gets the log path by appending to the config dir the name and a pseudo-unique identity */
|
||||||
void init_logging_session(uint8_t *name, uint8_t *key, ChatContext *ctx)
|
void init_logging_session(uint8_t *name, uint8_t *key, ChatContext *ctx);
|
||||||
|
|
||||||
/* Adds msg to log_buf with timestamp and name.
|
/* Adds msg to log_buf with timestamp and name.
|
||||||
If buf is full, triggers write_to_log (which sets buf pos to 0) */
|
If buf is full, triggers write_to_log (which sets buf pos to 0) */
|
||||||
|
@ -173,12 +173,12 @@ static void prompt_onKey(ToxWindow *self, Tox *m, wint_t key)
|
|||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == KEY_HOME) { /* HOME key: Move cursor to beginning of line */
|
else if (key == KEY_HOME || key == T_KEY_C_A) { /* HOME/C-a key: Move cursor to start of line */
|
||||||
if (prt->pos != 0)
|
if (prt->pos != 0)
|
||||||
prt->pos = 0;
|
prt->pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (key == KEY_END) { /* END key: move cursor to end of line */
|
else if (key == KEY_END || key == T_KEY_C_E) { /* END/C-e key: move cursor to end of line */
|
||||||
if (prt->pos != prt->len)
|
if (prt->pos != prt->len)
|
||||||
prt->pos = prt->len;
|
prt->pos = prt->len;
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,8 @@
|
|||||||
#define T_KEY_DISCARD 0x15 /* ctrl-u */
|
#define T_KEY_DISCARD 0x15 /* ctrl-u */
|
||||||
#define T_KEY_NEXT 0x10 /* ctrl-p */
|
#define T_KEY_NEXT 0x10 /* ctrl-p */
|
||||||
#define T_KEY_PREV 0x0F /* ctrl-o */
|
#define T_KEY_PREV 0x0F /* ctrl-o */
|
||||||
|
#define T_KEY_C_E 0x05 /* ctrl-e */
|
||||||
|
#define T_KEY_C_A 0x01 /* ctrl-a */
|
||||||
|
|
||||||
/* Curses foreground colours (background is black) */
|
/* Curses foreground colours (background is black) */
|
||||||
enum {
|
enum {
|
||||||
|
Loading…
Reference in New Issue
Block a user