mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 07:16:37 +02:00
Added paste detection, new options look_paste_max_lines and col_input_actions (task #5442)
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2007-08-12
|
||||
ChangeLog - 2007-08-17
|
||||
|
||||
|
||||
Version 0.2.6 (under dev!):
|
||||
* added paste detection, new options look_paste_max_lines and
|
||||
col_input_actions (task #5442)
|
||||
* fixed bug with highlight and UTF-8 chars around word (bug #20753)
|
||||
* added swedish quickstart guide
|
||||
* added support of channel mode +u (channel user) (bug #20717)
|
||||
|
||||
+16
-2
@@ -108,7 +108,7 @@
|
||||
<entry>Ganzzahl</entry>
|
||||
<entry>zwischen 0 und 100</entry>
|
||||
<entry>0</entry>
|
||||
<entry>Maximale Größe der Nicklist (Breite oder Höhe, je nach look_nicklist_position (0: kein Maximum); Wenn min == max > 0, ist die Größe fest.</entry>
|
||||
<entry>Max size for nicklist (width or height, depending on look_nicklist_position (0 = no max size; if min = max and > 0, then size is fixed))</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nicklist_separator</option></entry>
|
||||
@@ -292,10 +292,17 @@
|
||||
<entry>'[%n(%m)] '</entry>
|
||||
<entry>Format der Eingabezeile ('%c' wird durch den Channel- oder Servernamen ersetzt, '%n' durch den Nicknamen und '%m' durch die Nick-Modi)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_paste_max_lines</option></entry>
|
||||
<entry>Ganzzahl</entry>
|
||||
<entry>zwischen 0 und 2147483647</entry>
|
||||
<entry>3</entry>
|
||||
<entry>Max number of lines for paste without asking user (0 = disable this feature)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_real_white</option></entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>zwischen 0 und 2147483647</entry>
|
||||
<entry>'off'</entry>
|
||||
<entry>Wenn gesetzt, benutze echtes Weiß, als Voreinstellung jedoch für Terminals mit weißem Hintergrund deaktiviert (solltest du niemals einen weißen Hintergrund benutzen, solltest du diese Option aktivieren um ein echtes Weiß anstelle der voreingestellten Terminal Vordergrundfarbe zu bekommen)</entry>
|
||||
</row>
|
||||
@@ -572,6 +579,13 @@
|
||||
<entry>'red'</entry>
|
||||
<entry>Farbe für den Text nicht gefunden</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_actions</option></entry>
|
||||
<entry>Farbe</entry>
|
||||
<entry>Curses- oder Gtk-Farben</entry>
|
||||
<entry>'lightgreen'</entry>
|
||||
<entry>Color for actions in input window</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_bg</option></entry>
|
||||
<entry>Farbe</entry>
|
||||
|
||||
+15
-1
@@ -108,7 +108,7 @@
|
||||
<entry>integer</entry>
|
||||
<entry>between 0 and 100</entry>
|
||||
<entry>0</entry>
|
||||
<entry>Max size for nicklist (width or height, depending on look_nicklist_position (0 = no max size; if min == max and > 0, then size is fixed))</entry>
|
||||
<entry>Max size for nicklist (width or height, depending on look_nicklist_position (0 = no max size; if min = max and > 0, then size is fixed))</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nicklist_separator</option></entry>
|
||||
@@ -292,6 +292,13 @@
|
||||
<entry>'[%n(%m)] '</entry>
|
||||
<entry>Format for input prompt ('%c' is replaced by channel or server, '%n' by nick and '%m' by nick modes)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_paste_max_lines</option></entry>
|
||||
<entry>integer</entry>
|
||||
<entry>between 0 and 2147483647</entry>
|
||||
<entry>3</entry>
|
||||
<entry>Max number of lines for paste without asking user (0 = disable this feature)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_real_white</option></entry>
|
||||
<entry>boolean</entry>
|
||||
@@ -572,6 +579,13 @@
|
||||
<entry>'red'</entry>
|
||||
<entry>Color for text not found</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_actions</option></entry>
|
||||
<entry>color</entry>
|
||||
<entry>Curses or Gtk color</entry>
|
||||
<entry>'lightgreen'</entry>
|
||||
<entry>Color for actions in input window</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_bg</option></entry>
|
||||
<entry>color</entry>
|
||||
|
||||
+15
-1
@@ -108,7 +108,7 @@
|
||||
<entry>entier</entry>
|
||||
<entry>entre 0 et 100</entry>
|
||||
<entry>0</entry>
|
||||
<entry>Taille maximum pour la fenêtre des pseudos (largeur ou hauteur, selon look_nicklist_position (0 = pas de taille maximum; si min == max et > 0, alors la taille est fixe))</entry>
|
||||
<entry>Taille maximum pour la fenêtre des pseudos (largeur ou hauteur, selon look_nicklist_position (0 = pas de taille maximum; si min = max et > 0, alors la taille est fixe))</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nicklist_separator</option></entry>
|
||||
@@ -292,6 +292,13 @@
|
||||
<entry>'[%n(%m)] '</entry>
|
||||
<entry>Format pour l'invite de la zone de saisie ('%c' est remplacé par le canal ou serveur, '%n' par le pseudo et '%m' par les modes du pseudo)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_paste_max_lines</option></entry>
|
||||
<entry>entier</entry>
|
||||
<entry>entre 0 et 2147483647</entry>
|
||||
<entry>3</entry>
|
||||
<entry>Nombre maximum de lignes pour la détection de collage sans demander à l'utilisateur (0 = désactiver cette fonctionnalité)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_real_white</option></entry>
|
||||
<entry>booléen</entry>
|
||||
@@ -572,6 +579,13 @@
|
||||
<entry>'red'</entry>
|
||||
<entry>Couleur pour le texte non trouvé</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_actions</option></entry>
|
||||
<entry>couleur</entry>
|
||||
<entry>couleur Curses ou Gtk</entry>
|
||||
<entry>'lightgreen'</entry>
|
||||
<entry>Couleur pour les actions dans la fenêtre de saisie</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_bg</option></entry>
|
||||
<entry>couleur</entry>
|
||||
|
||||
+685
-667
File diff suppressed because it is too large
Load Diff
+11
-1
@@ -115,6 +115,7 @@ int cfg_look_day_change;
|
||||
char *cfg_look_day_change_timestamp;
|
||||
char *cfg_look_read_marker;
|
||||
char *cfg_look_input_format;
|
||||
int cfg_look_paste_max_lines;
|
||||
|
||||
t_config_option weechat_options_look[] =
|
||||
{ { "look_save_on_exit", N_("save config file on exit"),
|
||||
@@ -176,7 +177,7 @@ t_config_option weechat_options_look[] =
|
||||
NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_buffers },
|
||||
{ "look_nicklist_max_size", N_("max size for nicklist"),
|
||||
N_("max size for nicklist (width or height, depending on look_nicklist_position "
|
||||
"(0 = no max size; if min == max and > 0, then size is fixed))"),
|
||||
"(0 = no max size; if min = max and > 0, then size is fixed))"),
|
||||
OPTION_TYPE_INT, 0, 100, 0,
|
||||
NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_buffers },
|
||||
{ "look_nicklist_separator", N_("separator between chat and nicklist"),
|
||||
@@ -288,6 +289,10 @@ t_config_option weechat_options_look[] =
|
||||
"'%n' by nick and '%m' by nick modes)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"[%n(%m)] ", NULL, NULL, &cfg_look_input_format, config_change_buffer_content },
|
||||
{ "look_paste_max_lines", N_("max number of lines for paste without asking user"),
|
||||
N_("max number of lines for paste without asking user (0 = disable this feature)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 3,
|
||||
NULL, NULL, &cfg_look_paste_max_lines, NULL, &config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -333,6 +338,7 @@ int cfg_col_input_channel;
|
||||
int cfg_col_input_nick;
|
||||
int cfg_col_input_delimiters;
|
||||
int cfg_col_input_text_not_found;
|
||||
int cfg_col_input_actions;
|
||||
int cfg_col_input_bg;
|
||||
int cfg_col_nick;
|
||||
int cfg_col_nick_away;
|
||||
@@ -530,6 +536,10 @@ t_config_option weechat_options_colors[] =
|
||||
N_("color for text not found"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"red", NULL, &cfg_col_input_text_not_found, NULL, &config_change_color },
|
||||
{ "col_input_actions", N_("color for actions in input window"),
|
||||
N_("color for actions in input window"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightgreen", NULL, &cfg_col_input_actions, NULL, &config_change_color },
|
||||
{ "col_input_bg", N_("background for input window"),
|
||||
N_("background for input window"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
|
||||
@@ -134,6 +134,7 @@ extern int cfg_look_day_change;
|
||||
extern char *cfg_look_day_change_timestamp;
|
||||
extern char *cfg_look_read_marker;
|
||||
extern char *cfg_look_input_format;
|
||||
extern int cfg_look_paste_max_lines;
|
||||
|
||||
extern int cfg_col_real_white;
|
||||
extern int cfg_col_separator;
|
||||
@@ -175,6 +176,7 @@ extern int cfg_col_input_channel;
|
||||
extern int cfg_col_input_nick;
|
||||
extern int cfg_col_input_delimiters;
|
||||
extern int cfg_col_input_text_not_found;
|
||||
extern int cfg_col_input_actions;
|
||||
extern int cfg_col_input_bg;
|
||||
extern int cfg_col_nick;
|
||||
extern int cfg_col_nick_away;
|
||||
|
||||
@@ -529,6 +529,7 @@ gui_color_init_weechat ()
|
||||
gui_color[GUI_COLOR_WIN_INPUT_NICK] = gui_color_build (GUI_COLOR_WIN_INPUT_NICK, cfg_col_input_nick, cfg_col_input_bg);
|
||||
gui_color[GUI_COLOR_WIN_INPUT_DELIMITERS] = gui_color_build (GUI_COLOR_WIN_INPUT_DELIMITERS, cfg_col_input_delimiters, cfg_col_input_bg);
|
||||
gui_color[GUI_COLOR_WIN_INPUT_TEXT_NOT_FOUND] = gui_color_build (GUI_COLOR_WIN_INPUT_TEXT_NOT_FOUND, cfg_col_input_text_not_found, cfg_col_input_bg);
|
||||
gui_color[GUI_COLOR_WIN_INPUT_ACTIONS] = gui_color_build (GUI_COLOR_WIN_INPUT_ACTIONS, cfg_col_input_actions, cfg_col_input_bg);
|
||||
gui_color[GUI_COLOR_WIN_NICK] = gui_color_build (GUI_COLOR_WIN_NICK, cfg_col_nick, cfg_col_nick_bg);
|
||||
gui_color[GUI_COLOR_WIN_NICK_AWAY] = gui_color_build (GUI_COLOR_WIN_NICK_AWAY, cfg_col_nick_away, cfg_col_nick_bg);
|
||||
gui_color[GUI_COLOR_WIN_NICK_CHANOWNER] = gui_color_build (GUI_COLOR_WIN_NICK_CHANOWNER, cfg_col_nick_chanowner, cfg_col_nick_bg);
|
||||
|
||||
+123
-103
@@ -377,119 +377,139 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
if (erase)
|
||||
gui_window_curses_clear (GUI_CURSES(ptr_win)->win_input, GUI_COLOR_WIN_INPUT);
|
||||
|
||||
switch (buffer->type)
|
||||
|
||||
if (gui_keyboard_paste_pending)
|
||||
{
|
||||
case GUI_BUFFER_TYPE_STANDARD:
|
||||
if (buffer->has_input)
|
||||
{
|
||||
if (buffer->input_buffer_length == 0)
|
||||
buffer->input_buffer[0] = '\0';
|
||||
|
||||
if (GUI_SERVER(buffer) && GUI_SERVER(buffer)->is_connected)
|
||||
ptr_nickname = (GUI_SERVER(buffer)->nick) ?
|
||||
GUI_SERVER(buffer)->nick : cfg_look_no_nickname;
|
||||
else
|
||||
ptr_nickname = cfg_look_no_nickname;
|
||||
|
||||
prompt_length = gui_input_get_prompt_length (ptr_win, ptr_nickname);
|
||||
|
||||
if (ptr_win->win_input_width - prompt_length < 3)
|
||||
wmove (GUI_CURSES(ptr_win)->win_input, 0, 0);
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input,
|
||||
GUI_COLOR_WIN_INPUT_ACTIONS);
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" Paste %d lines ? [ctrl-Y] Yes [ctrl-N] No"),
|
||||
gui_keyboard_get_paste_lines ());
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y, ptr_win->win_input_x);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (buffer->type)
|
||||
{
|
||||
case GUI_BUFFER_TYPE_STANDARD:
|
||||
if (buffer->has_input)
|
||||
{
|
||||
prompt_length = 0;
|
||||
display_prompt = 0;
|
||||
}
|
||||
else
|
||||
display_prompt = 1;
|
||||
if (buffer->input_buffer_length == 0)
|
||||
buffer->input_buffer[0] = '\0';
|
||||
|
||||
if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
|
||||
ptr_win->win_input_width - prompt_length)
|
||||
buffer->input_buffer_1st_display = buffer->input_buffer_pos -
|
||||
(ptr_win->win_input_width - prompt_length) + 1;
|
||||
else
|
||||
{
|
||||
if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
|
||||
buffer->input_buffer_1st_display = buffer->input_buffer_pos;
|
||||
if (GUI_SERVER(buffer) && GUI_SERVER(buffer)->is_connected)
|
||||
ptr_nickname = (GUI_SERVER(buffer)->nick) ?
|
||||
GUI_SERVER(buffer)->nick : cfg_look_no_nickname;
|
||||
else
|
||||
ptr_nickname = cfg_look_no_nickname;
|
||||
|
||||
prompt_length = gui_input_get_prompt_length (ptr_win, ptr_nickname);
|
||||
|
||||
if (ptr_win->win_input_width - prompt_length < 3)
|
||||
{
|
||||
prompt_length = 0;
|
||||
display_prompt = 0;
|
||||
}
|
||||
else
|
||||
display_prompt = 1;
|
||||
|
||||
if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
|
||||
ptr_win->win_input_width - prompt_length)
|
||||
buffer->input_buffer_1st_display = buffer->input_buffer_pos -
|
||||
(ptr_win->win_input_width - prompt_length) + 1;
|
||||
else
|
||||
{
|
||||
if ((buffer->input_buffer_1st_display > 0) &&
|
||||
(buffer->input_buffer_pos -
|
||||
buffer->input_buffer_1st_display + 1)
|
||||
< ptr_win->win_input_width - prompt_length)
|
||||
if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
|
||||
buffer->input_buffer_1st_display = buffer->input_buffer_pos;
|
||||
else
|
||||
{
|
||||
buffer->input_buffer_1st_display =
|
||||
buffer->input_buffer_pos -
|
||||
(ptr_win->win_input_width - prompt_length) + 1;
|
||||
if (buffer->input_buffer_1st_display < 0)
|
||||
buffer->input_buffer_1st_display = 0;
|
||||
if ((buffer->input_buffer_1st_display > 0) &&
|
||||
(buffer->input_buffer_pos -
|
||||
buffer->input_buffer_1st_display + 1)
|
||||
< ptr_win->win_input_width - prompt_length)
|
||||
{
|
||||
buffer->input_buffer_1st_display =
|
||||
buffer->input_buffer_pos -
|
||||
(ptr_win->win_input_width - prompt_length) + 1;
|
||||
if (buffer->input_buffer_1st_display < 0)
|
||||
buffer->input_buffer_1st_display = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (display_prompt)
|
||||
gui_input_draw_prompt (ptr_win, ptr_nickname);
|
||||
if (display_prompt)
|
||||
gui_input_draw_prompt (ptr_win, ptr_nickname);
|
||||
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input, GUI_COLOR_WIN_INPUT);
|
||||
snprintf (format, 32, "%%-%ds", ptr_win->win_input_width - prompt_length);
|
||||
offset_cursor = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
offset_cursor = gui_input_draw_text (ptr_win,
|
||||
ptr_win->win_input_width - prompt_length);
|
||||
else
|
||||
wprintw (GUI_CURSES(ptr_win)->win_input, format, "");
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = prompt_length + offset_cursor;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y,
|
||||
ptr_win->win_input_x + ptr_win->win_input_cursor_x);
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_DCC:
|
||||
dcc_selected = (ptr_win->dcc_selected) ? (t_irc_dcc *) ptr_win->dcc_selected : irc_dcc_list;
|
||||
wmove (GUI_CURSES(ptr_win)->win_input, 0, 0);
|
||||
if (dcc_selected)
|
||||
{
|
||||
switch (dcc_selected->status)
|
||||
{
|
||||
case IRC_DCC_WAITING:
|
||||
if (IRC_DCC_IS_RECV(dcc_selected->type))
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [A] Accept"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Cancel"));
|
||||
break;
|
||||
case IRC_DCC_CONNECTING:
|
||||
case IRC_DCC_ACTIVE:
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Cancel"));
|
||||
break;
|
||||
case IRC_DCC_DONE:
|
||||
case IRC_DCC_FAILED:
|
||||
case IRC_DCC_ABORTED:
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [R] Remove"));
|
||||
break;
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input, GUI_COLOR_WIN_INPUT);
|
||||
snprintf (format, 32, "%%-%ds", ptr_win->win_input_width - prompt_length);
|
||||
offset_cursor = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
offset_cursor = gui_input_draw_text (ptr_win,
|
||||
ptr_win->win_input_width - prompt_length);
|
||||
else
|
||||
wprintw (GUI_CURSES(ptr_win)->win_input, format, "");
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = prompt_length + offset_cursor;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y,
|
||||
ptr_win->win_input_x + ptr_win->win_input_cursor_x);
|
||||
}
|
||||
}
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [P] Purge old DCC"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [Q] Close DCC view"));
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y, ptr_win->win_input_x);
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_RAW_DATA:
|
||||
wmove (GUI_CURSES(ptr_win)->win_input, 0, 0);
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Clear buffer"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [Q] Close raw data view"));
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y, ptr_win->win_input_x);
|
||||
break;
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_DCC:
|
||||
dcc_selected = (ptr_win->dcc_selected) ? (t_irc_dcc *) ptr_win->dcc_selected : irc_dcc_list;
|
||||
wmove (GUI_CURSES(ptr_win)->win_input, 0, 0);
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input,
|
||||
GUI_COLOR_WIN_INPUT_ACTIONS);
|
||||
if (dcc_selected)
|
||||
{
|
||||
switch (dcc_selected->status)
|
||||
{
|
||||
case IRC_DCC_WAITING:
|
||||
if (IRC_DCC_IS_RECV(dcc_selected->type))
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [A] Accept"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Cancel"));
|
||||
break;
|
||||
case IRC_DCC_CONNECTING:
|
||||
case IRC_DCC_ACTIVE:
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Cancel"));
|
||||
break;
|
||||
case IRC_DCC_DONE:
|
||||
case IRC_DCC_FAILED:
|
||||
case IRC_DCC_ABORTED:
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [R] Remove"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [P] Purge old DCC"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [Q] Close DCC view"));
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y, ptr_win->win_input_x);
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_RAW_DATA:
|
||||
wmove (GUI_CURSES(ptr_win)->win_input, 0, 0);
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input,
|
||||
GUI_COLOR_WIN_INPUT_ACTIONS);
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Clear buffer"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [Q] Close raw data view"));
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y, ptr_win->win_input_x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
wrefresh (GUI_CURSES(ptr_win)->win_input);
|
||||
refresh ();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "../gui.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../common/util.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
|
||||
@@ -147,35 +148,6 @@ gui_keyboard_default_bindings ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_grab_end: insert grabbed key in input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_keyboard_get_expanded_name (gui_key_buffer);
|
||||
|
||||
if (expanded_key)
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
}
|
||||
free (expanded_key);
|
||||
}
|
||||
|
||||
/* end grab mode */
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_buffer[0] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_read: read keyboard chars
|
||||
*/
|
||||
@@ -183,149 +155,209 @@ gui_keyboard_grab_end ()
|
||||
void
|
||||
gui_keyboard_read ()
|
||||
{
|
||||
int key, i, insert_ok, input_draw;
|
||||
int i, key, insert_ok, input_draw, paste_lines;
|
||||
int accept_paste, cancel_paste, text_added_to_buffer;
|
||||
char key_str[32], *key_utf, *input_old;
|
||||
|
||||
i = 0;
|
||||
/* do not loop too much here (for example when big paste was made),
|
||||
to read also socket & co */
|
||||
while (i < 8)
|
||||
accept_paste = 0;
|
||||
cancel_paste = 0;
|
||||
text_added_to_buffer = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (gui_key_grab && (gui_key_grab_count > 10))
|
||||
gui_keyboard_grab_end ();
|
||||
|
||||
key = getch ();
|
||||
insert_ok = 1;
|
||||
|
||||
if (key == ERR)
|
||||
{
|
||||
if (gui_key_grab && (gui_key_grab_count > 0))
|
||||
gui_keyboard_grab_end ();
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
if (key == KEY_RESIZE)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
gui_last_activity_time = time (NULL);
|
||||
|
||||
if (key < 32)
|
||||
if (gui_keyboard_paste_pending)
|
||||
{
|
||||
insert_ok = 0;
|
||||
key_str[0] = '^';
|
||||
key_str[1] = (char) key + '@';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else if (key == 127)
|
||||
{
|
||||
key_str[0] = '^';
|
||||
key_str[1] = '?';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (local_utf8)
|
||||
/* ctrl-Y: accept paste */
|
||||
if (key == 25)
|
||||
{
|
||||
/* 1 char: 0vvvvvvv */
|
||||
if (key < 0x80)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
}
|
||||
/* 2 chars: 110vvvvv 10vvvvvv */
|
||||
else if ((key & 0xE0) == 0xC0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
/* 3 chars: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF0) == 0xE0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = '\0';
|
||||
}
|
||||
/* 4 chars: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF8) == 0xF0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = (char) (getch ());
|
||||
key_str[4] = '\0';
|
||||
}
|
||||
accept_paste = 1;
|
||||
break;
|
||||
}
|
||||
/* ctrl-N: cancel paste */
|
||||
else if (key == 14)
|
||||
{
|
||||
cancel_paste = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gui_keyboard_buffer_add (key);
|
||||
text_added_to_buffer = 1;
|
||||
}
|
||||
|
||||
if (gui_keyboard_paste_pending)
|
||||
{
|
||||
/* user is ok for pasting text, let's paste! */
|
||||
if (accept_paste)
|
||||
{
|
||||
gui_keyboard_paste_accept ();
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
/* user doesn't want to paste text: clear whole buffer! */
|
||||
else if (cancel_paste)
|
||||
{
|
||||
gui_keyboard_paste_cancel ();
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
else if (text_added_to_buffer)
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* detect user paste or large amount of text
|
||||
if so, ask user what to do */
|
||||
if (cfg_look_paste_max_lines > 0)
|
||||
{
|
||||
paste_lines = gui_keyboard_get_paste_lines ();
|
||||
if (paste_lines > cfg_look_paste_max_lines)
|
||||
{
|
||||
gui_keyboard_paste_pending = 1;
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if there's no paste pending, then we use buffer and do actions
|
||||
according to keys */
|
||||
if (!gui_keyboard_paste_pending)
|
||||
{
|
||||
if (gui_keyboard_buffer_size > 0)
|
||||
gui_last_activity_time = time (NULL);
|
||||
|
||||
if (gui_key_grab && (gui_key_grab_count > 0))
|
||||
gui_keyboard_grab_end ();
|
||||
|
||||
for (i = 0; i < gui_keyboard_buffer_size; i++)
|
||||
{
|
||||
key = gui_keyboard_buffer[i];
|
||||
|
||||
insert_ok = 1;
|
||||
|
||||
if (key < 32)
|
||||
{
|
||||
insert_ok = 0;
|
||||
key_str[0] = '^';
|
||||
key_str[1] = (char) key + '@';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else if (key == 127)
|
||||
{
|
||||
key_str[0] = '^';
|
||||
key_str[1] = '?';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
|
||||
/* convert input to UTF-8 is user is not using UTF-8 as locale */
|
||||
if (!local_utf8)
|
||||
if (local_utf8)
|
||||
{
|
||||
key_utf = weechat_iconv_to_internal (NULL, key_str);
|
||||
strncpy (key_str, key_utf, sizeof (key_str));
|
||||
key_str[sizeof (key_str) - 1] = '\0';
|
||||
/* 1 char: 0vvvvvvv */
|
||||
if (key < 0x80)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
}
|
||||
/* 2 chars: 110vvvvv 10vvvvvv */
|
||||
else if ((key & 0xE0) == 0xC0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
/* 3 chars: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF0) == 0xE0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = '\0';
|
||||
}
|
||||
/* 4 chars: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF8) == 0xF0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = (char) (getch ());
|
||||
key_str[4] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
|
||||
/* convert input to UTF-8 is user is not using UTF-8 as locale */
|
||||
if (!local_utf8)
|
||||
{
|
||||
key_utf = weechat_iconv_to_internal (NULL, key_str);
|
||||
strncpy (key_str, key_utf, sizeof (key_str));
|
||||
key_str[sizeof (key_str) - 1] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp (key_str, "^") == 0)
|
||||
{
|
||||
key_str[1] = '^';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
|
||||
/*gui_printf (gui_current_window->buffer, "gui_input_read: key = %s (%d)\n", key_str, key);*/
|
||||
|
||||
if (gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
|
||||
input_old = (gui_current_window->buffer->input_buffer) ?
|
||||
strdup (gui_current_window->buffer->input_buffer) : strdup ("");
|
||||
else
|
||||
input_old = NULL;
|
||||
|
||||
input_draw = 0;
|
||||
|
||||
if ((gui_keyboard_pressed (key_str) != 0) && (insert_ok))
|
||||
{
|
||||
if (strcmp (key_str, "^^") == 0)
|
||||
key_str[1] = '\0';
|
||||
|
||||
switch (gui_current_window->buffer->type)
|
||||
if (strcmp (key_str, "^") == 0)
|
||||
{
|
||||
case GUI_BUFFER_TYPE_STANDARD:
|
||||
gui_insert_string_input (gui_current_window, key_str, -1);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
input_draw = 1;
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_DCC:
|
||||
gui_exec_action_dcc (gui_current_window, key_str);
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_RAW_DATA:
|
||||
gui_exec_action_raw_data (gui_current_window, key_str);
|
||||
break;
|
||||
key_str[1] = '^';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
|
||||
/*gui_printf (gui_current_window->buffer, "gui_input_read: key = %s (%d)\n", key_str, key);*/
|
||||
|
||||
if (gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
|
||||
input_old = (gui_current_window->buffer->input_buffer) ?
|
||||
strdup (gui_current_window->buffer->input_buffer) : strdup ("");
|
||||
else
|
||||
input_old = NULL;
|
||||
|
||||
input_draw = 0;
|
||||
|
||||
if ((gui_keyboard_pressed (key_str) != 0) && (insert_ok))
|
||||
{
|
||||
if (strcmp (key_str, "^^") == 0)
|
||||
key_str[1] = '\0';
|
||||
|
||||
switch (gui_current_window->buffer->type)
|
||||
{
|
||||
case GUI_BUFFER_TYPE_STANDARD:
|
||||
gui_insert_string_input (gui_current_window, key_str, -1);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
input_draw = 1;
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_DCC:
|
||||
gui_exec_action_dcc (gui_current_window, key_str);
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_RAW_DATA:
|
||||
gui_exec_action_raw_data (gui_current_window, key_str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* incremental text search in buffer */
|
||||
if ((gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
|
||||
&& ((input_old == NULL) || (gui_current_window->buffer->input_buffer == NULL)
|
||||
|| (strcmp (input_old, gui_current_window->buffer->input_buffer) != 0)))
|
||||
{
|
||||
gui_buffer_search_restart (gui_current_window);
|
||||
input_draw = 1;
|
||||
}
|
||||
|
||||
if (input_draw)
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
|
||||
if (input_old)
|
||||
free (input_old);
|
||||
}
|
||||
|
||||
/* incremental text search in buffer */
|
||||
if ((gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
|
||||
&& ((input_old == NULL) || (gui_current_window->buffer->input_buffer == NULL)
|
||||
|| (strcmp (input_old, gui_current_window->buffer->input_buffer) != 0)))
|
||||
{
|
||||
gui_buffer_search_restart (gui_current_window);
|
||||
input_draw = 1;
|
||||
}
|
||||
|
||||
if (input_draw)
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
|
||||
if (input_old)
|
||||
free (input_old);
|
||||
|
||||
i++;
|
||||
gui_keyboard_buffer_reset ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,121 +43,7 @@
|
||||
void
|
||||
gui_keyboard_default_bindings ()
|
||||
{
|
||||
int i;
|
||||
char key_str[32], command[32];
|
||||
|
||||
/* keys binded with internal functions */
|
||||
gui_keyboard_bind ( /* RC */ "ctrl-M", "return");
|
||||
gui_keyboard_bind ( /* RC */ "ctrl-J", "return");
|
||||
gui_keyboard_bind ( /* tab */ "ctrl-I", "tab");
|
||||
gui_keyboard_bind ( /* basckp */ "ctrl-H", "backspace");
|
||||
gui_keyboard_bind ( /* basckp */ "ctrl-?", "backspace");
|
||||
gui_keyboard_bind ( /* del */ "meta2-3~", "delete");
|
||||
gui_keyboard_bind ( /* ^K */ "ctrl-K", "delete_end_line");
|
||||
gui_keyboard_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
|
||||
gui_keyboard_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
|
||||
gui_keyboard_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
|
||||
gui_keyboard_bind ( /* ^T */ "ctrl-T", "transpose_chars");
|
||||
gui_keyboard_bind ( /* home */ "meta2-1~", "home");
|
||||
gui_keyboard_bind ( /* home */ "meta2-H", "home");
|
||||
gui_keyboard_bind ( /* home */ "meta2-7~", "home");
|
||||
gui_keyboard_bind ( /* ^A */ "ctrl-A", "home");
|
||||
gui_keyboard_bind ( /* end */ "meta2-4~", "end");
|
||||
gui_keyboard_bind ( /* end */ "meta2-F", "end");
|
||||
gui_keyboard_bind ( /* end */ "meta2-8~", "end");
|
||||
gui_keyboard_bind ( /* ^E */ "ctrl-E", "end");
|
||||
gui_keyboard_bind ( /* left */ "meta2-D", "left");
|
||||
gui_keyboard_bind ( /* right */ "meta2-C", "right");
|
||||
gui_keyboard_bind ( /* up */ "meta2-A", "up");
|
||||
gui_keyboard_bind ( /* ^up */ "meta-Oa", "up_global");
|
||||
gui_keyboard_bind ( /* down */ "meta2-B", "down");
|
||||
gui_keyboard_bind ( /* ^down */ "meta-Ob", "down_global");
|
||||
gui_keyboard_bind ( /* pgup */ "meta2-5~", "page_up");
|
||||
gui_keyboard_bind ( /* pgdn */ "meta2-6~", "page_down");
|
||||
gui_keyboard_bind ( /* m-pgup */ "meta-meta2-5~", "scroll_up");
|
||||
gui_keyboard_bind ( /* m-pgdn */ "meta-meta2-6~", "scroll_down");
|
||||
gui_keyboard_bind ( /* F10 */ "meta2-21~", "infobar_clear");
|
||||
gui_keyboard_bind ( /* F11 */ "meta2-23~", "nick_page_up");
|
||||
gui_keyboard_bind ( /* F12 */ "meta2-24~", "nick_page_down");
|
||||
gui_keyboard_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
|
||||
gui_keyboard_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
|
||||
gui_keyboard_bind ( /* ^L */ "ctrl-L", "refresh");
|
||||
gui_keyboard_bind ( /* m-a */ "meta-a", "jump_smart");
|
||||
gui_keyboard_bind ( /* m-b */ "meta-b", "previous_word");
|
||||
gui_keyboard_bind ( /* ^left */ "meta-Od", "previous_word");
|
||||
gui_keyboard_bind ( /* m-d */ "meta-d", "delete_next_word");
|
||||
gui_keyboard_bind ( /* m-f */ "meta-f", "next_word");
|
||||
gui_keyboard_bind ( /* ^right */ "meta-Oc", "next_word");
|
||||
gui_keyboard_bind ( /* m-h */ "meta-h", "hotlist_clear");
|
||||
gui_keyboard_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
|
||||
gui_keyboard_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
|
||||
gui_keyboard_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
|
||||
gui_keyboard_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
|
||||
gui_keyboard_bind ( /* m-k */ "meta-k", "grab_key");
|
||||
gui_keyboard_bind ( /* m-n */ "meta-n", "scroll_next_highlight");
|
||||
gui_keyboard_bind ( /* m-p */ "meta-p", "scroll_previous_highlight");
|
||||
gui_keyboard_bind ( /* m-r */ "meta-r", "delete_line");
|
||||
gui_keyboard_bind ( /* m-s */ "meta-s", "switch_server");
|
||||
gui_keyboard_bind ( /* m-u */ "meta-u", "scroll_unread");
|
||||
|
||||
/* keys binded with commands */
|
||||
gui_keyboard_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
|
||||
gui_keyboard_bind ( /* F5 */ "meta2-15~", "/buffer -1");
|
||||
gui_keyboard_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
|
||||
gui_keyboard_bind ( /* F6 */ "meta2-17~", "/buffer +1");
|
||||
gui_keyboard_bind ( /* F7 */ "meta2-18~", "/window -1");
|
||||
gui_keyboard_bind ( /* F8 */ "meta2-19~", "/window +1");
|
||||
gui_keyboard_bind ( /* m-w,m-up */ "meta-wmeta-meta2-A", "/window up");
|
||||
gui_keyboard_bind ( /* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
|
||||
gui_keyboard_bind ( /* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
|
||||
gui_keyboard_bind ( /* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
|
||||
gui_keyboard_bind ( /* m-0 */ "meta-0", "/buffer 10");
|
||||
gui_keyboard_bind ( /* m-1 */ "meta-1", "/buffer 1");
|
||||
gui_keyboard_bind ( /* m-2 */ "meta-2", "/buffer 2");
|
||||
gui_keyboard_bind ( /* m-3 */ "meta-3", "/buffer 3");
|
||||
gui_keyboard_bind ( /* m-4 */ "meta-4", "/buffer 4");
|
||||
gui_keyboard_bind ( /* m-5 */ "meta-5", "/buffer 5");
|
||||
gui_keyboard_bind ( /* m-6 */ "meta-6", "/buffer 6");
|
||||
gui_keyboard_bind ( /* m-7 */ "meta-7", "/buffer 7");
|
||||
gui_keyboard_bind ( /* m-8 */ "meta-8", "/buffer 8");
|
||||
gui_keyboard_bind ( /* m-9 */ "meta-9", "/buffer 9");
|
||||
|
||||
/* bind meta-j + {01..99} to switch to buffers # > 10 */
|
||||
for (i = 1; i < 100; i++)
|
||||
{
|
||||
sprintf (key_str, "meta-j%02d", i);
|
||||
sprintf (command, "/buffer %d", i);
|
||||
gui_keyboard_bind (key_str, command);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_grab_end: insert grabbed key in input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_keyboard_get_expanded_name (gui_key_buffer);
|
||||
|
||||
if (expanded_key)
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->input_buffer_pos += utf8_strlen (expanded_key);
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
free (expanded_key);
|
||||
}
|
||||
|
||||
/* end grab mode */
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_buffer[0] = '\0';
|
||||
/* TODO: write this function for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1480,7 +1480,7 @@ gui_action_grab_key (t_gui_window *window, char *args)
|
||||
(void) args;
|
||||
|
||||
if (window->buffer->has_input)
|
||||
gui_keyboard_init_grab ();
|
||||
gui_keyboard_grab_init ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -89,6 +89,7 @@ enum t_weechat_color
|
||||
GUI_COLOR_WIN_TITLE_MORE,
|
||||
GUI_COLOR_WIN_INPUT_TEXT_NOT_FOUND,
|
||||
GUI_COLOR_WIN_NICK_CHANUSER,
|
||||
GUI_COLOR_WIN_INPUT_ACTIONS,
|
||||
GUI_NUM_COLORS
|
||||
};
|
||||
|
||||
|
||||
+160
-14
@@ -38,12 +38,20 @@
|
||||
#endif
|
||||
|
||||
|
||||
t_gui_key *gui_keys = NULL;
|
||||
t_gui_key *last_gui_key = NULL;
|
||||
t_gui_key *gui_keys = NULL; /* key bindings */
|
||||
t_gui_key *last_gui_key = NULL; /* last key binding */
|
||||
|
||||
char gui_key_buffer[128];
|
||||
int gui_key_grab = 0;
|
||||
int gui_key_grab_count = 0;
|
||||
char gui_key_combo_buffer[128]; /* buffer used for combos */
|
||||
int gui_key_grab = 0; /* 1 if grab mode enabled (alt-k pressed) */
|
||||
int gui_key_grab_count = 0; /* number of keys pressed in grab mode */
|
||||
|
||||
int *gui_keyboard_buffer = NULL; /* input buffer (for paste detection) */
|
||||
int gui_keyboard_buffer_alloc = 0; /* input buffer allocated size */
|
||||
int gui_keyboard_buffer_size = 0; /* input buffer size in bytes */
|
||||
|
||||
int gui_keyboard_paste_pending = 0; /* 1 is big paste was detected and */
|
||||
/* WeeChat is asking user what to do */
|
||||
int gui_keyboard_paste_lines = 0; /* number of lines for pending paste */
|
||||
|
||||
t_gui_key_function gui_key_functions[] =
|
||||
{ { "return", gui_action_return,
|
||||
@@ -161,7 +169,7 @@ t_gui_key_function gui_key_functions[] =
|
||||
void
|
||||
gui_keyboard_init ()
|
||||
{
|
||||
gui_key_buffer[0] = '\0';
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
|
||||
@@ -169,16 +177,45 @@ gui_keyboard_init ()
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_init_show: init "show mode"
|
||||
* gui_keyboard_grab_init: init "grab" mode
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_init_grab ()
|
||||
gui_keyboard_grab_init ()
|
||||
{
|
||||
gui_key_grab = 1;
|
||||
gui_key_grab_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_grab_end: insert grabbed key in input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_keyboard_get_expanded_name (gui_key_combo_buffer);
|
||||
|
||||
if (expanded_key)
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
}
|
||||
free (expanded_key);
|
||||
}
|
||||
|
||||
/* end grab mode */
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_get_internal_code: get internal code from user key name
|
||||
* for example: return "^R" for "ctrl-R"
|
||||
@@ -564,8 +601,8 @@ gui_keyboard_pressed (char *key_str)
|
||||
char **commands, **ptr_cmd;
|
||||
|
||||
/* add key to buffer */
|
||||
first_key = (gui_key_buffer[0] == '\0');
|
||||
strcat (gui_key_buffer, key_str);
|
||||
first_key = (gui_key_combo_buffer[0] == '\0');
|
||||
strcat (gui_key_combo_buffer, key_str);
|
||||
|
||||
/* if we are in "show mode", increase counter and return */
|
||||
if (gui_key_grab)
|
||||
@@ -575,16 +612,16 @@ gui_keyboard_pressed (char *key_str)
|
||||
}
|
||||
|
||||
/* look for key combo in key table */
|
||||
ptr_key = gui_keyboard_search_part (gui_key_buffer);
|
||||
ptr_key = gui_keyboard_search_part (gui_key_combo_buffer);
|
||||
if (ptr_key)
|
||||
{
|
||||
if (ascii_strcasecmp (ptr_key->key, gui_key_buffer) == 0)
|
||||
if (ascii_strcasecmp (ptr_key->key, gui_key_combo_buffer) == 0)
|
||||
{
|
||||
/* exact combo found => execute function or command */
|
||||
buffer_before_key =
|
||||
(gui_current_window->buffer->input_buffer) ?
|
||||
strdup (gui_current_window->buffer->input_buffer) : strdup ("");
|
||||
gui_key_buffer[0] = '\0';
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
if (ptr_key->command)
|
||||
{
|
||||
commands = split_multi_command (ptr_key->command, ';');
|
||||
@@ -617,7 +654,7 @@ gui_keyboard_pressed (char *key_str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
gui_key_buffer[0] = '\0';
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
|
||||
/* if this is first key and not found (even partial) => return 1
|
||||
else return 0 (= silently discard sequence of bad keys) */
|
||||
@@ -662,3 +699,112 @@ gui_keyboard_free_all ()
|
||||
while (gui_keys)
|
||||
gui_keyboard_free (gui_keys);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_buffer_optimize: optimize keyboard buffer size
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_buffer_optimize ()
|
||||
{
|
||||
int optimal_size;
|
||||
|
||||
optimal_size = (((gui_keyboard_buffer_size * sizeof (int)) /
|
||||
GUI_KEYBOARD_BUFFER_BLOCK_SIZE) *
|
||||
GUI_KEYBOARD_BUFFER_BLOCK_SIZE) +
|
||||
GUI_KEYBOARD_BUFFER_BLOCK_SIZE;
|
||||
|
||||
if (gui_keyboard_buffer_alloc != optimal_size)
|
||||
{
|
||||
gui_keyboard_buffer_alloc = optimal_size;
|
||||
gui_keyboard_buffer = realloc (gui_keyboard_buffer, optimal_size);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_buffer_reset: reset keyboard buffer
|
||||
* (create empty if never created before)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_buffer_reset ()
|
||||
{
|
||||
if (!gui_keyboard_buffer)
|
||||
{
|
||||
gui_keyboard_buffer_alloc = GUI_KEYBOARD_BUFFER_BLOCK_SIZE;
|
||||
gui_keyboard_buffer_size = 0;
|
||||
gui_keyboard_buffer = (int *) malloc (gui_keyboard_buffer_alloc);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_keyboard_buffer_size = 0;
|
||||
gui_keyboard_buffer_optimize ();
|
||||
}
|
||||
gui_keyboard_paste_lines = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_buffer_add: add a key to keyboard buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_buffer_add (int key)
|
||||
{
|
||||
if (!gui_keyboard_buffer)
|
||||
gui_keyboard_buffer_reset ();
|
||||
|
||||
gui_keyboard_buffer_size++;
|
||||
|
||||
gui_keyboard_buffer_optimize ();
|
||||
|
||||
if (gui_keyboard_buffer)
|
||||
{
|
||||
gui_keyboard_buffer[gui_keyboard_buffer_size - 1] = key;
|
||||
if (key == 10)
|
||||
gui_keyboard_paste_lines++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_keyboard_buffer_alloc = 0;
|
||||
gui_keyboard_buffer_size = 0;
|
||||
gui_keyboard_paste_lines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_get_paste_lines: return real number of lines in buffer
|
||||
* if last key is not Return, then this is lines + 1
|
||||
* else it's lines
|
||||
*/
|
||||
|
||||
int
|
||||
gui_keyboard_get_paste_lines ()
|
||||
{
|
||||
if ((gui_keyboard_buffer_size > 0)
|
||||
&& (gui_keyboard_buffer[gui_keyboard_buffer_size - 1] != 10))
|
||||
return gui_keyboard_paste_lines + 1;
|
||||
|
||||
return gui_keyboard_paste_lines;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_paste_accept: accept paste from user
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_paste_accept ()
|
||||
{
|
||||
gui_keyboard_paste_pending = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_keyboard_paste_cancel: cancel paste from user (reset buffer)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_paste_cancel ()
|
||||
{
|
||||
gui_keyboard_buffer_reset ();
|
||||
gui_keyboard_paste_pending = 0;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_GUI_KEY_H
|
||||
#define __WEECHAT_GUI_KEY_H 1
|
||||
#ifndef __WEECHAT_GUI_KEYBOARD_H
|
||||
#define __WEECHAT_GUI_KEYBOARD_H 1
|
||||
|
||||
#define GUI_KEYBOARD_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
/* key structures */
|
||||
|
||||
@@ -50,8 +52,11 @@ struct t_gui_key_function
|
||||
extern t_gui_key *gui_keys;
|
||||
extern t_gui_key *last_gui_key;
|
||||
extern t_gui_key_function gui_key_functions[];
|
||||
extern char gui_key_buffer[128];
|
||||
extern char gui_key_combo_buffer[128];
|
||||
extern int gui_key_grab;
|
||||
extern int gui_key_grab_count;
|
||||
extern int *gui_keyboard_buffer;
|
||||
extern int gui_keyboard_buffer_size;
|
||||
extern int gui_keyboard_paste_pending;
|
||||
|
||||
#endif /* gui-key.h */
|
||||
#endif /* gui-keyboard.h */
|
||||
|
||||
+7
-1
@@ -174,7 +174,8 @@ extern void gui_action_search_text (t_gui_window *, char *);
|
||||
|
||||
/* key */
|
||||
extern void gui_keyboard_init ();
|
||||
extern void gui_keyboard_init_grab ();
|
||||
extern void gui_keyboard_grab_init ();
|
||||
extern void gui_keyboard_grab_end ();
|
||||
extern char *gui_keyboard_get_internal_code (char *);
|
||||
extern char *gui_keyboard_get_expanded_name (char *);
|
||||
extern t_gui_key *gui_keyboard_search (char *);
|
||||
@@ -185,6 +186,11 @@ extern int gui_keyboard_unbind (char *);
|
||||
extern int gui_keyboard_pressed (char *);
|
||||
extern void gui_keyboard_free (t_gui_key *);
|
||||
extern void gui_keyboard_free_all ();
|
||||
extern void gui_keyboard_buffer_reset ();
|
||||
extern void gui_keyboard_buffer_add (int);
|
||||
extern int gui_keyboard_get_paste_lines ();
|
||||
extern void gui_keyboard_paste_accept ();
|
||||
extern void gui_keyboard_paste_cancel ();
|
||||
|
||||
/* log */
|
||||
extern void gui_log_write_date (t_gui_buffer *);
|
||||
|
||||
+3
-1
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2007-08-12
|
||||
ChangeLog - 2007-08-17
|
||||
|
||||
|
||||
Version 0.2.6 (under dev!):
|
||||
* added paste detection, new options look_paste_max_lines and
|
||||
col_input_actions (task #5442)
|
||||
* fixed bug with highlight and UTF-8 chars around word (bug #20753)
|
||||
* added swedish quickstart guide
|
||||
* added support of channel mode +u (channel user) (bug #20717)
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
<entry>Ganzzahl</entry>
|
||||
<entry>zwischen 0 und 100</entry>
|
||||
<entry>0</entry>
|
||||
<entry>Maximale Größe der Nicklist (Breite oder Höhe, je nach look_nicklist_position (0: kein Maximum); Wenn min == max > 0, ist die Größe fest.</entry>
|
||||
<entry>Max size for nicklist (width or height, depending on look_nicklist_position (0 = no max size; if min = max and > 0, then size is fixed))</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nicklist_separator</option></entry>
|
||||
@@ -292,10 +292,17 @@
|
||||
<entry>'[%n(%m)] '</entry>
|
||||
<entry>Format der Eingabezeile ('%c' wird durch den Channel- oder Servernamen ersetzt, '%n' durch den Nicknamen und '%m' durch die Nick-Modi)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_paste_max_lines</option></entry>
|
||||
<entry>Ganzzahl</entry>
|
||||
<entry>zwischen 0 und 2147483647</entry>
|
||||
<entry>3</entry>
|
||||
<entry>Max number of lines for paste without asking user (0 = disable this feature)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_real_white</option></entry>
|
||||
<entry>Boolean</entry>
|
||||
<entry>eine beliebige Zeichenfolge</entry>
|
||||
<entry>zwischen 0 und 2147483647</entry>
|
||||
<entry>'off'</entry>
|
||||
<entry>Wenn gesetzt, benutze echtes Weiß, als Voreinstellung jedoch für Terminals mit weißem Hintergrund deaktiviert (solltest du niemals einen weißen Hintergrund benutzen, solltest du diese Option aktivieren um ein echtes Weiß anstelle der voreingestellten Terminal Vordergrundfarbe zu bekommen)</entry>
|
||||
</row>
|
||||
@@ -572,6 +579,13 @@
|
||||
<entry>'red'</entry>
|
||||
<entry>Farbe für den Text nicht gefunden</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_actions</option></entry>
|
||||
<entry>Farbe</entry>
|
||||
<entry>Curses- oder Gtk-Farben</entry>
|
||||
<entry>'lightgreen'</entry>
|
||||
<entry>Color for actions in input window</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_bg</option></entry>
|
||||
<entry>Farbe</entry>
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
<entry>integer</entry>
|
||||
<entry>between 0 and 100</entry>
|
||||
<entry>0</entry>
|
||||
<entry>Max size for nicklist (width or height, depending on look_nicklist_position (0 = no max size; if min == max and > 0, then size is fixed))</entry>
|
||||
<entry>Max size for nicklist (width or height, depending on look_nicklist_position (0 = no max size; if min = max and > 0, then size is fixed))</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nicklist_separator</option></entry>
|
||||
@@ -292,6 +292,13 @@
|
||||
<entry>'[%n(%m)] '</entry>
|
||||
<entry>Format for input prompt ('%c' is replaced by channel or server, '%n' by nick and '%m' by nick modes)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_paste_max_lines</option></entry>
|
||||
<entry>integer</entry>
|
||||
<entry>between 0 and 2147483647</entry>
|
||||
<entry>3</entry>
|
||||
<entry>Max number of lines for paste without asking user (0 = disable this feature)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_real_white</option></entry>
|
||||
<entry>boolean</entry>
|
||||
@@ -572,6 +579,13 @@
|
||||
<entry>'red'</entry>
|
||||
<entry>Color for text not found</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_actions</option></entry>
|
||||
<entry>color</entry>
|
||||
<entry>Curses or Gtk color</entry>
|
||||
<entry>'lightgreen'</entry>
|
||||
<entry>Color for actions in input window</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_bg</option></entry>
|
||||
<entry>color</entry>
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
<entry>entier</entry>
|
||||
<entry>entre 0 et 100</entry>
|
||||
<entry>0</entry>
|
||||
<entry>Taille maximum pour la fenêtre des pseudos (largeur ou hauteur, selon look_nicklist_position (0 = pas de taille maximum; si min == max et > 0, alors la taille est fixe))</entry>
|
||||
<entry>Taille maximum pour la fenêtre des pseudos (largeur ou hauteur, selon look_nicklist_position (0 = pas de taille maximum; si min = max et > 0, alors la taille est fixe))</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_nicklist_separator</option></entry>
|
||||
@@ -292,6 +292,13 @@
|
||||
<entry>'[%n(%m)] '</entry>
|
||||
<entry>Format pour l'invite de la zone de saisie ('%c' est remplacé par le canal ou serveur, '%n' par le pseudo et '%m' par les modes du pseudo)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>look_paste_max_lines</option></entry>
|
||||
<entry>entier</entry>
|
||||
<entry>entre 0 et 2147483647</entry>
|
||||
<entry>3</entry>
|
||||
<entry>Nombre maximum de lignes pour la détection de collage sans demander à l'utilisateur (0 = désactiver cette fonctionnalité)</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_real_white</option></entry>
|
||||
<entry>booléen</entry>
|
||||
@@ -572,6 +579,13 @@
|
||||
<entry>'red'</entry>
|
||||
<entry>Couleur pour le texte non trouvé</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_actions</option></entry>
|
||||
<entry>couleur</entry>
|
||||
<entry>couleur Curses ou Gtk</entry>
|
||||
<entry>'lightgreen'</entry>
|
||||
<entry>Couleur pour les actions dans la fenêtre de saisie</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><option>col_input_bg</option></entry>
|
||||
<entry>couleur</entry>
|
||||
|
||||
+687
-665
File diff suppressed because it is too large
Load Diff
+687
-665
File diff suppressed because it is too large
Load Diff
+687
-665
File diff suppressed because it is too large
Load Diff
+689
-667
File diff suppressed because it is too large
Load Diff
+687
-665
File diff suppressed because it is too large
Load Diff
+687
-665
File diff suppressed because it is too large
Load Diff
+685
-667
File diff suppressed because it is too large
Load Diff
@@ -115,6 +115,7 @@ int cfg_look_day_change;
|
||||
char *cfg_look_day_change_timestamp;
|
||||
char *cfg_look_read_marker;
|
||||
char *cfg_look_input_format;
|
||||
int cfg_look_paste_max_lines;
|
||||
|
||||
t_config_option weechat_options_look[] =
|
||||
{ { "look_save_on_exit", N_("save config file on exit"),
|
||||
@@ -176,7 +177,7 @@ t_config_option weechat_options_look[] =
|
||||
NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_buffers },
|
||||
{ "look_nicklist_max_size", N_("max size for nicklist"),
|
||||
N_("max size for nicklist (width or height, depending on look_nicklist_position "
|
||||
"(0 = no max size; if min == max and > 0, then size is fixed))"),
|
||||
"(0 = no max size; if min = max and > 0, then size is fixed))"),
|
||||
OPTION_TYPE_INT, 0, 100, 0,
|
||||
NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_buffers },
|
||||
{ "look_nicklist_separator", N_("separator between chat and nicklist"),
|
||||
@@ -288,6 +289,10 @@ t_config_option weechat_options_look[] =
|
||||
"'%n' by nick and '%m' by nick modes)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"[%n(%m)] ", NULL, NULL, &cfg_look_input_format, config_change_buffer_content },
|
||||
{ "look_paste_max_lines", N_("max number of lines for paste without asking user"),
|
||||
N_("max number of lines for paste without asking user (0 = disable this feature)"),
|
||||
OPTION_TYPE_INT, 0, INT_MAX, 3,
|
||||
NULL, NULL, &cfg_look_paste_max_lines, NULL, &config_change_noop },
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -333,6 +338,7 @@ int cfg_col_input_channel;
|
||||
int cfg_col_input_nick;
|
||||
int cfg_col_input_delimiters;
|
||||
int cfg_col_input_text_not_found;
|
||||
int cfg_col_input_actions;
|
||||
int cfg_col_input_bg;
|
||||
int cfg_col_nick;
|
||||
int cfg_col_nick_away;
|
||||
@@ -530,6 +536,10 @@ t_config_option weechat_options_colors[] =
|
||||
N_("color for text not found"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"red", NULL, &cfg_col_input_text_not_found, NULL, &config_change_color },
|
||||
{ "col_input_actions", N_("color for actions in input window"),
|
||||
N_("color for actions in input window"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightgreen", NULL, &cfg_col_input_actions, NULL, &config_change_color },
|
||||
{ "col_input_bg", N_("background for input window"),
|
||||
N_("background for input window"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
|
||||
@@ -134,6 +134,7 @@ extern int cfg_look_day_change;
|
||||
extern char *cfg_look_day_change_timestamp;
|
||||
extern char *cfg_look_read_marker;
|
||||
extern char *cfg_look_input_format;
|
||||
extern int cfg_look_paste_max_lines;
|
||||
|
||||
extern int cfg_col_real_white;
|
||||
extern int cfg_col_separator;
|
||||
@@ -175,6 +176,7 @@ extern int cfg_col_input_channel;
|
||||
extern int cfg_col_input_nick;
|
||||
extern int cfg_col_input_delimiters;
|
||||
extern int cfg_col_input_text_not_found;
|
||||
extern int cfg_col_input_actions;
|
||||
extern int cfg_col_input_bg;
|
||||
extern int cfg_col_nick;
|
||||
extern int cfg_col_nick_away;
|
||||
|
||||
@@ -529,6 +529,7 @@ gui_color_init_weechat ()
|
||||
gui_color[GUI_COLOR_WIN_INPUT_NICK] = gui_color_build (GUI_COLOR_WIN_INPUT_NICK, cfg_col_input_nick, cfg_col_input_bg);
|
||||
gui_color[GUI_COLOR_WIN_INPUT_DELIMITERS] = gui_color_build (GUI_COLOR_WIN_INPUT_DELIMITERS, cfg_col_input_delimiters, cfg_col_input_bg);
|
||||
gui_color[GUI_COLOR_WIN_INPUT_TEXT_NOT_FOUND] = gui_color_build (GUI_COLOR_WIN_INPUT_TEXT_NOT_FOUND, cfg_col_input_text_not_found, cfg_col_input_bg);
|
||||
gui_color[GUI_COLOR_WIN_INPUT_ACTIONS] = gui_color_build (GUI_COLOR_WIN_INPUT_ACTIONS, cfg_col_input_actions, cfg_col_input_bg);
|
||||
gui_color[GUI_COLOR_WIN_NICK] = gui_color_build (GUI_COLOR_WIN_NICK, cfg_col_nick, cfg_col_nick_bg);
|
||||
gui_color[GUI_COLOR_WIN_NICK_AWAY] = gui_color_build (GUI_COLOR_WIN_NICK_AWAY, cfg_col_nick_away, cfg_col_nick_bg);
|
||||
gui_color[GUI_COLOR_WIN_NICK_CHANOWNER] = gui_color_build (GUI_COLOR_WIN_NICK_CHANOWNER, cfg_col_nick_chanowner, cfg_col_nick_bg);
|
||||
|
||||
@@ -377,119 +377,139 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
if (erase)
|
||||
gui_window_curses_clear (GUI_CURSES(ptr_win)->win_input, GUI_COLOR_WIN_INPUT);
|
||||
|
||||
switch (buffer->type)
|
||||
|
||||
if (gui_keyboard_paste_pending)
|
||||
{
|
||||
case GUI_BUFFER_TYPE_STANDARD:
|
||||
if (buffer->has_input)
|
||||
{
|
||||
if (buffer->input_buffer_length == 0)
|
||||
buffer->input_buffer[0] = '\0';
|
||||
|
||||
if (GUI_SERVER(buffer) && GUI_SERVER(buffer)->is_connected)
|
||||
ptr_nickname = (GUI_SERVER(buffer)->nick) ?
|
||||
GUI_SERVER(buffer)->nick : cfg_look_no_nickname;
|
||||
else
|
||||
ptr_nickname = cfg_look_no_nickname;
|
||||
|
||||
prompt_length = gui_input_get_prompt_length (ptr_win, ptr_nickname);
|
||||
|
||||
if (ptr_win->win_input_width - prompt_length < 3)
|
||||
wmove (GUI_CURSES(ptr_win)->win_input, 0, 0);
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input,
|
||||
GUI_COLOR_WIN_INPUT_ACTIONS);
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" Paste %d lines ? [ctrl-Y] Yes [ctrl-N] No"),
|
||||
gui_keyboard_get_paste_lines ());
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y, ptr_win->win_input_x);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (buffer->type)
|
||||
{
|
||||
case GUI_BUFFER_TYPE_STANDARD:
|
||||
if (buffer->has_input)
|
||||
{
|
||||
prompt_length = 0;
|
||||
display_prompt = 0;
|
||||
}
|
||||
else
|
||||
display_prompt = 1;
|
||||
if (buffer->input_buffer_length == 0)
|
||||
buffer->input_buffer[0] = '\0';
|
||||
|
||||
if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
|
||||
ptr_win->win_input_width - prompt_length)
|
||||
buffer->input_buffer_1st_display = buffer->input_buffer_pos -
|
||||
(ptr_win->win_input_width - prompt_length) + 1;
|
||||
else
|
||||
{
|
||||
if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
|
||||
buffer->input_buffer_1st_display = buffer->input_buffer_pos;
|
||||
if (GUI_SERVER(buffer) && GUI_SERVER(buffer)->is_connected)
|
||||
ptr_nickname = (GUI_SERVER(buffer)->nick) ?
|
||||
GUI_SERVER(buffer)->nick : cfg_look_no_nickname;
|
||||
else
|
||||
ptr_nickname = cfg_look_no_nickname;
|
||||
|
||||
prompt_length = gui_input_get_prompt_length (ptr_win, ptr_nickname);
|
||||
|
||||
if (ptr_win->win_input_width - prompt_length < 3)
|
||||
{
|
||||
prompt_length = 0;
|
||||
display_prompt = 0;
|
||||
}
|
||||
else
|
||||
display_prompt = 1;
|
||||
|
||||
if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
|
||||
ptr_win->win_input_width - prompt_length)
|
||||
buffer->input_buffer_1st_display = buffer->input_buffer_pos -
|
||||
(ptr_win->win_input_width - prompt_length) + 1;
|
||||
else
|
||||
{
|
||||
if ((buffer->input_buffer_1st_display > 0) &&
|
||||
(buffer->input_buffer_pos -
|
||||
buffer->input_buffer_1st_display + 1)
|
||||
< ptr_win->win_input_width - prompt_length)
|
||||
if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
|
||||
buffer->input_buffer_1st_display = buffer->input_buffer_pos;
|
||||
else
|
||||
{
|
||||
buffer->input_buffer_1st_display =
|
||||
buffer->input_buffer_pos -
|
||||
(ptr_win->win_input_width - prompt_length) + 1;
|
||||
if (buffer->input_buffer_1st_display < 0)
|
||||
buffer->input_buffer_1st_display = 0;
|
||||
if ((buffer->input_buffer_1st_display > 0) &&
|
||||
(buffer->input_buffer_pos -
|
||||
buffer->input_buffer_1st_display + 1)
|
||||
< ptr_win->win_input_width - prompt_length)
|
||||
{
|
||||
buffer->input_buffer_1st_display =
|
||||
buffer->input_buffer_pos -
|
||||
(ptr_win->win_input_width - prompt_length) + 1;
|
||||
if (buffer->input_buffer_1st_display < 0)
|
||||
buffer->input_buffer_1st_display = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (display_prompt)
|
||||
gui_input_draw_prompt (ptr_win, ptr_nickname);
|
||||
if (display_prompt)
|
||||
gui_input_draw_prompt (ptr_win, ptr_nickname);
|
||||
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input, GUI_COLOR_WIN_INPUT);
|
||||
snprintf (format, 32, "%%-%ds", ptr_win->win_input_width - prompt_length);
|
||||
offset_cursor = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
offset_cursor = gui_input_draw_text (ptr_win,
|
||||
ptr_win->win_input_width - prompt_length);
|
||||
else
|
||||
wprintw (GUI_CURSES(ptr_win)->win_input, format, "");
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = prompt_length + offset_cursor;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y,
|
||||
ptr_win->win_input_x + ptr_win->win_input_cursor_x);
|
||||
}
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_DCC:
|
||||
dcc_selected = (ptr_win->dcc_selected) ? (t_irc_dcc *) ptr_win->dcc_selected : irc_dcc_list;
|
||||
wmove (GUI_CURSES(ptr_win)->win_input, 0, 0);
|
||||
if (dcc_selected)
|
||||
{
|
||||
switch (dcc_selected->status)
|
||||
{
|
||||
case IRC_DCC_WAITING:
|
||||
if (IRC_DCC_IS_RECV(dcc_selected->type))
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [A] Accept"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Cancel"));
|
||||
break;
|
||||
case IRC_DCC_CONNECTING:
|
||||
case IRC_DCC_ACTIVE:
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Cancel"));
|
||||
break;
|
||||
case IRC_DCC_DONE:
|
||||
case IRC_DCC_FAILED:
|
||||
case IRC_DCC_ABORTED:
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [R] Remove"));
|
||||
break;
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input, GUI_COLOR_WIN_INPUT);
|
||||
snprintf (format, 32, "%%-%ds", ptr_win->win_input_width - prompt_length);
|
||||
offset_cursor = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
offset_cursor = gui_input_draw_text (ptr_win,
|
||||
ptr_win->win_input_width - prompt_length);
|
||||
else
|
||||
wprintw (GUI_CURSES(ptr_win)->win_input, format, "");
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = prompt_length + offset_cursor;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y,
|
||||
ptr_win->win_input_x + ptr_win->win_input_cursor_x);
|
||||
}
|
||||
}
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [P] Purge old DCC"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [Q] Close DCC view"));
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y, ptr_win->win_input_x);
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_RAW_DATA:
|
||||
wmove (GUI_CURSES(ptr_win)->win_input, 0, 0);
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Clear buffer"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [Q] Close raw data view"));
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y, ptr_win->win_input_x);
|
||||
break;
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_DCC:
|
||||
dcc_selected = (ptr_win->dcc_selected) ? (t_irc_dcc *) ptr_win->dcc_selected : irc_dcc_list;
|
||||
wmove (GUI_CURSES(ptr_win)->win_input, 0, 0);
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input,
|
||||
GUI_COLOR_WIN_INPUT_ACTIONS);
|
||||
if (dcc_selected)
|
||||
{
|
||||
switch (dcc_selected->status)
|
||||
{
|
||||
case IRC_DCC_WAITING:
|
||||
if (IRC_DCC_IS_RECV(dcc_selected->type))
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [A] Accept"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Cancel"));
|
||||
break;
|
||||
case IRC_DCC_CONNECTING:
|
||||
case IRC_DCC_ACTIVE:
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Cancel"));
|
||||
break;
|
||||
case IRC_DCC_DONE:
|
||||
case IRC_DCC_FAILED:
|
||||
case IRC_DCC_ABORTED:
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [R] Remove"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [P] Purge old DCC"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [Q] Close DCC view"));
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y, ptr_win->win_input_x);
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_RAW_DATA:
|
||||
wmove (GUI_CURSES(ptr_win)->win_input, 0, 0);
|
||||
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input,
|
||||
GUI_COLOR_WIN_INPUT_ACTIONS);
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [C] Clear buffer"));
|
||||
gui_window_wprintw (GUI_CURSES(ptr_win)->win_input,
|
||||
_(" [Q] Close raw data view"));
|
||||
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
|
||||
ptr_win->win_input_cursor_x = 0;
|
||||
if (ptr_win == gui_current_window)
|
||||
move (ptr_win->win_input_y, ptr_win->win_input_x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
wrefresh (GUI_CURSES(ptr_win)->win_input);
|
||||
refresh ();
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "../gui.h"
|
||||
#include "../../common/utf8.h"
|
||||
#include "../../common/util.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "gui-curses.h"
|
||||
|
||||
|
||||
@@ -147,35 +148,6 @@ gui_keyboard_default_bindings ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_grab_end: insert grabbed key in input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_keyboard_get_expanded_name (gui_key_buffer);
|
||||
|
||||
if (expanded_key)
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
}
|
||||
free (expanded_key);
|
||||
}
|
||||
|
||||
/* end grab mode */
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_buffer[0] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_read: read keyboard chars
|
||||
*/
|
||||
@@ -183,149 +155,209 @@ gui_keyboard_grab_end ()
|
||||
void
|
||||
gui_keyboard_read ()
|
||||
{
|
||||
int key, i, insert_ok, input_draw;
|
||||
int i, key, insert_ok, input_draw, paste_lines;
|
||||
int accept_paste, cancel_paste, text_added_to_buffer;
|
||||
char key_str[32], *key_utf, *input_old;
|
||||
|
||||
i = 0;
|
||||
/* do not loop too much here (for example when big paste was made),
|
||||
to read also socket & co */
|
||||
while (i < 8)
|
||||
accept_paste = 0;
|
||||
cancel_paste = 0;
|
||||
text_added_to_buffer = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (gui_key_grab && (gui_key_grab_count > 10))
|
||||
gui_keyboard_grab_end ();
|
||||
|
||||
key = getch ();
|
||||
insert_ok = 1;
|
||||
|
||||
if (key == ERR)
|
||||
{
|
||||
if (gui_key_grab && (gui_key_grab_count > 0))
|
||||
gui_keyboard_grab_end ();
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef KEY_RESIZE
|
||||
if (key == KEY_RESIZE)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
gui_last_activity_time = time (NULL);
|
||||
|
||||
if (key < 32)
|
||||
if (gui_keyboard_paste_pending)
|
||||
{
|
||||
insert_ok = 0;
|
||||
key_str[0] = '^';
|
||||
key_str[1] = (char) key + '@';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else if (key == 127)
|
||||
{
|
||||
key_str[0] = '^';
|
||||
key_str[1] = '?';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (local_utf8)
|
||||
/* ctrl-Y: accept paste */
|
||||
if (key == 25)
|
||||
{
|
||||
/* 1 char: 0vvvvvvv */
|
||||
if (key < 0x80)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
}
|
||||
/* 2 chars: 110vvvvv 10vvvvvv */
|
||||
else if ((key & 0xE0) == 0xC0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
/* 3 chars: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF0) == 0xE0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = '\0';
|
||||
}
|
||||
/* 4 chars: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF8) == 0xF0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = (char) (getch ());
|
||||
key_str[4] = '\0';
|
||||
}
|
||||
accept_paste = 1;
|
||||
break;
|
||||
}
|
||||
/* ctrl-N: cancel paste */
|
||||
else if (key == 14)
|
||||
{
|
||||
cancel_paste = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gui_keyboard_buffer_add (key);
|
||||
text_added_to_buffer = 1;
|
||||
}
|
||||
|
||||
if (gui_keyboard_paste_pending)
|
||||
{
|
||||
/* user is ok for pasting text, let's paste! */
|
||||
if (accept_paste)
|
||||
{
|
||||
gui_keyboard_paste_accept ();
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
/* user doesn't want to paste text: clear whole buffer! */
|
||||
else if (cancel_paste)
|
||||
{
|
||||
gui_keyboard_paste_cancel ();
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
else if (text_added_to_buffer)
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* detect user paste or large amount of text
|
||||
if so, ask user what to do */
|
||||
if (cfg_look_paste_max_lines > 0)
|
||||
{
|
||||
paste_lines = gui_keyboard_get_paste_lines ();
|
||||
if (paste_lines > cfg_look_paste_max_lines)
|
||||
{
|
||||
gui_keyboard_paste_pending = 1;
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if there's no paste pending, then we use buffer and do actions
|
||||
according to keys */
|
||||
if (!gui_keyboard_paste_pending)
|
||||
{
|
||||
if (gui_keyboard_buffer_size > 0)
|
||||
gui_last_activity_time = time (NULL);
|
||||
|
||||
if (gui_key_grab && (gui_key_grab_count > 0))
|
||||
gui_keyboard_grab_end ();
|
||||
|
||||
for (i = 0; i < gui_keyboard_buffer_size; i++)
|
||||
{
|
||||
key = gui_keyboard_buffer[i];
|
||||
|
||||
insert_ok = 1;
|
||||
|
||||
if (key < 32)
|
||||
{
|
||||
insert_ok = 0;
|
||||
key_str[0] = '^';
|
||||
key_str[1] = (char) key + '@';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else if (key == 127)
|
||||
{
|
||||
key_str[0] = '^';
|
||||
key_str[1] = '?';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
|
||||
/* convert input to UTF-8 is user is not using UTF-8 as locale */
|
||||
if (!local_utf8)
|
||||
if (local_utf8)
|
||||
{
|
||||
key_utf = weechat_iconv_to_internal (NULL, key_str);
|
||||
strncpy (key_str, key_utf, sizeof (key_str));
|
||||
key_str[sizeof (key_str) - 1] = '\0';
|
||||
/* 1 char: 0vvvvvvv */
|
||||
if (key < 0x80)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
}
|
||||
/* 2 chars: 110vvvvv 10vvvvvv */
|
||||
else if ((key & 0xE0) == 0xC0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
/* 3 chars: 1110vvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF0) == 0xE0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = '\0';
|
||||
}
|
||||
/* 4 chars: 11110vvv 10vvvvvv 10vvvvvv 10vvvvvv */
|
||||
else if ((key & 0xF8) == 0xF0)
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = (char) (getch ());
|
||||
key_str[2] = (char) (getch ());
|
||||
key_str[3] = (char) (getch ());
|
||||
key_str[4] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
key_str[0] = (char) key;
|
||||
key_str[1] = '\0';
|
||||
|
||||
/* convert input to UTF-8 is user is not using UTF-8 as locale */
|
||||
if (!local_utf8)
|
||||
{
|
||||
key_utf = weechat_iconv_to_internal (NULL, key_str);
|
||||
strncpy (key_str, key_utf, sizeof (key_str));
|
||||
key_str[sizeof (key_str) - 1] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp (key_str, "^") == 0)
|
||||
{
|
||||
key_str[1] = '^';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
|
||||
/*gui_printf (gui_current_window->buffer, "gui_input_read: key = %s (%d)\n", key_str, key);*/
|
||||
|
||||
if (gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
|
||||
input_old = (gui_current_window->buffer->input_buffer) ?
|
||||
strdup (gui_current_window->buffer->input_buffer) : strdup ("");
|
||||
else
|
||||
input_old = NULL;
|
||||
|
||||
input_draw = 0;
|
||||
|
||||
if ((gui_keyboard_pressed (key_str) != 0) && (insert_ok))
|
||||
{
|
||||
if (strcmp (key_str, "^^") == 0)
|
||||
key_str[1] = '\0';
|
||||
|
||||
switch (gui_current_window->buffer->type)
|
||||
if (strcmp (key_str, "^") == 0)
|
||||
{
|
||||
case GUI_BUFFER_TYPE_STANDARD:
|
||||
gui_insert_string_input (gui_current_window, key_str, -1);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
input_draw = 1;
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_DCC:
|
||||
gui_exec_action_dcc (gui_current_window, key_str);
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_RAW_DATA:
|
||||
gui_exec_action_raw_data (gui_current_window, key_str);
|
||||
break;
|
||||
key_str[1] = '^';
|
||||
key_str[2] = '\0';
|
||||
}
|
||||
|
||||
/*gui_printf (gui_current_window->buffer, "gui_input_read: key = %s (%d)\n", key_str, key);*/
|
||||
|
||||
if (gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
|
||||
input_old = (gui_current_window->buffer->input_buffer) ?
|
||||
strdup (gui_current_window->buffer->input_buffer) : strdup ("");
|
||||
else
|
||||
input_old = NULL;
|
||||
|
||||
input_draw = 0;
|
||||
|
||||
if ((gui_keyboard_pressed (key_str) != 0) && (insert_ok))
|
||||
{
|
||||
if (strcmp (key_str, "^^") == 0)
|
||||
key_str[1] = '\0';
|
||||
|
||||
switch (gui_current_window->buffer->type)
|
||||
{
|
||||
case GUI_BUFFER_TYPE_STANDARD:
|
||||
gui_insert_string_input (gui_current_window, key_str, -1);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
input_draw = 1;
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_DCC:
|
||||
gui_exec_action_dcc (gui_current_window, key_str);
|
||||
break;
|
||||
case GUI_BUFFER_TYPE_RAW_DATA:
|
||||
gui_exec_action_raw_data (gui_current_window, key_str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* incremental text search in buffer */
|
||||
if ((gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
|
||||
&& ((input_old == NULL) || (gui_current_window->buffer->input_buffer == NULL)
|
||||
|| (strcmp (input_old, gui_current_window->buffer->input_buffer) != 0)))
|
||||
{
|
||||
gui_buffer_search_restart (gui_current_window);
|
||||
input_draw = 1;
|
||||
}
|
||||
|
||||
if (input_draw)
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
|
||||
if (input_old)
|
||||
free (input_old);
|
||||
}
|
||||
|
||||
/* incremental text search in buffer */
|
||||
if ((gui_current_window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
|
||||
&& ((input_old == NULL) || (gui_current_window->buffer->input_buffer == NULL)
|
||||
|| (strcmp (input_old, gui_current_window->buffer->input_buffer) != 0)))
|
||||
{
|
||||
gui_buffer_search_restart (gui_current_window);
|
||||
input_draw = 1;
|
||||
}
|
||||
|
||||
if (input_draw)
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
|
||||
if (input_old)
|
||||
free (input_old);
|
||||
|
||||
i++;
|
||||
gui_keyboard_buffer_reset ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,121 +43,7 @@
|
||||
void
|
||||
gui_keyboard_default_bindings ()
|
||||
{
|
||||
int i;
|
||||
char key_str[32], command[32];
|
||||
|
||||
/* keys binded with internal functions */
|
||||
gui_keyboard_bind ( /* RC */ "ctrl-M", "return");
|
||||
gui_keyboard_bind ( /* RC */ "ctrl-J", "return");
|
||||
gui_keyboard_bind ( /* tab */ "ctrl-I", "tab");
|
||||
gui_keyboard_bind ( /* basckp */ "ctrl-H", "backspace");
|
||||
gui_keyboard_bind ( /* basckp */ "ctrl-?", "backspace");
|
||||
gui_keyboard_bind ( /* del */ "meta2-3~", "delete");
|
||||
gui_keyboard_bind ( /* ^K */ "ctrl-K", "delete_end_line");
|
||||
gui_keyboard_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
|
||||
gui_keyboard_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
|
||||
gui_keyboard_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
|
||||
gui_keyboard_bind ( /* ^T */ "ctrl-T", "transpose_chars");
|
||||
gui_keyboard_bind ( /* home */ "meta2-1~", "home");
|
||||
gui_keyboard_bind ( /* home */ "meta2-H", "home");
|
||||
gui_keyboard_bind ( /* home */ "meta2-7~", "home");
|
||||
gui_keyboard_bind ( /* ^A */ "ctrl-A", "home");
|
||||
gui_keyboard_bind ( /* end */ "meta2-4~", "end");
|
||||
gui_keyboard_bind ( /* end */ "meta2-F", "end");
|
||||
gui_keyboard_bind ( /* end */ "meta2-8~", "end");
|
||||
gui_keyboard_bind ( /* ^E */ "ctrl-E", "end");
|
||||
gui_keyboard_bind ( /* left */ "meta2-D", "left");
|
||||
gui_keyboard_bind ( /* right */ "meta2-C", "right");
|
||||
gui_keyboard_bind ( /* up */ "meta2-A", "up");
|
||||
gui_keyboard_bind ( /* ^up */ "meta-Oa", "up_global");
|
||||
gui_keyboard_bind ( /* down */ "meta2-B", "down");
|
||||
gui_keyboard_bind ( /* ^down */ "meta-Ob", "down_global");
|
||||
gui_keyboard_bind ( /* pgup */ "meta2-5~", "page_up");
|
||||
gui_keyboard_bind ( /* pgdn */ "meta2-6~", "page_down");
|
||||
gui_keyboard_bind ( /* m-pgup */ "meta-meta2-5~", "scroll_up");
|
||||
gui_keyboard_bind ( /* m-pgdn */ "meta-meta2-6~", "scroll_down");
|
||||
gui_keyboard_bind ( /* F10 */ "meta2-21~", "infobar_clear");
|
||||
gui_keyboard_bind ( /* F11 */ "meta2-23~", "nick_page_up");
|
||||
gui_keyboard_bind ( /* F12 */ "meta2-24~", "nick_page_down");
|
||||
gui_keyboard_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
|
||||
gui_keyboard_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
|
||||
gui_keyboard_bind ( /* ^L */ "ctrl-L", "refresh");
|
||||
gui_keyboard_bind ( /* m-a */ "meta-a", "jump_smart");
|
||||
gui_keyboard_bind ( /* m-b */ "meta-b", "previous_word");
|
||||
gui_keyboard_bind ( /* ^left */ "meta-Od", "previous_word");
|
||||
gui_keyboard_bind ( /* m-d */ "meta-d", "delete_next_word");
|
||||
gui_keyboard_bind ( /* m-f */ "meta-f", "next_word");
|
||||
gui_keyboard_bind ( /* ^right */ "meta-Oc", "next_word");
|
||||
gui_keyboard_bind ( /* m-h */ "meta-h", "hotlist_clear");
|
||||
gui_keyboard_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
|
||||
gui_keyboard_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
|
||||
gui_keyboard_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
|
||||
gui_keyboard_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
|
||||
gui_keyboard_bind ( /* m-k */ "meta-k", "grab_key");
|
||||
gui_keyboard_bind ( /* m-n */ "meta-n", "scroll_next_highlight");
|
||||
gui_keyboard_bind ( /* m-p */ "meta-p", "scroll_previous_highlight");
|
||||
gui_keyboard_bind ( /* m-r */ "meta-r", "delete_line");
|
||||
gui_keyboard_bind ( /* m-s */ "meta-s", "switch_server");
|
||||
gui_keyboard_bind ( /* m-u */ "meta-u", "scroll_unread");
|
||||
|
||||
/* keys binded with commands */
|
||||
gui_keyboard_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
|
||||
gui_keyboard_bind ( /* F5 */ "meta2-15~", "/buffer -1");
|
||||
gui_keyboard_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
|
||||
gui_keyboard_bind ( /* F6 */ "meta2-17~", "/buffer +1");
|
||||
gui_keyboard_bind ( /* F7 */ "meta2-18~", "/window -1");
|
||||
gui_keyboard_bind ( /* F8 */ "meta2-19~", "/window +1");
|
||||
gui_keyboard_bind ( /* m-w,m-up */ "meta-wmeta-meta2-A", "/window up");
|
||||
gui_keyboard_bind ( /* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
|
||||
gui_keyboard_bind ( /* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
|
||||
gui_keyboard_bind ( /* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
|
||||
gui_keyboard_bind ( /* m-0 */ "meta-0", "/buffer 10");
|
||||
gui_keyboard_bind ( /* m-1 */ "meta-1", "/buffer 1");
|
||||
gui_keyboard_bind ( /* m-2 */ "meta-2", "/buffer 2");
|
||||
gui_keyboard_bind ( /* m-3 */ "meta-3", "/buffer 3");
|
||||
gui_keyboard_bind ( /* m-4 */ "meta-4", "/buffer 4");
|
||||
gui_keyboard_bind ( /* m-5 */ "meta-5", "/buffer 5");
|
||||
gui_keyboard_bind ( /* m-6 */ "meta-6", "/buffer 6");
|
||||
gui_keyboard_bind ( /* m-7 */ "meta-7", "/buffer 7");
|
||||
gui_keyboard_bind ( /* m-8 */ "meta-8", "/buffer 8");
|
||||
gui_keyboard_bind ( /* m-9 */ "meta-9", "/buffer 9");
|
||||
|
||||
/* bind meta-j + {01..99} to switch to buffers # > 10 */
|
||||
for (i = 1; i < 100; i++)
|
||||
{
|
||||
sprintf (key_str, "meta-j%02d", i);
|
||||
sprintf (command, "/buffer %d", i);
|
||||
gui_keyboard_bind (key_str, command);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_grab_end: insert grabbed key in input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_keyboard_get_expanded_name (gui_key_buffer);
|
||||
|
||||
if (expanded_key)
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->input_buffer_pos += utf8_strlen (expanded_key);
|
||||
gui_input_draw (gui_current_window->buffer, 1);
|
||||
}
|
||||
free (expanded_key);
|
||||
}
|
||||
|
||||
/* end grab mode */
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_buffer[0] = '\0';
|
||||
/* TODO: write this function for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1480,7 +1480,7 @@ gui_action_grab_key (t_gui_window *window, char *args)
|
||||
(void) args;
|
||||
|
||||
if (window->buffer->has_input)
|
||||
gui_keyboard_init_grab ();
|
||||
gui_keyboard_grab_init ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -89,6 +89,7 @@ enum t_weechat_color
|
||||
GUI_COLOR_WIN_TITLE_MORE,
|
||||
GUI_COLOR_WIN_INPUT_TEXT_NOT_FOUND,
|
||||
GUI_COLOR_WIN_NICK_CHANUSER,
|
||||
GUI_COLOR_WIN_INPUT_ACTIONS,
|
||||
GUI_NUM_COLORS
|
||||
};
|
||||
|
||||
|
||||
+160
-14
@@ -38,12 +38,20 @@
|
||||
#endif
|
||||
|
||||
|
||||
t_gui_key *gui_keys = NULL;
|
||||
t_gui_key *last_gui_key = NULL;
|
||||
t_gui_key *gui_keys = NULL; /* key bindings */
|
||||
t_gui_key *last_gui_key = NULL; /* last key binding */
|
||||
|
||||
char gui_key_buffer[128];
|
||||
int gui_key_grab = 0;
|
||||
int gui_key_grab_count = 0;
|
||||
char gui_key_combo_buffer[128]; /* buffer used for combos */
|
||||
int gui_key_grab = 0; /* 1 if grab mode enabled (alt-k pressed) */
|
||||
int gui_key_grab_count = 0; /* number of keys pressed in grab mode */
|
||||
|
||||
int *gui_keyboard_buffer = NULL; /* input buffer (for paste detection) */
|
||||
int gui_keyboard_buffer_alloc = 0; /* input buffer allocated size */
|
||||
int gui_keyboard_buffer_size = 0; /* input buffer size in bytes */
|
||||
|
||||
int gui_keyboard_paste_pending = 0; /* 1 is big paste was detected and */
|
||||
/* WeeChat is asking user what to do */
|
||||
int gui_keyboard_paste_lines = 0; /* number of lines for pending paste */
|
||||
|
||||
t_gui_key_function gui_key_functions[] =
|
||||
{ { "return", gui_action_return,
|
||||
@@ -161,7 +169,7 @@ t_gui_key_function gui_key_functions[] =
|
||||
void
|
||||
gui_keyboard_init ()
|
||||
{
|
||||
gui_key_buffer[0] = '\0';
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
|
||||
@@ -169,16 +177,45 @@ gui_keyboard_init ()
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_init_show: init "show mode"
|
||||
* gui_keyboard_grab_init: init "grab" mode
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_init_grab ()
|
||||
gui_keyboard_grab_init ()
|
||||
{
|
||||
gui_key_grab = 1;
|
||||
gui_key_grab_count = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_grab_end: insert grabbed key in input buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_grab_end ()
|
||||
{
|
||||
char *expanded_key;
|
||||
|
||||
/* get expanded name (for example: ^U => ctrl-u) */
|
||||
expanded_key = gui_keyboard_get_expanded_name (gui_key_combo_buffer);
|
||||
|
||||
if (expanded_key)
|
||||
{
|
||||
if (gui_current_window->buffer->has_input)
|
||||
{
|
||||
gui_insert_string_input (gui_current_window, expanded_key, -1);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
gui_input_draw (gui_current_window->buffer, 0);
|
||||
}
|
||||
free (expanded_key);
|
||||
}
|
||||
|
||||
/* end grab mode */
|
||||
gui_key_grab = 0;
|
||||
gui_key_grab_count = 0;
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_get_internal_code: get internal code from user key name
|
||||
* for example: return "^R" for "ctrl-R"
|
||||
@@ -564,8 +601,8 @@ gui_keyboard_pressed (char *key_str)
|
||||
char **commands, **ptr_cmd;
|
||||
|
||||
/* add key to buffer */
|
||||
first_key = (gui_key_buffer[0] == '\0');
|
||||
strcat (gui_key_buffer, key_str);
|
||||
first_key = (gui_key_combo_buffer[0] == '\0');
|
||||
strcat (gui_key_combo_buffer, key_str);
|
||||
|
||||
/* if we are in "show mode", increase counter and return */
|
||||
if (gui_key_grab)
|
||||
@@ -575,16 +612,16 @@ gui_keyboard_pressed (char *key_str)
|
||||
}
|
||||
|
||||
/* look for key combo in key table */
|
||||
ptr_key = gui_keyboard_search_part (gui_key_buffer);
|
||||
ptr_key = gui_keyboard_search_part (gui_key_combo_buffer);
|
||||
if (ptr_key)
|
||||
{
|
||||
if (ascii_strcasecmp (ptr_key->key, gui_key_buffer) == 0)
|
||||
if (ascii_strcasecmp (ptr_key->key, gui_key_combo_buffer) == 0)
|
||||
{
|
||||
/* exact combo found => execute function or command */
|
||||
buffer_before_key =
|
||||
(gui_current_window->buffer->input_buffer) ?
|
||||
strdup (gui_current_window->buffer->input_buffer) : strdup ("");
|
||||
gui_key_buffer[0] = '\0';
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
if (ptr_key->command)
|
||||
{
|
||||
commands = split_multi_command (ptr_key->command, ';');
|
||||
@@ -617,7 +654,7 @@ gui_keyboard_pressed (char *key_str)
|
||||
return 0;
|
||||
}
|
||||
|
||||
gui_key_buffer[0] = '\0';
|
||||
gui_key_combo_buffer[0] = '\0';
|
||||
|
||||
/* if this is first key and not found (even partial) => return 1
|
||||
else return 0 (= silently discard sequence of bad keys) */
|
||||
@@ -662,3 +699,112 @@ gui_keyboard_free_all ()
|
||||
while (gui_keys)
|
||||
gui_keyboard_free (gui_keys);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_buffer_optimize: optimize keyboard buffer size
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_buffer_optimize ()
|
||||
{
|
||||
int optimal_size;
|
||||
|
||||
optimal_size = (((gui_keyboard_buffer_size * sizeof (int)) /
|
||||
GUI_KEYBOARD_BUFFER_BLOCK_SIZE) *
|
||||
GUI_KEYBOARD_BUFFER_BLOCK_SIZE) +
|
||||
GUI_KEYBOARD_BUFFER_BLOCK_SIZE;
|
||||
|
||||
if (gui_keyboard_buffer_alloc != optimal_size)
|
||||
{
|
||||
gui_keyboard_buffer_alloc = optimal_size;
|
||||
gui_keyboard_buffer = realloc (gui_keyboard_buffer, optimal_size);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_buffer_reset: reset keyboard buffer
|
||||
* (create empty if never created before)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_buffer_reset ()
|
||||
{
|
||||
if (!gui_keyboard_buffer)
|
||||
{
|
||||
gui_keyboard_buffer_alloc = GUI_KEYBOARD_BUFFER_BLOCK_SIZE;
|
||||
gui_keyboard_buffer_size = 0;
|
||||
gui_keyboard_buffer = (int *) malloc (gui_keyboard_buffer_alloc);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_keyboard_buffer_size = 0;
|
||||
gui_keyboard_buffer_optimize ();
|
||||
}
|
||||
gui_keyboard_paste_lines = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_buffer_add: add a key to keyboard buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_buffer_add (int key)
|
||||
{
|
||||
if (!gui_keyboard_buffer)
|
||||
gui_keyboard_buffer_reset ();
|
||||
|
||||
gui_keyboard_buffer_size++;
|
||||
|
||||
gui_keyboard_buffer_optimize ();
|
||||
|
||||
if (gui_keyboard_buffer)
|
||||
{
|
||||
gui_keyboard_buffer[gui_keyboard_buffer_size - 1] = key;
|
||||
if (key == 10)
|
||||
gui_keyboard_paste_lines++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_keyboard_buffer_alloc = 0;
|
||||
gui_keyboard_buffer_size = 0;
|
||||
gui_keyboard_paste_lines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_get_paste_lines: return real number of lines in buffer
|
||||
* if last key is not Return, then this is lines + 1
|
||||
* else it's lines
|
||||
*/
|
||||
|
||||
int
|
||||
gui_keyboard_get_paste_lines ()
|
||||
{
|
||||
if ((gui_keyboard_buffer_size > 0)
|
||||
&& (gui_keyboard_buffer[gui_keyboard_buffer_size - 1] != 10))
|
||||
return gui_keyboard_paste_lines + 1;
|
||||
|
||||
return gui_keyboard_paste_lines;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_paste_accept: accept paste from user
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_paste_accept ()
|
||||
{
|
||||
gui_keyboard_paste_pending = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* gui_keyboard_paste_cancel: cancel paste from user (reset buffer)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_keyboard_paste_cancel ()
|
||||
{
|
||||
gui_keyboard_buffer_reset ();
|
||||
gui_keyboard_paste_pending = 0;
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_GUI_KEY_H
|
||||
#define __WEECHAT_GUI_KEY_H 1
|
||||
#ifndef __WEECHAT_GUI_KEYBOARD_H
|
||||
#define __WEECHAT_GUI_KEYBOARD_H 1
|
||||
|
||||
#define GUI_KEYBOARD_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
/* key structures */
|
||||
|
||||
@@ -50,8 +52,11 @@ struct t_gui_key_function
|
||||
extern t_gui_key *gui_keys;
|
||||
extern t_gui_key *last_gui_key;
|
||||
extern t_gui_key_function gui_key_functions[];
|
||||
extern char gui_key_buffer[128];
|
||||
extern char gui_key_combo_buffer[128];
|
||||
extern int gui_key_grab;
|
||||
extern int gui_key_grab_count;
|
||||
extern int *gui_keyboard_buffer;
|
||||
extern int gui_keyboard_buffer_size;
|
||||
extern int gui_keyboard_paste_pending;
|
||||
|
||||
#endif /* gui-key.h */
|
||||
#endif /* gui-keyboard.h */
|
||||
|
||||
@@ -174,7 +174,8 @@ extern void gui_action_search_text (t_gui_window *, char *);
|
||||
|
||||
/* key */
|
||||
extern void gui_keyboard_init ();
|
||||
extern void gui_keyboard_init_grab ();
|
||||
extern void gui_keyboard_grab_init ();
|
||||
extern void gui_keyboard_grab_end ();
|
||||
extern char *gui_keyboard_get_internal_code (char *);
|
||||
extern char *gui_keyboard_get_expanded_name (char *);
|
||||
extern t_gui_key *gui_keyboard_search (char *);
|
||||
@@ -185,6 +186,11 @@ extern int gui_keyboard_unbind (char *);
|
||||
extern int gui_keyboard_pressed (char *);
|
||||
extern void gui_keyboard_free (t_gui_key *);
|
||||
extern void gui_keyboard_free_all ();
|
||||
extern void gui_keyboard_buffer_reset ();
|
||||
extern void gui_keyboard_buffer_add (int);
|
||||
extern int gui_keyboard_get_paste_lines ();
|
||||
extern void gui_keyboard_paste_accept ();
|
||||
extern void gui_keyboard_paste_cancel ();
|
||||
|
||||
/* log */
|
||||
extern void gui_log_write_date (t_gui_buffer *);
|
||||
|
||||
Reference in New Issue
Block a user