diff options
author | Will Song <incertia9474@gmail.com> | 2015-01-03 12:41:42 -0600 |
---|---|---|
committer | Will Song <incertia9474@gmail.com> | 2015-01-03 12:41:42 -0600 |
commit | 30610f7c486a0a33910eda64aafb0acf715aafbe (patch) | |
tree | f1140d8d62c95cdb3f088899fd6350de41d01d48 /src | |
parent | 832074de4ad3f78fabf0bb89ab7aad874e0154ab (diff) | |
parent | f5e5315125e619acfe49de25a0f7064a83ef9ece (diff) | |
download | profani-tty-30610f7c486a0a33910eda64aafb0acf715aafbe.tar.gz |
Merge remote-tracking branch 'upstream/master' into exit-title
Diffstat (limited to 'src')
-rw-r--r-- | src/config/preferences.c | 1 | ||||
-rw-r--r-- | src/profanity.c | 2 | ||||
-rw-r--r-- | src/ui/console.c | 24 | ||||
-rw-r--r-- | src/ui/core.c | 12 | ||||
-rw-r--r-- | src/ui/inputwin.c | 27 |
5 files changed, 51 insertions, 15 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c index fb4d3cca..22e80874 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -657,7 +657,6 @@ _get_default_boolean(preference_t pref) { switch (pref) { - case PREF_TITLEBAR: case PREF_OTR_WARN: case PREF_AUTOAWAY_CHECK: case PREF_LOG_ROTATE: diff --git a/src/profanity.c b/src/profanity.c index 0b8589df..c86a5475 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -254,6 +254,8 @@ _init(const int disable_tls, char *log_level) setlocale(LC_ALL, ""); // ignore SIGPIPE signal(SIGPIPE, SIG_IGN); + signal(SIGINT, SIG_IGN); + signal(SIGTSTP, SIG_IGN); _create_directories(); log_level_t prof_log_level = log_level_from_string(log_level); prefs_load(); diff --git a/src/ui/console.c b/src/ui/console.c index f227dcef..3d3a5d8b 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -1393,15 +1393,23 @@ cons_navigation_help(void) cons_show(""); cons_show("Navigation:"); cons_show(""); - cons_show("Alt-1 (F1) : This console window."); - cons_show("Alt-2..Alt-0 (F2..F10) : Chat windows."); - cons_show("Alt-LEFT : Previous chat window"); - cons_show("Alt-RIGHT : Next chat window"); + cons_show("Alt-1 : This console window."); + cons_show("F1 : This console window."); + cons_show("Alt-2..Alt-0 : Chat windows."); + cons_show("F2..F10 : Chat windows."); + cons_show("Alt-LEFT, Alt-RIGHT : Previous/next chat window"); cons_show("UP, DOWN : Navigate input history."); - cons_show("LEFT, RIGHT, HOME, END : Move cursor in current input."); - cons_show("Ctrl-LEFT, Ctrl-RIGHT : Jump word in input."); - cons_show("Ctrl-w, Alt-Backspace : Delete previous word in input."); + cons_show("Ctrl-n, Ctrl-p : Navigate input history."); + cons_show("LEFT, RIGHT, HOME, END : Move cursor."); + cons_show("Ctrl-b, Ctrl-f, Ctrl-a, Ctrl-e : Move cursor."); + cons_show("Ctrl-LEFT, Ctrl-RIGHT : Jump word."); + cons_show("Ctrl-w : Delete previous word."); + cons_show("Alt-Backspace : Delete previous word."); + cons_show("Backspace : Delete previous character."); + cons_show("DEL : Delete next character."); + cons_show("Ctrl-d : Delete next character."); cons_show("ESC : Clear current input."); + cons_show("Ctrl-u : Delete all previous characters."); cons_show("TAB : Autocomplete."); cons_show("PAGE UP, PAGE DOWN : Page the main window."); cons_show("Shift-UP, Shift-DOWN : Page occupants/roster panel."); @@ -1620,4 +1628,4 @@ _show_roster_contacts(GSList *list, gboolean show_groups) curr = g_slist_next(curr); } -} \ No newline at end of file +} diff --git a/src/ui/core.c b/src/ui/core.c index be3fd9a4..1c0089a1 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -2281,21 +2281,23 @@ _ui_draw_term_title(void) if (unread != 0) { snprintf(new_win_title, sizeof(new_win_title), - "%c]0;%s (%d) - %s%c", '\033', "Profanity", + "/bin/echo -n \"%c]0;%s (%d) - %s%c\"", '\033', "Profanity", unread, jid, '\007'); } else { snprintf(new_win_title, sizeof(new_win_title), - "%c]0;%s - %s%c", '\033', "Profanity", jid, + "/bin/echo -n \"%c]0;%s - %s%c\"", '\033', "Profanity", jid, '\007'); } } else { - snprintf(new_win_title, sizeof(new_win_title), "%c]0;%s%c", '\033', + snprintf(new_win_title, sizeof(new_win_title), "/bin/echo -n \"%c]0;%s%c\"", '\033', "Profanity", '\007'); } - if (g_strcmp0(win_title, new_win_title) != 0) { // print to x-window title bar - printf("%s", new_win_title); + int res = system(new_win_title); + if (res == -1) { + log_error("Error writing terminal window title."); + } if (win_title != NULL) { free(win_title); } diff --git a/src/ui/inputwin.c b/src/ui/inputwin.c index 4ed47601..4165bd3f 100644 --- a/src/ui/inputwin.c +++ b/src/ui/inputwin.c @@ -62,6 +62,16 @@ #define _inp_win_update_virtual() pnoutrefresh(inp_win, 0, pad_start, rows-1, 0, rows-1, cols-1) +#define KEY_CTRL_A 0001 +#define KEY_CTRL_B 0002 +#define KEY_CTRL_D 0004 +#define KEY_CTRL_E 0005 +#define KEY_CTRL_F 0006 +#define KEY_CTRL_N 0016 +#define KEY_CTRL_P 0020 +#define KEY_CTRL_U 0025 +#define KEY_CTRL_W 0027 + static WINDOW *inp_win; static int pad_start = 0; static int rows, cols; @@ -423,6 +433,7 @@ _handle_edit(int result, const wint_t ch, char *input, int *size) if (result != KEY_CODE_YES) { return 0; } + case KEY_CTRL_D: if (inp_x == display_size-1) { gchar *start = g_utf8_substring(input, 0, inp_x); for (*size = 0; *size < strlen(start); (*size)++) { @@ -459,6 +470,7 @@ _handle_edit(int result, const wint_t ch, char *input, int *size) if (result != KEY_CODE_YES) { return 0; } + case KEY_CTRL_B: if (inp_x > 0) { wmove(inp_win, 0, inp_x-1); @@ -474,6 +486,7 @@ _handle_edit(int result, const wint_t ch, char *input, int *size) if (result != KEY_CODE_YES) { return 0; } + case KEY_CTRL_F: if (inp_x < display_size) { wmove(inp_win, 0, inp_x+1); @@ -489,6 +502,7 @@ _handle_edit(int result, const wint_t ch, char *input, int *size) if (result != KEY_CODE_YES) { return 0; } + case KEY_CTRL_P: prev = cmd_history_previous(input, size); if (prev) { inp_replace_input(input, prev, size); @@ -499,6 +513,7 @@ _handle_edit(int result, const wint_t ch, char *input, int *size) if (result != KEY_CODE_YES) { return 0; } + case KEY_CTRL_N: next = cmd_history_next(input, size); if (next) { inp_replace_input(input, next, size); @@ -513,6 +528,7 @@ _handle_edit(int result, const wint_t ch, char *input, int *size) if (result != KEY_CODE_YES) { return 0; } + case KEY_CTRL_A: wmove(inp_win, 0, 0); pad_start = 0; _inp_win_update_virtual(); @@ -522,6 +538,7 @@ _handle_edit(int result, const wint_t ch, char *input, int *size) if (result != KEY_CODE_YES) { return 0; } + case KEY_CTRL_E: _go_to_end(display_size); return 1; @@ -535,10 +552,18 @@ _handle_edit(int result, const wint_t ch, char *input, int *size) } return 1; - case 23: // ctrl-w + case KEY_CTRL_W: _delete_previous_word(input, size); return 1; break; + + case KEY_CTRL_U: + while (getcurx(inp_win) > 0) { + _delete_previous_word(input, size); + } + return 1; + break; + default: return 0; } |