1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Merge remote-tracking branch 'upstream/master' into exit-title

This commit is contained in:
Will Song 2015-01-03 12:41:42 -06:00
commit 30610f7c48
6 changed files with 52 additions and 15 deletions

View File

@ -8,3 +8,4 @@
- Show or hide and customise roster panel (/roster)
- /account remove
- Added default account for /connect
- Additional readline style shortcuts

View File

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

View File

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

View File

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

View File

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

View File

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