diff options
-rw-r--r-- | NEWS | 16 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | docs/help/in/list.in | 6 | ||||
-rw-r--r-- | docs/help/in/servlist.in | 23 | ||||
-rw-r--r-- | docs/help/in/squery.in | 16 | ||||
-rw-r--r-- | src/common.h | 2 | ||||
-rw-r--r-- | src/core/chat-commands.c | 7 | ||||
-rw-r--r-- | src/core/commands.h | 3 | ||||
-rw-r--r-- | src/core/servers-setup.c | 4 | ||||
-rw-r--r-- | src/fe-common/core/fe-core-commands.c | 3 | ||||
-rw-r--r-- | src/fe-common/core/module-formats.c | 1 | ||||
-rw-r--r-- | src/fe-common/core/module-formats.h | 1 | ||||
-rw-r--r-- | src/fe-text/gui-entry.c | 178 | ||||
-rw-r--r-- | src/fe-text/gui-entry.h | 15 | ||||
-rw-r--r-- | src/fe-text/gui-readline.c | 64 | ||||
-rw-r--r-- | src/fe-text/term-terminfo.c | 10 | ||||
-rw-r--r-- | src/fe-text/term.h | 1 | ||||
-rw-r--r-- | src/fe-text/terminfo-core.c | 54 | ||||
-rw-r--r-- | src/fe-text/terminfo-core.h | 4 | ||||
-rw-r--r-- | src/irc/core/irc-commands.c | 6 |
20 files changed, 328 insertions, 88 deletions
@@ -1,8 +1,20 @@ -v0.8.18-head 2016-xx-xx The Irssi team <staff@irssi.org> +v0.8.20-head 2016-xx-xx The Irssi team <staff@irssi.org> * Removed --disable-ipv6 + irssiproxy can now forward all tags through a single port. + send channel -botcmds immediately when no mask is specified (#175). - - Correctly store te layout of SAFE channels (#183). + +v0.8.19 2016-03-23 The Irssi team <staff@irssi.org> + - Fixed regression when joining and parting channels on IRCnet (#435) + - Fixed SASL EXTERNAL (#432) + - Fixed regression when not using SASL (#438) + - Fixed incorrect SSL disconnects when using SSL from modules/scripts + (#439) + - Fixed regression where proxy_string could not be configured or + certain file transfers could not be accepted (#445) + - Fixed storing layout of !channels (#183) + - Fixed restoration of bracketed paste mode on quit (#449) + - Make the usage of meta-O for cursor keys configurable with + /set term_appkey_mode off v0.8.18 2016-02-13 The Irssi team <staff@irssi.org> * Modules will now require to define a diff --git a/configure.ac b/configure.ac index 19635ffd..2c47bd2b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(irssi, 0.8.19-head) +AC_INIT(irssi, 0.8.20-head) AC_CONFIG_SRCDIR([src]) AC_CONFIG_AUX_DIR(build-aux) AC_PREREQ(2.50) diff --git a/docs/help/in/list.in b/docs/help/in/list.in index 33f05e8b..b796eed0 100644 --- a/docs/help/in/list.in +++ b/docs/help/in/list.in @@ -25,10 +25,10 @@ %9Remarks:%9 Not all networks support server-side filtering and may provide a network - service instead; on IRCnet, you may use the ALIS service: + service or service bot instead; on IRCnet, you may use the List service: - /QUOTE SQUERY ALIS :HELP + /SQUERY List HELP /MSG ALIS HELP -%9See also:%9 QUOTE, STATS, WHOIS +%9See also:%9 STATS, SQUERY, WHOIS diff --git a/docs/help/in/servlist.in b/docs/help/in/servlist.in new file mode 100644 index 00000000..0a0d025f --- /dev/null +++ b/docs/help/in/servlist.in @@ -0,0 +1,23 @@ + +%9Syntax:%9 + +@SYNTAX:servlist@ + +%9Parameters:%9 + + <mask> limits the output to the services which names matches + the mask. + <type> limits the output to the services of the specified type. + +%9Description:%9 + + List the network services currently present on the + IRC network. + +%9Examples:%9 + + /SERVLIST *@javairc.* + /SERVLIST * 0xD000 + +%9See also:%9 SQUERY + diff --git a/docs/help/in/squery.in b/docs/help/in/squery.in new file mode 100644 index 00000000..59ee8008 --- /dev/null +++ b/docs/help/in/squery.in @@ -0,0 +1,16 @@ + +%9Syntax:%9 + +@SYNTAX:squery@ + +%9Parameters:%9 + + <service> - Service nickname or full hostmask of service to query. + <message> - Message to send to the service. + +%9Description:%9 + + /SQUERY sends a query to the specified service. + +%9See also:%9 SERVLIST, LIST, MSG + diff --git a/src/common.h b/src/common.h index 729049ab..33dbd481 100644 --- a/src/common.h +++ b/src/common.h @@ -6,7 +6,7 @@ #define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */ #define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */ -#define IRSSI_ABI_VERSION 2 +#define IRSSI_ABI_VERSION 3 #define DEFAULT_SERVER_ADD_PORT 6667 diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c index 7f000cf5..a9404fa3 100644 --- a/src/core/chat-commands.c +++ b/src/core/chat-commands.c @@ -73,6 +73,13 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr, conn = server_create_conn(proto != NULL ? proto->id : -1, addr, atoi(portstr), chatnet, password, nick); + if (conn == NULL) { + signal_emit("error command", 1, + GINT_TO_POINTER(CMDERR_NO_SERVER_DEFINED)); + cmd_params_free(free_arg); + return NULL; + } + if (proto == NULL) proto = chat_protocol_find_id(conn->chat_type); diff --git a/src/core/commands.h b/src/core/commands.h index 72105ad3..93d6276b 100644 --- a/src/core/commands.h +++ b/src/core/commands.h @@ -41,7 +41,8 @@ enum { CMDERR_INVALID_TIME, /* invalid time specification */ CMDERR_INVALID_CHARSET, /* invalid charset specification */ CMDERR_EVAL_MAX_RECURSE, /* eval hit recursion limit */ - CMDERR_PROGRAM_NOT_FOUND /* program not found */ + CMDERR_PROGRAM_NOT_FOUND, /* program not found */ + CMDERR_NO_SERVER_DEFINED, /* no server has been defined for a given chatnet */ }; /* Return the full command for `alias' */ diff --git a/src/core/servers-setup.c b/src/core/servers-setup.c index 4a048282..0cecfece 100644 --- a/src/core/servers-setup.c +++ b/src/core/servers-setup.c @@ -321,8 +321,8 @@ server_create_conn(int chat_type, const char *dest, int port, chatrec = chatnet_find(dest); if (chatrec != NULL) { rec = create_chatnet_conn(chatrec->name, port, password, nick); - if (rec != NULL) - return rec; + /* If rec is NULL the chatnet has no url to connect to */ + return rec; } chatrec = chatnet == NULL ? NULL : chatnet_find(chatnet); diff --git a/src/fe-common/core/fe-core-commands.c b/src/fe-common/core/fe-core-commands.c index 7b1d7b94..97a246ec 100644 --- a/src/fe-common/core/fe-core-commands.c +++ b/src/fe-common/core/fe-core-commands.c @@ -51,7 +51,8 @@ static int ret_texts[] = { TXT_INVALID_TIME, TXT_INVALID_CHARSET, TXT_EVAL_MAX_RECURSE, - TXT_PROGRAM_NOT_FOUND + TXT_PROGRAM_NOT_FOUND, + TXT_NO_SERVER_DEFINED, }; int command_hide_output; diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c index e6d32b6d..b897b0c6 100644 --- a/src/fe-common/core/module-formats.c +++ b/src/fe-common/core/module-formats.c @@ -223,6 +223,7 @@ FORMAT_REC fecommon_core_formats[] = { { "invalid_charset", "Invalid charset: $0", 1, { 0 } }, { "eval_max_recurse", "/eval hit maximum recursion limit", 0 }, { "program_not_found", "Could not find file or file is not executable", 0 }, + { "no_server_defined", "No servers defined for this network, see /help server for how to add one", 0 }, /* ---- */ { NULL, "Themes", 0 }, diff --git a/src/fe-common/core/module-formats.h b/src/fe-common/core/module-formats.h index 3f06bb97..de1e13f2 100644 --- a/src/fe-common/core/module-formats.h +++ b/src/fe-common/core/module-formats.h @@ -192,6 +192,7 @@ enum { TXT_INVALID_CHARSET, TXT_EVAL_MAX_RECURSE, TXT_PROGRAM_NOT_FOUND, + TXT_NO_SERVER_DEFINED, TXT_FILL_11, diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index 27778b2b..63dda34e 100644 --- a/src/fe-text/gui-entry.c +++ b/src/fe-text/gui-entry.c @@ -32,6 +32,8 @@ #undef i_tolower #undef i_isalnum +#define KILL_RING_MAX 10 + static unichar i_toupper(unichar c) { if (term_type == TERM_TYPE_UTF8) @@ -82,11 +84,22 @@ GUI_ENTRY_REC *gui_entry_create(int xpos, int ypos, int width, int utf8) void gui_entry_destroy(GUI_ENTRY_REC *entry) { + GSList *tmp; + g_return_if_fail(entry != NULL); if (active_entry == entry) gui_entry_set_active(NULL); + for (tmp = entry->kill_ring; tmp != NULL; tmp = tmp->next) { + GUI_ENTRY_CUTBUFFER_REC *rec = tmp->data; + if (rec != NULL) { + g_free(rec->cutbuffer); + g_free(rec); + } + } + g_slist_free(entry->kill_ring); + g_free(entry->text); g_free(entry->prompt); g_free(entry); @@ -546,22 +559,42 @@ char *gui_entry_get_cutbuffer(GUI_ENTRY_REC *entry) g_return_val_if_fail(entry != NULL, NULL); - if (entry->cutbuffer == NULL) + if (entry->kill_ring == NULL || entry->kill_ring->data == NULL) + return NULL; + + GUI_ENTRY_CUTBUFFER_REC *tmp = entry->kill_ring->data; + + if (tmp->cutbuffer == NULL) return NULL; if (entry->utf8) - buf = g_ucs4_to_utf8(entry->cutbuffer, -1, NULL, NULL, NULL); + buf = g_ucs4_to_utf8(tmp->cutbuffer, -1, NULL, NULL, NULL); else { - buf = g_malloc(entry->cutbuffer_len*6 + 1); + buf = g_malloc(tmp->cutbuffer_len*6 + 1); if (term_type == TERM_TYPE_BIG5) - unichars_to_big5(entry->cutbuffer, buf); + unichars_to_big5(tmp->cutbuffer, buf); else - for (i = 0; i <= entry->cutbuffer_len; i++) - buf[i] = entry->cutbuffer[i]; + for (i = 0; i <= tmp->cutbuffer_len; i++) + buf[i] = tmp->cutbuffer[i]; } return buf; } +char *gui_entry_get_next_cutbuffer(GUI_ENTRY_REC *entry) +{ + g_return_val_if_fail(entry != NULL, NULL); + + if (entry->kill_ring == NULL) + return NULL; + + GUI_ENTRY_CUTBUFFER_REC *tmp = entry->kill_ring->data; + + entry->kill_ring = g_slist_remove(entry->kill_ring, tmp); + entry->kill_ring = g_slist_append(entry->kill_ring, tmp); + + return gui_entry_get_cutbuffer(entry); +} + void gui_entry_erase_to(GUI_ENTRY_REC *entry, int pos, CUTBUFFER_UPDATE_OP update_cutbuffer) { int newpos, size = 0; @@ -573,6 +606,40 @@ void gui_entry_erase_to(GUI_ENTRY_REC *entry, int pos, CUTBUFFER_UPDATE_OP updat gui_entry_erase(entry, size, update_cutbuffer); } +static GUI_ENTRY_CUTBUFFER_REC *get_cutbuffer_rec(GUI_ENTRY_REC *entry, CUTBUFFER_UPDATE_OP update_cutbuffer) +{ + GUI_ENTRY_CUTBUFFER_REC *tmp = NULL; + + g_return_val_if_fail(entry != NULL, NULL); + + if (entry->kill_ring == NULL) { + /* no kill ring exists */ + entry->kill_ring = g_slist_prepend(entry->kill_ring, (void *)NULL); + } else { + tmp = entry->kill_ring->data; + + if (tmp != NULL && tmp->cutbuffer_len > 0 + && (!entry->previous_append_next_kill + || update_cutbuffer == CUTBUFFER_UPDATE_REPLACE)) { + /* a cutbuffer exists and should be replaced */ + entry->kill_ring = g_slist_prepend(entry->kill_ring, (void *)NULL); + } + } + + if (g_slist_length(entry->kill_ring) > KILL_RING_MAX) { + GUI_ENTRY_CUTBUFFER_REC *rec = g_slist_last(entry->kill_ring)->data; + entry->kill_ring = g_slist_remove(entry->kill_ring, rec); + if (rec != NULL) g_free(rec->cutbuffer); + g_free(rec); + } + + if (entry->kill_ring->data == NULL) { + entry->kill_ring->data = g_new0(GUI_ENTRY_CUTBUFFER_REC, 1); + } + + return entry->kill_ring->data; +} + void gui_entry_erase(GUI_ENTRY_REC *entry, int size, CUTBUFFER_UPDATE_OP update_cutbuffer) { size_t w = 0; @@ -582,50 +649,59 @@ void gui_entry_erase(GUI_ENTRY_REC *entry, int size, CUTBUFFER_UPDATE_OP update_ if (size == 0 || entry->pos < size) return; - if (entry->cutbuffer_len == 0) { - update_cutbuffer = CUTBUFFER_UPDATE_REPLACE; - } - int cutbuffer_new_size = entry->cutbuffer_len + size; - unichar *tmpcutbuffer = entry->cutbuffer; - switch (update_cutbuffer) { - case CUTBUFFER_UPDATE_APPEND: - entry->cutbuffer = g_new(unichar, cutbuffer_new_size+1); - memcpy(entry->cutbuffer, tmpcutbuffer, - entry->cutbuffer_len * sizeof(unichar)); - memcpy(entry->cutbuffer + entry->cutbuffer_len * sizeof(unichar), - entry->text + entry->pos - size, size * sizeof(unichar)); - - entry->cutbuffer_len = cutbuffer_new_size; - entry->cutbuffer[cutbuffer_new_size] = '\0'; - g_free(tmpcutbuffer); - break; - - case CUTBUFFER_UPDATE_PREPEND: - entry->cutbuffer = g_new(unichar, cutbuffer_new_size+1); - memcpy(entry->cutbuffer, entry->text + entry->pos - size, - size * sizeof(unichar)); - memcpy(entry->cutbuffer + size, tmpcutbuffer, - entry->cutbuffer_len * sizeof(unichar)); - - entry->cutbuffer_len = cutbuffer_new_size; - entry->cutbuffer[cutbuffer_new_size] = '\0'; - g_free(tmpcutbuffer); - break; - - case CUTBUFFER_UPDATE_REPLACE: - /* put erased text to cutbuffer */ - if (entry->cutbuffer_len < size) { - g_free(entry->cutbuffer); - entry->cutbuffer = g_new(unichar, size+1); - } + if (update_cutbuffer != CUTBUFFER_UPDATE_NOOP) { + int cutbuffer_new_size; + unichar *tmpcutbuffer; + GUI_ENTRY_CUTBUFFER_REC *tmp = get_cutbuffer_rec(entry, update_cutbuffer); - entry->cutbuffer_len = size; - entry->cutbuffer[size] = '\0'; - memcpy(entry->cutbuffer, entry->text + entry->pos - size, size * sizeof(unichar)); - break; + if (tmp->cutbuffer_len == 0) { + update_cutbuffer = CUTBUFFER_UPDATE_REPLACE; + } - case CUTBUFFER_UPDATE_NOOP: - break; + cutbuffer_new_size = tmp->cutbuffer_len + size; + tmpcutbuffer = tmp->cutbuffer; + entry->append_next_kill = TRUE; + switch (update_cutbuffer) { + case CUTBUFFER_UPDATE_APPEND: + tmp->cutbuffer = g_new(unichar, cutbuffer_new_size+1); + memcpy(tmp->cutbuffer, tmpcutbuffer, + tmp->cutbuffer_len * sizeof(unichar)); + memcpy(tmp->cutbuffer + tmp->cutbuffer_len * sizeof(unichar), + entry->text + entry->pos - size, size * sizeof(unichar)); + + tmp->cutbuffer_len = cutbuffer_new_size; + tmp->cutbuffer[cutbuffer_new_size] = '\0'; + g_free(tmpcutbuffer); + break; + + case CUTBUFFER_UPDATE_PREPEND: + tmp->cutbuffer = g_new(unichar, cutbuffer_new_size+1); + memcpy(tmp->cutbuffer, entry->text + entry->pos - size, + size * sizeof(unichar)); + memcpy(tmp->cutbuffer + size, tmpcutbuffer, + tmp->cutbuffer_len * sizeof(unichar)); + + tmp->cutbuffer_len = cutbuffer_new_size; + tmp->cutbuffer[cutbuffer_new_size] = '\0'; + g_free(tmpcutbuffer); + break; + + case CUTBUFFER_UPDATE_REPLACE: + /* put erased text to cutbuffer */ + if (tmp->cutbuffer_len < size) { + g_free(tmp->cutbuffer); + tmp->cutbuffer = g_new(unichar, size+1); + } + + tmp->cutbuffer_len = size; + tmp->cutbuffer[size] = '\0'; + memcpy(tmp->cutbuffer, entry->text + entry->pos - size, size * sizeof(unichar)); + break; + + case CUTBUFFER_UPDATE_NOOP: + /* cannot happen, handled in "if" */ + break; + } } if (entry->utf8) @@ -685,10 +761,10 @@ void gui_entry_erase_word(GUI_ENTRY_REC *entry, int to_space, CUTBUFFER_UPDATE_O } if (to > 0) to++; - gui_entry_erase(entry, entry->pos-to, CUTBUFFER_UPDATE_REPLACE); + gui_entry_erase(entry, entry->pos-to, cutbuffer_op); } -void gui_entry_erase_next_word(GUI_ENTRY_REC *entry, int to_space) +void gui_entry_erase_next_word(GUI_ENTRY_REC *entry, int to_space, CUTBUFFER_UPDATE_OP cutbuffer_op) { int to, size; @@ -711,7 +787,7 @@ void gui_entry_erase_next_word(GUI_ENTRY_REC *entry, int to_space) size = to-entry->pos; entry->pos = to; - gui_entry_erase(entry, size, CUTBUFFER_UPDATE_REPLACE); + gui_entry_erase(entry, size, cutbuffer_op); } void gui_entry_transpose_chars(GUI_ENTRY_REC *entry) diff --git a/src/fe-text/gui-entry.h b/src/fe-text/gui-entry.h index d22a7fb8..8777f083 100644 --- a/src/fe-text/gui-entry.h +++ b/src/fe-text/gui-entry.h @@ -2,11 +2,15 @@ #define __GUI_ENTRY_H typedef struct { + int cutbuffer_len; + unichar *cutbuffer; +} GUI_ENTRY_CUTBUFFER_REC; + +typedef struct { int text_len, text_alloc; /* as shorts, not chars */ unichar *text; - int cutbuffer_len; - unichar *cutbuffer; + GSList *kill_ring; /* all as shorts, not chars */ int xpos, ypos, width; /* entry position in screen */ @@ -18,6 +22,10 @@ typedef struct { int redraw_needed_from; unsigned int utf8:1; + + unsigned int previous_append_next_kill:1; + unsigned int append_next_kill:1; + unsigned int yank_preceded:1; } GUI_ENTRY_REC; typedef enum { @@ -47,11 +55,12 @@ void gui_entry_insert_text(GUI_ENTRY_REC *entry, const char *str); void gui_entry_insert_char(GUI_ENTRY_REC *entry, unichar chr); char *gui_entry_get_cutbuffer(GUI_ENTRY_REC *entry); +char *gui_entry_get_next_cutbuffer(GUI_ENTRY_REC *entry); void gui_entry_erase_to(GUI_ENTRY_REC *entry, int pos, CUTBUFFER_UPDATE_OP update_cutbuffer); void gui_entry_erase(GUI_ENTRY_REC *entry, int size, CUTBUFFER_UPDATE_OP update_cutbuffer); void gui_entry_erase_cell(GUI_ENTRY_REC *entry); void gui_entry_erase_word(GUI_ENTRY_REC *entry, int to_space, CUTBUFFER_UPDATE_OP cutbuffer_op); -void gui_entry_erase_next_word(GUI_ENTRY_REC *entry, int to_space); +void gui_entry_erase_next_word(GUI_ENTRY_REC *entry, int to_space, CUTBUFFER_UPDATE_OP cutbuffer_op); void gui_entry_transpose_chars(GUI_ENTRY_REC *entry); void gui_entry_transpose_words(GUI_ENTRY_REC *entry); diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index ff91f9e3..e0ffb4f1 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -73,6 +73,7 @@ static int paste_timeout_id; static int paste_use_bracketed_mode; static int paste_bracketed_mode; static int paste_was_bracketed_mode; +static int previous_yank_preceded; /* Terminal sequences that surround the input when the terminal has the * bracketed paste mode active. Fror more details see @@ -440,11 +441,20 @@ static void sig_gui_key_pressed(gpointer keyp) gui_entry_insert_char(active_entry, key); ret = 1; } else { + previous_yank_preceded = active_entry->yank_preceded; + active_entry->yank_preceded = FALSE; + active_entry->previous_append_next_kill = active_entry->append_next_kill; + active_entry->append_next_kill = FALSE; ret = key_pressed(keyboard, str); if (ret < 0) { /* key wasn't used for anything, print it */ gui_entry_insert_char(active_entry, key); } + if (ret == 0) { + /* combo not complete, ignore append_next_kill and yank_preceded */ + active_entry->append_next_kill = active_entry->previous_append_next_kill; + active_entry->yank_preceded = previous_yank_preceded; + } } /* ret = 0 : some key create multiple characters - we're in the middle @@ -571,7 +581,7 @@ static void key_erase_to_beg_of_line(void) int pos; pos = gui_entry_get_pos(active_entry); - gui_entry_erase(active_entry, pos, CUTBUFFER_UPDATE_REPLACE); + gui_entry_erase(active_entry, pos, CUTBUFFER_UPDATE_PREPEND); } static void key_erase_to_end_of_line(void) @@ -580,7 +590,7 @@ static void key_erase_to_end_of_line(void) pos = gui_entry_get_pos(active_entry); gui_entry_set_pos(active_entry, active_entry->text_len); - gui_entry_erase(active_entry, active_entry->text_len - pos, CUTBUFFER_UPDATE_REPLACE); + gui_entry_erase(active_entry, active_entry->text_len - pos, CUTBUFFER_UPDATE_APPEND); } static void key_yank_from_cutbuffer(void) @@ -590,7 +600,36 @@ static void key_yank_from_cutbuffer(void) cutbuffer = gui_entry_get_cutbuffer(active_entry); if (cutbuffer != NULL) { gui_entry_insert_text(active_entry, cutbuffer); - g_free(cutbuffer); + active_entry->yank_preceded = TRUE; + g_free(cutbuffer); + } +} + +static void key_yank_next_cutbuffer(void) +{ + GUI_ENTRY_CUTBUFFER_REC *rec; + guint length = 0; + char *cutbuffer; + + if (!previous_yank_preceded) { + if (settings_get_bool("bell_beeps")) { + signal_emit("beep", 0); + } + return; + } + + if (active_entry->kill_ring == NULL) + return; + + rec = active_entry->kill_ring->data; + if (rec != NULL) length = rec->cutbuffer_len; + + cutbuffer = gui_entry_get_next_cutbuffer(active_entry); + if (cutbuffer != NULL) { + gui_entry_erase(active_entry, length, CUTBUFFER_UPDATE_NOOP); + gui_entry_insert_text(active_entry, cutbuffer); + active_entry->yank_preceded = TRUE; + g_free(cutbuffer); } } @@ -632,22 +671,27 @@ static void key_backspace(void) static void key_delete_previous_word(void) { - gui_entry_erase_word(active_entry, FALSE, CUTBUFFER_UPDATE_REPLACE); + gui_entry_erase_word(active_entry, FALSE, CUTBUFFER_UPDATE_PREPEND); } static void key_delete_next_word(void) { - gui_entry_erase_next_word(active_entry, FALSE); + gui_entry_erase_next_word(active_entry, FALSE, CUTBUFFER_UPDATE_APPEND); } static void key_delete_to_previous_space(void) { - gui_entry_erase_word(active_entry, TRUE, CUTBUFFER_UPDATE_REPLACE); + gui_entry_erase_word(active_entry, TRUE, CUTBUFFER_UPDATE_PREPEND); } static void key_delete_to_next_space(void) { - gui_entry_erase_next_word(active_entry, TRUE); + gui_entry_erase_next_word(active_entry, TRUE, CUTBUFFER_UPDATE_APPEND); +} + +static void key_append_next_kill(void) +{ + active_entry->append_next_kill = TRUE; } static gboolean paste_timeout(gpointer data) @@ -1060,6 +1104,7 @@ static void setup_changed(void) paste_join_multiline = settings_get_bool("paste_join_multiline"); paste_use_bracketed_mode = settings_get_bool("paste_use_bracketed_mode"); + term_set_appkey_mode(settings_get_bool("term_appkey_mode")); /* Enable the bracketed paste mode on demand */ term_set_bracketed_paste_mode(paste_use_bracketed_mode); } @@ -1082,6 +1127,7 @@ void gui_readline_init(void) g_get_current_time(&last_keypress); input_listen_init(STDIN_FILENO); + settings_add_bool("lookandfeel", "term_appkey_mode", TRUE); settings_add_str("history", "scroll_page_count", "/2"); settings_add_time("misc", "paste_detect_time", "5msecs"); settings_add_bool("misc", "paste_use_bracketed_mode", FALSE); @@ -1189,6 +1235,8 @@ void gui_readline_init(void) key_bind("erase_to_beg_of_line", "Erase everything before the cursor", NULL, NULL, (SIGNAL_FUNC) key_erase_to_beg_of_line); key_bind("erase_to_end_of_line", "Erase everything after the cursor", "^K", NULL, (SIGNAL_FUNC) key_erase_to_end_of_line); key_bind("yank_from_cutbuffer", "\"Undelete\", paste the last deleted text", "^Y", NULL, (SIGNAL_FUNC) key_yank_from_cutbuffer); + key_bind("yank_next_cutbuffer", "Revert to the previous last deleted text", NULL, NULL, (SIGNAL_FUNC) key_yank_next_cutbuffer); + key_bind("append_next_kill", "Append next deletion", NULL, NULL, (SIGNAL_FUNC) key_append_next_kill); key_bind("transpose_characters", "Swap current and previous character", "^T", NULL, (SIGNAL_FUNC) key_transpose_characters); key_bind("transpose_words", "Swap current and previous word", NULL, NULL, (SIGNAL_FUNC) key_transpose_words); key_bind("capitalize_word", "Capitalize the current word", NULL, NULL, (SIGNAL_FUNC) key_capitalize_word); @@ -1278,6 +1326,8 @@ void gui_readline_deinit(void) key_unbind("erase_to_beg_of_line", (SIGNAL_FUNC) key_erase_to_beg_of_line); key_unbind("erase_to_end_of_line", (SIGNAL_FUNC) key_erase_to_end_of_line); key_unbind("yank_from_cutbuffer", (SIGNAL_FUNC) key_yank_from_cutbuffer); + key_unbind("yank_next_cutbuffer", (SIGNAL_FUNC) key_yank_next_cutbuffer); + key_unbind("append_next_kill", (SIGNAL_FUNC) key_append_next_kill); key_unbind("transpose_characters", (SIGNAL_FUNC) key_transpose_characters); key_unbind("transpose_words", (SIGNAL_FUNC) key_transpose_words); diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c index 3582b9e4..b2478c62 100644 --- a/src/fe-text/term-terminfo.c +++ b/src/fe-text/term-terminfo.c @@ -611,8 +611,6 @@ void term_stop(void) { terminfo_stop(current_term); kill(getpid(), SIGTSTP); - terminfo_cont(current_term); - irssi_redraw(); } static int input_utf8(const unsigned char *buffer, int size, unichar *result) @@ -710,11 +708,3 @@ void term_gets(GArray *buffer, int *line_count) } } } - -void term_set_bracketed_paste_mode(int enable) -{ - if (enable) - tputs("\e[?2004h", 0, term_putchar); - else - tputs("\e[?2004l", 0, term_putchar); -} diff --git a/src/fe-text/term.h b/src/fe-text/term.h index 5f0a799e..9b726d82 100644 --- a/src/fe-text/term.h +++ b/src/fe-text/term.h @@ -94,6 +94,7 @@ void term_refresh(TERM_WINDOW *window); void term_stop(void); +void term_set_appkey_mode(int enable); void term_set_bracketed_paste_mode(int enable); /* keyboard input handling */ diff --git a/src/fe-text/terminfo-core.c b/src/fe-text/terminfo-core.c index 60927f1a..15b00081 100644 --- a/src/fe-text/terminfo-core.c +++ b/src/fe-text/terminfo-core.c @@ -395,6 +395,20 @@ static void _ignore_parm(TERM_REC *term, int param) { } +static void terminfo_set_appkey_mode(TERM_REC *term, int set) +{ + if (term->TI_smkx && term->TI_rmkx) + tput(tparm(set ? term->TI_smkx : term->TI_rmkx)); +} + +static void term_dec_set_bracketed_paste_mode(int enable) +{ + if (enable) + tputs("\e[?2004h", 0, term_putchar); + else + tputs("\e[?2004l", 0, term_putchar); +} + static void term_fill_capabilities(TERM_REC *term) { int i, ival; @@ -496,7 +510,7 @@ void terminfo_setup_colors(TERM_REC *term, int force) } } -static void terminfo_input_init(TERM_REC *term) +static void terminfo_input_init0(TERM_REC *term) { tcgetattr(fileno(term->in), &term->old_tio); memcpy(&term->tio, &term->old_tio, sizeof(term->tio)); @@ -518,8 +532,11 @@ static void terminfo_input_init(TERM_REC *term) term->tio.c_cc[VSUSP] = _POSIX_VDISABLE; #endif - tcsetattr(fileno(term->in), TCSADRAIN, &term->tio); +} +static void terminfo_input_init(TERM_REC *term) +{ + tcsetattr(fileno(term->in), TCSADRAIN, &term->tio); } static void terminfo_input_deinit(TERM_REC *term) @@ -532,8 +549,11 @@ void terminfo_cont(TERM_REC *term) if (term->TI_smcup) tput(tparm(term->TI_smcup)); - if (term->TI_smkx) - tput(tparm(term->TI_smkx)); + if (term->appkey_enabled) + terminfo_set_appkey_mode(term, TRUE); + + if (term->bracketed_paste_enabled) + term_dec_set_bracketed_paste_mode(TRUE); terminfo_input_init(term); } @@ -545,12 +565,15 @@ void terminfo_stop(TERM_REC *term) /* move cursor to bottom of the screen */ terminfo_move(0, term->height-1); + if (term->bracketed_paste_enabled) + term_dec_set_bracketed_paste_mode(FALSE); + /* stop cup-mode */ if (term->TI_rmcup) tput(tparm(term->TI_rmcup)); - if (term->TI_rmkx) - tput(tparm(term->TI_rmkx)); + if (term->appkey_enabled) + terminfo_set_appkey_mode(term, FALSE); /* reset input settings */ terminfo_input_deinit(term); @@ -673,10 +696,29 @@ static int term_setup(TERM_REC *term) term->beep = term->TI_bel ? _beep : _ignore; terminfo_setup_colors(term, FALSE); + terminfo_input_init0(term); terminfo_cont(term); return 1; } +void term_set_appkey_mode(int enable) +{ + if (current_term->appkey_enabled == enable) + return; + + current_term->appkey_enabled = enable; + terminfo_set_appkey_mode(current_term, enable); +} + +void term_set_bracketed_paste_mode(int enable) +{ + if (current_term->bracketed_paste_enabled == enable) + return; + + current_term->bracketed_paste_enabled = enable; + term_dec_set_bracketed_paste_mode(enable); +} + TERM_REC *terminfo_core_init(FILE *in, FILE *out) { TERM_REC *old_term, *term; diff --git a/src/fe-text/terminfo-core.h b/src/fe-text/terminfo-core.h index 21398791..1253fd9d 100644 --- a/src/fe-text/terminfo-core.h +++ b/src/fe-text/terminfo-core.h @@ -92,6 +92,10 @@ struct _TERM_REC { /* Keyboard-transmit mode */ const char *TI_smkx; const char *TI_rmkx; + + /* Terminal mode states */ + int appkey_enabled; + int bracketed_paste_enabled; }; extern TERM_REC *current_term; diff --git a/src/irc/core/irc-commands.c b/src/irc/core/irc-commands.c index 6baf2f6d..32ee8845 100644 --- a/src/irc/core/irc-commands.c +++ b/src/irc/core/irc-commands.c @@ -1018,11 +1018,15 @@ void irc_commands_init(void) command_bind_irc("trace", NULL, (SIGNAL_FUNC) command_self); /* SYNTAX: VERSION [<server>|<nick>] */ command_bind_irc("version", NULL, (SIGNAL_FUNC) command_self); + /* SYNTAX: SERVLIST [<mask> [<type>]] */ + command_bind_irc("servlist", NULL, (SIGNAL_FUNC) command_self); /* SYNTAX: SILENCE [[+|-]<nick!user@host>] SILENCE [<nick>] */ command_bind_irc("silence", NULL, (SIGNAL_FUNC) command_self); command_bind_irc("unsilence", NULL, (SIGNAL_FUNC) cmd_unsilence); command_bind_irc("sconnect", NULL, (SIGNAL_FUNC) cmd_sconnect); + /* SYNTAX: SQUERY <service> [<message>] */ + command_bind_irc("squery", NULL, (SIGNAL_FUNC) command_2self); /* SYNTAX: DIE */ command_bind_irc("die", NULL, (SIGNAL_FUNC) command_self); /* SYNTAX: HASH */ @@ -1091,9 +1095,11 @@ void irc_commands_deinit(void) command_unbind("time", (SIGNAL_FUNC) command_self); command_unbind("trace", (SIGNAL_FUNC) command_self); command_unbind("version", (SIGNAL_FUNC) command_self); + command_unbind("servlist", (SIGNAL_FUNC) command_self); command_unbind("silence", (SIGNAL_FUNC) command_self); command_unbind("unsilence", (SIGNAL_FUNC) cmd_unsilence); command_unbind("sconnect", (SIGNAL_FUNC) cmd_sconnect); + command_unbind("squery", (SIGNAL_FUNC) command_2self); command_unbind("die", (SIGNAL_FUNC) command_self); command_unbind("hash", (SIGNAL_FUNC) command_self); command_unbind("oper", (SIGNAL_FUNC) cmd_oper); |