static KEYBOARD_REC *keyboard;
static ENTRY_REDIRECT_REC *redir;
+static int escape_next_key;
static int readtag;
static time_t idle_time;
str[utf16_char_to_utf8(key, str)] = '\0';
}
- if (!key_pressed(keyboard, str)) {
- /* key wasn't used for anything, print it */
+ if (escape_next_key || !key_pressed(keyboard, str)) {
+ /* key wasn't used for anything, print it */
+ escape_next_key = FALSE;
gui_entry_insert_char(active_entry, key);
}
}
char *str, *add_history;
str = gui_entry_get_text(active_entry);
- if (str == NULL || *str == '\0') {
+ if (str == NULL || (*str == '\0' && redir == NULL)) {
g_free(str);
return;
}
static void key_erase_line(void)
{
gui_entry_set_pos(active_entry, active_entry->text_len);
- gui_entry_erase(active_entry, active_entry->text_len);
+ gui_entry_erase(active_entry, active_entry->text_len, TRUE);
}
static void key_erase_to_beg_of_line(void)
int pos;
pos = gui_entry_get_pos(active_entry);
- gui_entry_erase(active_entry, pos);
+ gui_entry_erase(active_entry, pos, TRUE);
}
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);
+ gui_entry_erase(active_entry, active_entry->text_len - pos, TRUE);
}
static void key_yank_from_cutbuffer(void)
char *cutbuffer;
cutbuffer = gui_entry_get_cutbuffer(active_entry);
- if (cutbuffer != NULL)
+ if (cutbuffer != NULL) {
gui_entry_insert_text(active_entry, cutbuffer);
+ g_free(cutbuffer);
+ }
}
static void key_transpose_characters(void)
{
if (gui_entry_get_pos(active_entry) < active_entry->text_len) {
gui_entry_move_pos(active_entry, 1);
- gui_entry_erase(active_entry, 1);
+ gui_entry_erase(active_entry, 1, FALSE);
}
}
static void key_backspace(void)
{
- gui_entry_erase(active_entry, 1);
+ gui_entry_erase(active_entry, 1, FALSE);
}
static void key_delete_previous_word(void)
}
}
+static void key_escape(void)
+{
+ escape_next_key = TRUE;
+}
+
static void key_insert_text(const char *data)
{
char *str;
char *key, data[MAX_INT_STRLEN];
int n;
+ escape_next_key = FALSE;
redir = NULL;
idle_time = time(NULL);
input_listen_init(STDIN_FILENO);
/* window managing */
key_bind("previous_window", "Previous window", "^P", NULL, (SIGNAL_FUNC) key_previous_window);
- key_bind("left_window", "Window in left", "meta-left", NULL, (SIGNAL_FUNC) key_left_window);
key_bind("next_window", "Next window", "^N", NULL, (SIGNAL_FUNC) key_next_window);
- key_bind("right_window", "Window in right", "meta-right", NULL, (SIGNAL_FUNC) key_right_window);
key_bind("upper_window", "Upper window", "meta-up", NULL, (SIGNAL_FUNC) key_upper_window);
key_bind("lower_window", "Lower window", "meta-down", NULL, (SIGNAL_FUNC) key_lower_window);
+ key_bind("left_window", "Window in left", "meta-left", NULL, (SIGNAL_FUNC) key_left_window);
+ key_bind("right_window", "Window in right", "meta-right", NULL, (SIGNAL_FUNC) key_right_window);
key_bind("active_window", "Go to next window with the highest activity", "meta-a", NULL, (SIGNAL_FUNC) key_active_window);
key_bind("next_window_item", "Next channel/query", "^X", NULL, (SIGNAL_FUNC) key_next_window_item);
key_bind("previous_window_item", "Previous channel/query", NULL, NULL, (SIGNAL_FUNC) key_previous_window_item);
key_bind("scroll_end", "End of the window", "", NULL, (SIGNAL_FUNC) key_scroll_end);
/* inserting special input characters to line.. */
+ key_bind("escape_char", "Escape the next keypress", NULL, NULL, (SIGNAL_FUNC) key_escape);
key_bind("insert_text", "Append text to line", NULL, NULL, (SIGNAL_FUNC) key_insert_text);
/* autoreplaces */
key_unbind("yank_from_cutbuffer", (SIGNAL_FUNC) key_yank_from_cutbuffer);
key_unbind("transpose_characters", (SIGNAL_FUNC) key_transpose_characters);
+ key_unbind("send_line", (SIGNAL_FUNC) key_send_line);
key_unbind("word_completion", (SIGNAL_FUNC) key_word_completion);
+ key_unbind("erase_completion", (SIGNAL_FUNC) key_erase_completion);
key_unbind("check_replaces", (SIGNAL_FUNC) key_check_replaces);
key_unbind("previous_window", (SIGNAL_FUNC) key_previous_window);
key_unbind("next_window", (SIGNAL_FUNC) key_next_window);
key_unbind("upper_window", (SIGNAL_FUNC) key_upper_window);
key_unbind("lower_window", (SIGNAL_FUNC) key_lower_window);
+ key_unbind("left_window", (SIGNAL_FUNC) key_left_window);
+ key_unbind("right_window", (SIGNAL_FUNC) key_right_window);
key_unbind("active_window", (SIGNAL_FUNC) key_active_window);
key_unbind("next_window_item", (SIGNAL_FUNC) key_next_window_item);
key_unbind("previous_window_item", (SIGNAL_FUNC) key_previous_window_item);
key_unbind("scroll_start", (SIGNAL_FUNC) key_scroll_start);
key_unbind("scroll_end", (SIGNAL_FUNC) key_scroll_end);
+ key_unbind("escape_char", (SIGNAL_FUNC) key_escape);
key_unbind("insert_text", (SIGNAL_FUNC) key_insert_text);
key_unbind("change_window", (SIGNAL_FUNC) key_change_window);
key_unbind("stop_irc", (SIGNAL_FUNC) key_sig_stop);