1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 14:56:39 +02:00

Added new keys for switching to other windows: alt-w followed by alt-{arrow}

This commit is contained in:
Sebastien Helleu
2005-11-22 13:43:54 +00:00
parent 470e8a0296
commit 4ea27db1d7
14 changed files with 548 additions and 216 deletions
+5 -3
View File
@@ -1,13 +1,15 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2005-11-20
ChangeLog - 2005-11-22
Version 0.1.7 (under dev!):
* added new keys for scrolling to previous/next highlight (alt-P / alt-N)
* added new keys for switching to other windows: alt-w followed by
alt-{arrow}
* added new keys for scrolling to previous/next highlight: alt-P / alt-N
* added "read marker": an indicator for first unread line in a
server or channel buffer (alt-U to scroll to marker)
server or channel buffer (new key alt-U to scroll to marker)
* new window maganement: custom size for windows, auto resize when
terminal is resized
* fixed infinite loop when resizing term to small size
+21 -12
View File
@@ -1014,13 +1014,13 @@ weechat_cmd_buffer (int argc, char **argv)
if ((error) && (error[0] == '\0'))
{
if (argv[1][0] == '+')
gui_move_buffer_to_number (gui_current_window,
gui_buffer_move_to_number (gui_current_window,
gui_current_window->buffer->number + ((int) number));
else if (argv[1][0] == '-')
gui_move_buffer_to_number (gui_current_window,
gui_buffer_move_to_number (gui_current_window,
gui_current_window->buffer->number - ((int) number));
else
gui_move_buffer_to_number (gui_current_window, (int) number);
gui_buffer_move_to_number (gui_current_window, (int) number);
}
else
{
@@ -1197,9 +1197,10 @@ weechat_cmd_buffer (int argc, char **argv)
{
target_buffer = gui_current_window->buffer->number - (int) number;
if (target_buffer < 1)
target_buffer = (last_gui_buffer) ? last_gui_buffer->number + target_buffer : 1;
gui_switch_to_buffer_by_number (gui_current_window,
target_buffer);
target_buffer = (last_gui_buffer) ?
last_gui_buffer->number + target_buffer : 1;
gui_buffer_switch_by_number (gui_current_window,
target_buffer);
}
}
else if (argv[0][0] == '+')
@@ -1212,8 +1213,8 @@ weechat_cmd_buffer (int argc, char **argv)
target_buffer = gui_current_window->buffer->number + (int) number;
if (last_gui_buffer && target_buffer > last_gui_buffer->number)
target_buffer -= last_gui_buffer->number;
gui_switch_to_buffer_by_number (gui_current_window,
target_buffer);
gui_buffer_switch_by_number (gui_current_window,
target_buffer);
}
}
else
@@ -1222,7 +1223,7 @@ weechat_cmd_buffer (int argc, char **argv)
error = NULL;
number = strtol (argv[0], &error, 10);
if ((error) && (error[0] == '\0'))
gui_switch_to_buffer_by_number (gui_current_window, (int) number);
gui_buffer_switch_by_number (gui_current_window, (int) number);
}
}
@@ -2954,12 +2955,20 @@ weechat_cmd_window (int argc, char **argv)
error = NULL;
number = strtol (argv[0] + 1, &error, 10);
if ((error) && (error[0] == '\0'))
gui_switch_to_window_by_buffer (gui_current_window, number);
gui_window_switch_by_buffer (gui_current_window, number);
}
else if (ascii_strcasecmp (argv[0], "-1") == 0)
gui_switch_to_previous_window (gui_current_window);
gui_window_switch_previous (gui_current_window);
else if (ascii_strcasecmp (argv[0], "+1") == 0)
gui_switch_to_next_window (gui_current_window);
gui_window_switch_next (gui_current_window);
else if (ascii_strcasecmp (argv[0], "up") == 0)
gui_window_switch_up (gui_current_window);
else if (ascii_strcasecmp (argv[0], "down") == 0)
gui_window_switch_down (gui_current_window);
else if (ascii_strcasecmp (argv[0], "left") == 0)
gui_window_switch_left (gui_current_window);
else if (ascii_strcasecmp (argv[0], "right") == 0)
gui_window_switch_right (gui_current_window);
else
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
+147
View File
@@ -3086,6 +3086,153 @@ gui_window_merge_all (t_gui_window *window)
gui_redraw_buffer (window->buffer);
}
/*
* gui_window_side_by_side: return a code about position of 2 windows:
* 0 = they're not side by side
* 1 = side by side (win2 is over the win1)
* 2 = side by side (win2 on the right)
* 3 = side by side (win2 below win1)
* 4 = side by side (win2 on the left)
*/
int
gui_window_side_by_side (t_gui_window *win1, t_gui_window *win2)
{
/* win2 over win1 ? */
if (win2->win_y + win2->win_height == win1->win_y)
{
if (win2->win_x >= win1->win_x + win1->win_width)
return 0;
if (win2->win_x + win2->win_width <= win1->win_x)
return 0;
return 1;
}
/* win2 on the right ? */
if (win2->win_x == win1->win_x + win1->win_width + 1)
{
if (win2->win_y >= win1->win_y + win1->win_height)
return 0;
if (win2->win_y + win2->win_height <= win1->win_y)
return 0;
return 2;
}
/* win2 below win1 ? */
if (win2->win_y == win1->win_y + win1->win_height)
{
if (win2->win_x >= win1->win_x + win1->win_width)
return 0;
if (win2->win_x + win2->win_width <= win1->win_x)
return 0;
return 3;
}
/* win2 on the left ? */
if (win2->win_x + win2->win_width + 1 == win1->win_x)
{
if (win2->win_y >= win1->win_y + win1->win_height)
return 0;
if (win2->win_y + win2->win_height <= win1->win_y)
return 0;
return 4;
}
return 0;
}
/*
* gui_window_switch_up: search and switch to a window over current window
*/
void
gui_window_switch_up (t_gui_window *window)
{
t_gui_window *ptr_win;
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
if ((ptr_win != window) &&
(gui_window_side_by_side (window, ptr_win) == 1))
{
gui_current_window = ptr_win;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
return;
}
}
}
/*
* gui_window_switch_down: search and switch to a window below current window
*/
void
gui_window_switch_down (t_gui_window *window)
{
t_gui_window *ptr_win;
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
if ((ptr_win != window) &&
(gui_window_side_by_side (window, ptr_win) == 3))
{
gui_current_window = ptr_win;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
return;
}
}
}
/*
* gui_window_switch_left: search and switch to a window on the left of current window
*/
void
gui_window_switch_left (t_gui_window *window)
{
t_gui_window *ptr_win;
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
if ((ptr_win != window) &&
(gui_window_side_by_side (window, ptr_win) == 4))
{
gui_current_window = ptr_win;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
return;
}
}
}
/*
* gui_window_switch_right: search and switch to a window on the right of current window
*/
void
gui_window_switch_right (t_gui_window *window)
{
t_gui_window *ptr_win;
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
if ((ptr_win != window) &&
(gui_window_side_by_side (window, ptr_win) == 2))
{
gui_current_window = ptr_win;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
return;
}
}
}
/*
* gui_refresh_screen: called when term size is modified
*/
+70 -66
View File
@@ -59,74 +59,78 @@ gui_input_default_key_bindings ()
char key_str[32], command[32];
/* keys binded with internal functions */
gui_key_bind ( /* RC */ "ctrl-M", "return");
gui_key_bind ( /* RC */ "ctrl-J", "return");
gui_key_bind ( /* tab */ "ctrl-I", "tab");
gui_key_bind ( /* basckp */ "ctrl-H", "backspace");
gui_key_bind ( /* basckp */ "ctrl-?", "backspace");
gui_key_bind ( /* del */ "meta2-3~", "delete");
gui_key_bind ( /* ^K */ "ctrl-K", "delete_end_line");
gui_key_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
gui_key_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
gui_key_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
gui_key_bind ( /* ^T */ "ctrl-T", "transpose_chars");
gui_key_bind ( /* home */ "meta2-1~", "home");
gui_key_bind ( /* home */ "meta2-H", "home");
gui_key_bind ( /* home */ "meta2-7~", "home");
gui_key_bind ( /* ^A */ "ctrl-A", "home");
gui_key_bind ( /* end */ "meta2-4~", "end");
gui_key_bind ( /* end */ "meta2-F", "end");
gui_key_bind ( /* end */ "meta2-8~", "end");
gui_key_bind ( /* ^E */ "ctrl-E", "end");
gui_key_bind ( /* left */ "meta2-D", "left");
gui_key_bind ( /* right */ "meta2-C", "right");
gui_key_bind ( /* up */ "meta2-A", "up");
gui_key_bind ( /* ^up */ "meta-Oa", "up_global");
gui_key_bind ( /* down */ "meta2-B", "down");
gui_key_bind ( /* ^down */ "meta-Ob", "down_global");
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
gui_key_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
gui_key_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
gui_key_bind ( /* ^L */ "ctrl-L", "refresh");
gui_key_bind ( /* m-a */ "meta-a", "jump_smart");
gui_key_bind ( /* m-b */ "meta-b", "previous_word");
gui_key_bind ( /* ^left */ "meta-Od", "previous_word");
gui_key_bind ( /* m-d */ "meta-d", "delete_next_word");
gui_key_bind ( /* m-f */ "meta-f", "next_word");
gui_key_bind ( /* ^right */ "meta-Oc", "next_word");
gui_key_bind ( /* m-h */ "meta-h", "hotlist_clear");
gui_key_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
gui_key_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
gui_key_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
gui_key_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
gui_key_bind ( /* m-k */ "meta-k", "grab_key");
gui_key_bind ( /* m-n */ "meta-n", "scroll_next_highlight");
gui_key_bind ( /* m-p */ "meta-p", "scroll_previous_highlight");
gui_key_bind ( /* m-r */ "meta-r", "delete_line");
gui_key_bind ( /* m-s */ "meta-s", "switch_server");
gui_key_bind ( /* m-u */ "meta-u", "scroll_unread");
gui_key_bind ( /* RC */ "ctrl-M", "return");
gui_key_bind ( /* RC */ "ctrl-J", "return");
gui_key_bind ( /* tab */ "ctrl-I", "tab");
gui_key_bind ( /* basckp */ "ctrl-H", "backspace");
gui_key_bind ( /* basckp */ "ctrl-?", "backspace");
gui_key_bind ( /* del */ "meta2-3~", "delete");
gui_key_bind ( /* ^K */ "ctrl-K", "delete_end_line");
gui_key_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
gui_key_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
gui_key_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
gui_key_bind ( /* ^T */ "ctrl-T", "transpose_chars");
gui_key_bind ( /* home */ "meta2-1~", "home");
gui_key_bind ( /* home */ "meta2-H", "home");
gui_key_bind ( /* home */ "meta2-7~", "home");
gui_key_bind ( /* ^A */ "ctrl-A", "home");
gui_key_bind ( /* end */ "meta2-4~", "end");
gui_key_bind ( /* end */ "meta2-F", "end");
gui_key_bind ( /* end */ "meta2-8~", "end");
gui_key_bind ( /* ^E */ "ctrl-E", "end");
gui_key_bind ( /* left */ "meta2-D", "left");
gui_key_bind ( /* right */ "meta2-C", "right");
gui_key_bind ( /* up */ "meta2-A", "up");
gui_key_bind ( /* ^up */ "meta-Oa", "up_global");
gui_key_bind ( /* down */ "meta2-B", "down");
gui_key_bind ( /* ^down */ "meta-Ob", "down_global");
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
gui_key_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
gui_key_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
gui_key_bind ( /* ^L */ "ctrl-L", "refresh");
gui_key_bind ( /* m-a */ "meta-a", "jump_smart");
gui_key_bind ( /* m-b */ "meta-b", "previous_word");
gui_key_bind ( /* ^left */ "meta-Od", "previous_word");
gui_key_bind ( /* m-d */ "meta-d", "delete_next_word");
gui_key_bind ( /* m-f */ "meta-f", "next_word");
gui_key_bind ( /* ^right */ "meta-Oc", "next_word");
gui_key_bind ( /* m-h */ "meta-h", "hotlist_clear");
gui_key_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
gui_key_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
gui_key_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
gui_key_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
gui_key_bind ( /* m-k */ "meta-k", "grab_key");
gui_key_bind ( /* m-n */ "meta-n", "scroll_next_highlight");
gui_key_bind ( /* m-p */ "meta-p", "scroll_previous_highlight");
gui_key_bind ( /* m-r */ "meta-r", "delete_line");
gui_key_bind ( /* m-s */ "meta-s", "switch_server");
gui_key_bind ( /* m-u */ "meta-u", "scroll_unread");
/* keys binded with commands */
gui_key_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
gui_key_bind ( /* F5 */ "meta2-15~", "/buffer -1");
gui_key_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
gui_key_bind ( /* F6 */ "meta2-17~", "/buffer +1");
gui_key_bind ( /* F7 */ "meta2-18~", "/window -1");
gui_key_bind ( /* F8 */ "meta2-19~", "/window +1");
gui_key_bind ( /* m-0 */ "meta-0", "/buffer 10");
gui_key_bind ( /* m-1 */ "meta-1", "/buffer 1");
gui_key_bind ( /* m-2 */ "meta-2", "/buffer 2");
gui_key_bind ( /* m-3 */ "meta-3", "/buffer 3");
gui_key_bind ( /* m-4 */ "meta-4", "/buffer 4");
gui_key_bind ( /* m-5 */ "meta-5", "/buffer 5");
gui_key_bind ( /* m-6 */ "meta-6", "/buffer 6");
gui_key_bind ( /* m-7 */ "meta-7", "/buffer 7");
gui_key_bind ( /* m-8 */ "meta-8", "/buffer 8");
gui_key_bind ( /* m-9 */ "meta-9", "/buffer 9");
gui_key_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
gui_key_bind ( /* F5 */ "meta2-15~", "/buffer -1");
gui_key_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
gui_key_bind ( /* F6 */ "meta2-17~", "/buffer +1");
gui_key_bind ( /* F7 */ "meta2-18~", "/window -1");
gui_key_bind ( /* F8 */ "meta2-19~", "/window +1");
gui_key_bind ( /* m-w,m-up */ "meta-wmeta-meta2-A", "/window up");
gui_key_bind ( /* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
gui_key_bind ( /* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
gui_key_bind ( /* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
gui_key_bind ( /* m-0 */ "meta-0", "/buffer 10");
gui_key_bind ( /* m-1 */ "meta-1", "/buffer 1");
gui_key_bind ( /* m-2 */ "meta-2", "/buffer 2");
gui_key_bind ( /* m-3 */ "meta-3", "/buffer 3");
gui_key_bind ( /* m-4 */ "meta-4", "/buffer 4");
gui_key_bind ( /* m-5 */ "meta-5", "/buffer 5");
gui_key_bind ( /* m-6 */ "meta-6", "/buffer 6");
gui_key_bind ( /* m-7 */ "meta-7", "/buffer 7");
gui_key_bind ( /* m-8 */ "meta-8", "/buffer 8");
gui_key_bind ( /* m-9 */ "meta-9", "/buffer 9");
/* bind meta-j + {01..99} to switch to buffers # > 10 */
for (i = 1; i < 100; i++)
+2 -2
View File
@@ -962,7 +962,7 @@ gui_action_jump_dcc (t_gui_window *window)
else
{
buffer_before_dcc = window->buffer;
gui_switch_to_dcc_buffer (window);
gui_buffer_switch_dcc (window);
}
}
@@ -974,7 +974,7 @@ void
gui_action_jump_last_buffer (t_gui_window *window)
{
if (last_gui_buffer)
gui_switch_to_buffer_by_number (window, last_gui_buffer->number);
gui_buffer_switch_by_number (window, last_gui_buffer->number);
}
/*
+17 -17
View File
@@ -555,7 +555,7 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
{
if ((buffer == ptr_win->buffer) &&
((buffer->next_buffer) || (buffer->prev_buffer)))
gui_switch_to_previous_buffer (ptr_win);
gui_buffer_switch_previous (ptr_win);
}
}
@@ -1299,11 +1299,11 @@ gui_window_switch_server (t_gui_window *window)
}
/*
* gui_switch_to_previous_buffer: switch to previous buffer
* gui_buffer_switch_previous: switch to previous buffer
*/
void
gui_switch_to_previous_buffer (t_gui_window *window)
gui_buffer_switch_previous (t_gui_window *window)
{
if (!gui_ok)
return;
@@ -1321,11 +1321,11 @@ gui_switch_to_previous_buffer (t_gui_window *window)
}
/*
* gui_switch_to_next_buffer: switch to next buffer
* gui_buffer_switch_next: switch to next buffer
*/
void
gui_switch_to_next_buffer (t_gui_window *window)
gui_buffer_switch_next (t_gui_window *window)
{
if (!gui_ok)
return;
@@ -1343,11 +1343,11 @@ gui_switch_to_next_buffer (t_gui_window *window)
}
/*
* gui_switch_to_previous_window: switch to previous window
* gui_window_switch_previous: switch to previous window
*/
void
gui_switch_to_previous_window (t_gui_window *window)
gui_window_switch_previous (t_gui_window *window)
{
if (!gui_ok)
return;
@@ -1362,11 +1362,11 @@ gui_switch_to_previous_window (t_gui_window *window)
}
/*
* gui_switch_to_next_window: switch to next window
* gui_window_switch_next: switch to next window
*/
void
gui_switch_to_next_window (t_gui_window *window)
gui_window_switch_next (t_gui_window *window)
{
if (!gui_ok)
return;
@@ -1381,11 +1381,11 @@ gui_switch_to_next_window (t_gui_window *window)
}
/*
* gui_switch_to_window_by_buffer: switch to next window displaying a buffer
* gui_window_switch_by_buffer: switch to next window displaying a buffer
*/
void
gui_switch_to_window_by_buffer (t_gui_window *window, int buffer_number)
gui_window_switch_by_buffer (t_gui_window *window, int buffer_number)
{
t_gui_window *ptr_win;
@@ -1407,11 +1407,11 @@ gui_switch_to_window_by_buffer (t_gui_window *window, int buffer_number)
}
/*
* gui_switch_to_dcc_buffer: switch to dcc buffer (create it if it does not exist)
* gui_buffer_switch_dcc: switch to dcc buffer (create it if it does not exist)
*/
void
gui_switch_to_dcc_buffer (t_gui_window *window)
gui_buffer_switch_dcc (t_gui_window *window)
{
t_gui_buffer *ptr_buffer;
@@ -1431,11 +1431,11 @@ gui_switch_to_dcc_buffer (t_gui_window *window)
}
/*
* gui_switch_to_buffer_by_number: switch to another buffer with number
* gui_buffer_switch_by_number: switch to another buffer with number
*/
t_gui_buffer *
gui_switch_to_buffer_by_number (t_gui_window *window, int number)
gui_buffer_switch_by_number (t_gui_window *window, int number)
{
t_gui_buffer *ptr_buffer;
@@ -1463,11 +1463,11 @@ gui_switch_to_buffer_by_number (t_gui_window *window, int number)
}
/*
* gui_switch_to_buffer_by_number: switch to another buffer with number
* gui_buffer_move_to_number: move a buffer to another number
*/
void
gui_move_buffer_to_number (t_gui_window *window, int number)
gui_buffer_move_to_number (t_gui_window *window, int number)
{
t_gui_buffer *ptr_buffer;
int i;
+12 -8
View File
@@ -418,14 +418,14 @@ extern int gui_insert_string_input (t_gui_window *, char *, int);
extern void gui_merge_servers (t_gui_window *);
extern void gui_split_server (t_gui_window *);
extern void gui_window_switch_server (t_gui_window *);
extern void gui_switch_to_previous_buffer (t_gui_window *);
extern void gui_switch_to_next_buffer (t_gui_window *);
extern void gui_switch_to_previous_window (t_gui_window *);
extern void gui_switch_to_next_window (t_gui_window *);
extern void gui_switch_to_window_by_buffer (t_gui_window *, int);
extern void gui_switch_to_dcc_buffer (t_gui_window *);
extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int);
extern void gui_move_buffer_to_number (t_gui_window *, int);
extern void gui_buffer_switch_previous (t_gui_window *);
extern void gui_buffer_switch_next (t_gui_window *);
extern void gui_window_switch_previous (t_gui_window *);
extern void gui_window_switch_next (t_gui_window *);
extern void gui_window_switch_by_buffer (t_gui_window *, int);
extern void gui_buffer_switch_dcc (t_gui_window *);
extern t_gui_buffer *gui_buffer_switch_by_number (t_gui_window *, int);
extern void gui_buffer_move_to_number (t_gui_window *, int);
extern void gui_window_print_log (t_gui_window *);
extern void gui_buffer_print_log (t_gui_buffer *);
@@ -519,6 +519,10 @@ extern void gui_window_split_vertic (t_gui_window *, int);
extern void gui_window_resize (t_gui_window *, int);
extern int gui_window_merge (t_gui_window *);
extern void gui_window_merge_all (t_gui_window *);
extern void gui_window_switch_up (t_gui_window *);
extern void gui_window_switch_down (t_gui_window *);
extern void gui_window_switch_left (t_gui_window *);
extern void gui_window_switch_right (t_gui_window *);
extern void gui_refresh_screen ();
extern void gui_pre_init (int *, char **[]);
extern void gui_init_color_pairs ();
+5 -3
View File
@@ -1,13 +1,15 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2005-11-20
ChangeLog - 2005-11-22
Version 0.1.7 (under dev!):
* added new keys for scrolling to previous/next highlight (alt-P / alt-N)
* added new keys for switching to other windows: alt-w followed by
alt-{arrow}
* added new keys for scrolling to previous/next highlight: alt-P / alt-N
* added "read marker": an indicator for first unread line in a
server or channel buffer (alt-U to scroll to marker)
server or channel buffer (new key alt-U to scroll to marker)
* new window maganement: custom size for windows, auto resize when
terminal is resized
* fixed infinite loop when resizing term to small size
+21 -12
View File
@@ -1014,13 +1014,13 @@ weechat_cmd_buffer (int argc, char **argv)
if ((error) && (error[0] == '\0'))
{
if (argv[1][0] == '+')
gui_move_buffer_to_number (gui_current_window,
gui_buffer_move_to_number (gui_current_window,
gui_current_window->buffer->number + ((int) number));
else if (argv[1][0] == '-')
gui_move_buffer_to_number (gui_current_window,
gui_buffer_move_to_number (gui_current_window,
gui_current_window->buffer->number - ((int) number));
else
gui_move_buffer_to_number (gui_current_window, (int) number);
gui_buffer_move_to_number (gui_current_window, (int) number);
}
else
{
@@ -1197,9 +1197,10 @@ weechat_cmd_buffer (int argc, char **argv)
{
target_buffer = gui_current_window->buffer->number - (int) number;
if (target_buffer < 1)
target_buffer = (last_gui_buffer) ? last_gui_buffer->number + target_buffer : 1;
gui_switch_to_buffer_by_number (gui_current_window,
target_buffer);
target_buffer = (last_gui_buffer) ?
last_gui_buffer->number + target_buffer : 1;
gui_buffer_switch_by_number (gui_current_window,
target_buffer);
}
}
else if (argv[0][0] == '+')
@@ -1212,8 +1213,8 @@ weechat_cmd_buffer (int argc, char **argv)
target_buffer = gui_current_window->buffer->number + (int) number;
if (last_gui_buffer && target_buffer > last_gui_buffer->number)
target_buffer -= last_gui_buffer->number;
gui_switch_to_buffer_by_number (gui_current_window,
target_buffer);
gui_buffer_switch_by_number (gui_current_window,
target_buffer);
}
}
else
@@ -1222,7 +1223,7 @@ weechat_cmd_buffer (int argc, char **argv)
error = NULL;
number = strtol (argv[0], &error, 10);
if ((error) && (error[0] == '\0'))
gui_switch_to_buffer_by_number (gui_current_window, (int) number);
gui_buffer_switch_by_number (gui_current_window, (int) number);
}
}
@@ -2954,12 +2955,20 @@ weechat_cmd_window (int argc, char **argv)
error = NULL;
number = strtol (argv[0] + 1, &error, 10);
if ((error) && (error[0] == '\0'))
gui_switch_to_window_by_buffer (gui_current_window, number);
gui_window_switch_by_buffer (gui_current_window, number);
}
else if (ascii_strcasecmp (argv[0], "-1") == 0)
gui_switch_to_previous_window (gui_current_window);
gui_window_switch_previous (gui_current_window);
else if (ascii_strcasecmp (argv[0], "+1") == 0)
gui_switch_to_next_window (gui_current_window);
gui_window_switch_next (gui_current_window);
else if (ascii_strcasecmp (argv[0], "up") == 0)
gui_window_switch_up (gui_current_window);
else if (ascii_strcasecmp (argv[0], "down") == 0)
gui_window_switch_down (gui_current_window);
else if (ascii_strcasecmp (argv[0], "left") == 0)
gui_window_switch_left (gui_current_window);
else if (ascii_strcasecmp (argv[0], "right") == 0)
gui_window_switch_right (gui_current_window);
else
{
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
+147
View File
@@ -3086,6 +3086,153 @@ gui_window_merge_all (t_gui_window *window)
gui_redraw_buffer (window->buffer);
}
/*
* gui_window_side_by_side: return a code about position of 2 windows:
* 0 = they're not side by side
* 1 = side by side (win2 is over the win1)
* 2 = side by side (win2 on the right)
* 3 = side by side (win2 below win1)
* 4 = side by side (win2 on the left)
*/
int
gui_window_side_by_side (t_gui_window *win1, t_gui_window *win2)
{
/* win2 over win1 ? */
if (win2->win_y + win2->win_height == win1->win_y)
{
if (win2->win_x >= win1->win_x + win1->win_width)
return 0;
if (win2->win_x + win2->win_width <= win1->win_x)
return 0;
return 1;
}
/* win2 on the right ? */
if (win2->win_x == win1->win_x + win1->win_width + 1)
{
if (win2->win_y >= win1->win_y + win1->win_height)
return 0;
if (win2->win_y + win2->win_height <= win1->win_y)
return 0;
return 2;
}
/* win2 below win1 ? */
if (win2->win_y == win1->win_y + win1->win_height)
{
if (win2->win_x >= win1->win_x + win1->win_width)
return 0;
if (win2->win_x + win2->win_width <= win1->win_x)
return 0;
return 3;
}
/* win2 on the left ? */
if (win2->win_x + win2->win_width + 1 == win1->win_x)
{
if (win2->win_y >= win1->win_y + win1->win_height)
return 0;
if (win2->win_y + win2->win_height <= win1->win_y)
return 0;
return 4;
}
return 0;
}
/*
* gui_window_switch_up: search and switch to a window over current window
*/
void
gui_window_switch_up (t_gui_window *window)
{
t_gui_window *ptr_win;
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
if ((ptr_win != window) &&
(gui_window_side_by_side (window, ptr_win) == 1))
{
gui_current_window = ptr_win;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
return;
}
}
}
/*
* gui_window_switch_down: search and switch to a window below current window
*/
void
gui_window_switch_down (t_gui_window *window)
{
t_gui_window *ptr_win;
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
if ((ptr_win != window) &&
(gui_window_side_by_side (window, ptr_win) == 3))
{
gui_current_window = ptr_win;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
return;
}
}
}
/*
* gui_window_switch_left: search and switch to a window on the left of current window
*/
void
gui_window_switch_left (t_gui_window *window)
{
t_gui_window *ptr_win;
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
if ((ptr_win != window) &&
(gui_window_side_by_side (window, ptr_win) == 4))
{
gui_current_window = ptr_win;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
return;
}
}
}
/*
* gui_window_switch_right: search and switch to a window on the right of current window
*/
void
gui_window_switch_right (t_gui_window *window)
{
t_gui_window *ptr_win;
for (ptr_win = gui_windows; ptr_win;
ptr_win = ptr_win->next_window)
{
if ((ptr_win != window) &&
(gui_window_side_by_side (window, ptr_win) == 2))
{
gui_current_window = ptr_win;
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_redraw_buffer (gui_current_window->buffer);
return;
}
}
}
/*
* gui_refresh_screen: called when term size is modified
*/
+70 -66
View File
@@ -59,74 +59,78 @@ gui_input_default_key_bindings ()
char key_str[32], command[32];
/* keys binded with internal functions */
gui_key_bind ( /* RC */ "ctrl-M", "return");
gui_key_bind ( /* RC */ "ctrl-J", "return");
gui_key_bind ( /* tab */ "ctrl-I", "tab");
gui_key_bind ( /* basckp */ "ctrl-H", "backspace");
gui_key_bind ( /* basckp */ "ctrl-?", "backspace");
gui_key_bind ( /* del */ "meta2-3~", "delete");
gui_key_bind ( /* ^K */ "ctrl-K", "delete_end_line");
gui_key_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
gui_key_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
gui_key_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
gui_key_bind ( /* ^T */ "ctrl-T", "transpose_chars");
gui_key_bind ( /* home */ "meta2-1~", "home");
gui_key_bind ( /* home */ "meta2-H", "home");
gui_key_bind ( /* home */ "meta2-7~", "home");
gui_key_bind ( /* ^A */ "ctrl-A", "home");
gui_key_bind ( /* end */ "meta2-4~", "end");
gui_key_bind ( /* end */ "meta2-F", "end");
gui_key_bind ( /* end */ "meta2-8~", "end");
gui_key_bind ( /* ^E */ "ctrl-E", "end");
gui_key_bind ( /* left */ "meta2-D", "left");
gui_key_bind ( /* right */ "meta2-C", "right");
gui_key_bind ( /* up */ "meta2-A", "up");
gui_key_bind ( /* ^up */ "meta-Oa", "up_global");
gui_key_bind ( /* down */ "meta2-B", "down");
gui_key_bind ( /* ^down */ "meta-Ob", "down_global");
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
gui_key_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
gui_key_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
gui_key_bind ( /* ^L */ "ctrl-L", "refresh");
gui_key_bind ( /* m-a */ "meta-a", "jump_smart");
gui_key_bind ( /* m-b */ "meta-b", "previous_word");
gui_key_bind ( /* ^left */ "meta-Od", "previous_word");
gui_key_bind ( /* m-d */ "meta-d", "delete_next_word");
gui_key_bind ( /* m-f */ "meta-f", "next_word");
gui_key_bind ( /* ^right */ "meta-Oc", "next_word");
gui_key_bind ( /* m-h */ "meta-h", "hotlist_clear");
gui_key_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
gui_key_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
gui_key_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
gui_key_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
gui_key_bind ( /* m-k */ "meta-k", "grab_key");
gui_key_bind ( /* m-n */ "meta-n", "scroll_next_highlight");
gui_key_bind ( /* m-p */ "meta-p", "scroll_previous_highlight");
gui_key_bind ( /* m-r */ "meta-r", "delete_line");
gui_key_bind ( /* m-s */ "meta-s", "switch_server");
gui_key_bind ( /* m-u */ "meta-u", "scroll_unread");
gui_key_bind ( /* RC */ "ctrl-M", "return");
gui_key_bind ( /* RC */ "ctrl-J", "return");
gui_key_bind ( /* tab */ "ctrl-I", "tab");
gui_key_bind ( /* basckp */ "ctrl-H", "backspace");
gui_key_bind ( /* basckp */ "ctrl-?", "backspace");
gui_key_bind ( /* del */ "meta2-3~", "delete");
gui_key_bind ( /* ^K */ "ctrl-K", "delete_end_line");
gui_key_bind ( /* ^U */ "ctrl-U", "delete_beginning_line");
gui_key_bind ( /* ^W */ "ctrl-W", "delete_previous_word");
gui_key_bind ( /* ^Y */ "ctrl-Y", "clipboard_paste");
gui_key_bind ( /* ^T */ "ctrl-T", "transpose_chars");
gui_key_bind ( /* home */ "meta2-1~", "home");
gui_key_bind ( /* home */ "meta2-H", "home");
gui_key_bind ( /* home */ "meta2-7~", "home");
gui_key_bind ( /* ^A */ "ctrl-A", "home");
gui_key_bind ( /* end */ "meta2-4~", "end");
gui_key_bind ( /* end */ "meta2-F", "end");
gui_key_bind ( /* end */ "meta2-8~", "end");
gui_key_bind ( /* ^E */ "ctrl-E", "end");
gui_key_bind ( /* left */ "meta2-D", "left");
gui_key_bind ( /* right */ "meta2-C", "right");
gui_key_bind ( /* up */ "meta2-A", "up");
gui_key_bind ( /* ^up */ "meta-Oa", "up_global");
gui_key_bind ( /* down */ "meta2-B", "down");
gui_key_bind ( /* ^down */ "meta-Ob", "down_global");
gui_key_bind ( /* pgup */ "meta2-5~", "page_up");
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
gui_key_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
gui_key_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
gui_key_bind ( /* ^L */ "ctrl-L", "refresh");
gui_key_bind ( /* m-a */ "meta-a", "jump_smart");
gui_key_bind ( /* m-b */ "meta-b", "previous_word");
gui_key_bind ( /* ^left */ "meta-Od", "previous_word");
gui_key_bind ( /* m-d */ "meta-d", "delete_next_word");
gui_key_bind ( /* m-f */ "meta-f", "next_word");
gui_key_bind ( /* ^right */ "meta-Oc", "next_word");
gui_key_bind ( /* m-h */ "meta-h", "hotlist_clear");
gui_key_bind ( /* m-j,m-d */ "meta-jmeta-d", "jump_dcc");
gui_key_bind ( /* m-j,m-l */ "meta-jmeta-l", "jump_last_buffer");
gui_key_bind ( /* m-j,m-s */ "meta-jmeta-s", "jump_server");
gui_key_bind ( /* m-j,m-x */ "meta-jmeta-x", "jump_next_server");
gui_key_bind ( /* m-k */ "meta-k", "grab_key");
gui_key_bind ( /* m-n */ "meta-n", "scroll_next_highlight");
gui_key_bind ( /* m-p */ "meta-p", "scroll_previous_highlight");
gui_key_bind ( /* m-r */ "meta-r", "delete_line");
gui_key_bind ( /* m-s */ "meta-s", "switch_server");
gui_key_bind ( /* m-u */ "meta-u", "scroll_unread");
/* keys binded with commands */
gui_key_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
gui_key_bind ( /* F5 */ "meta2-15~", "/buffer -1");
gui_key_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
gui_key_bind ( /* F6 */ "meta2-17~", "/buffer +1");
gui_key_bind ( /* F7 */ "meta2-18~", "/window -1");
gui_key_bind ( /* F8 */ "meta2-19~", "/window +1");
gui_key_bind ( /* m-0 */ "meta-0", "/buffer 10");
gui_key_bind ( /* m-1 */ "meta-1", "/buffer 1");
gui_key_bind ( /* m-2 */ "meta-2", "/buffer 2");
gui_key_bind ( /* m-3 */ "meta-3", "/buffer 3");
gui_key_bind ( /* m-4 */ "meta-4", "/buffer 4");
gui_key_bind ( /* m-5 */ "meta-5", "/buffer 5");
gui_key_bind ( /* m-6 */ "meta-6", "/buffer 6");
gui_key_bind ( /* m-7 */ "meta-7", "/buffer 7");
gui_key_bind ( /* m-8 */ "meta-8", "/buffer 8");
gui_key_bind ( /* m-9 */ "meta-9", "/buffer 9");
gui_key_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
gui_key_bind ( /* F5 */ "meta2-15~", "/buffer -1");
gui_key_bind ( /* m-right */ "meta-meta2-C", "/buffer +1");
gui_key_bind ( /* F6 */ "meta2-17~", "/buffer +1");
gui_key_bind ( /* F7 */ "meta2-18~", "/window -1");
gui_key_bind ( /* F8 */ "meta2-19~", "/window +1");
gui_key_bind ( /* m-w,m-up */ "meta-wmeta-meta2-A", "/window up");
gui_key_bind ( /* m-w,m-down */ "meta-wmeta-meta2-B", "/window down");
gui_key_bind ( /* m-w,m-left */ "meta-wmeta-meta2-D", "/window left");
gui_key_bind ( /* m-w,m-right */ "meta-wmeta-meta2-C", "/window right");
gui_key_bind ( /* m-0 */ "meta-0", "/buffer 10");
gui_key_bind ( /* m-1 */ "meta-1", "/buffer 1");
gui_key_bind ( /* m-2 */ "meta-2", "/buffer 2");
gui_key_bind ( /* m-3 */ "meta-3", "/buffer 3");
gui_key_bind ( /* m-4 */ "meta-4", "/buffer 4");
gui_key_bind ( /* m-5 */ "meta-5", "/buffer 5");
gui_key_bind ( /* m-6 */ "meta-6", "/buffer 6");
gui_key_bind ( /* m-7 */ "meta-7", "/buffer 7");
gui_key_bind ( /* m-8 */ "meta-8", "/buffer 8");
gui_key_bind ( /* m-9 */ "meta-9", "/buffer 9");
/* bind meta-j + {01..99} to switch to buffers # > 10 */
for (i = 1; i < 100; i++)
+2 -2
View File
@@ -962,7 +962,7 @@ gui_action_jump_dcc (t_gui_window *window)
else
{
buffer_before_dcc = window->buffer;
gui_switch_to_dcc_buffer (window);
gui_buffer_switch_dcc (window);
}
}
@@ -974,7 +974,7 @@ void
gui_action_jump_last_buffer (t_gui_window *window)
{
if (last_gui_buffer)
gui_switch_to_buffer_by_number (window, last_gui_buffer->number);
gui_buffer_switch_by_number (window, last_gui_buffer->number);
}
/*
+17 -17
View File
@@ -555,7 +555,7 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
{
if ((buffer == ptr_win->buffer) &&
((buffer->next_buffer) || (buffer->prev_buffer)))
gui_switch_to_previous_buffer (ptr_win);
gui_buffer_switch_previous (ptr_win);
}
}
@@ -1299,11 +1299,11 @@ gui_window_switch_server (t_gui_window *window)
}
/*
* gui_switch_to_previous_buffer: switch to previous buffer
* gui_buffer_switch_previous: switch to previous buffer
*/
void
gui_switch_to_previous_buffer (t_gui_window *window)
gui_buffer_switch_previous (t_gui_window *window)
{
if (!gui_ok)
return;
@@ -1321,11 +1321,11 @@ gui_switch_to_previous_buffer (t_gui_window *window)
}
/*
* gui_switch_to_next_buffer: switch to next buffer
* gui_buffer_switch_next: switch to next buffer
*/
void
gui_switch_to_next_buffer (t_gui_window *window)
gui_buffer_switch_next (t_gui_window *window)
{
if (!gui_ok)
return;
@@ -1343,11 +1343,11 @@ gui_switch_to_next_buffer (t_gui_window *window)
}
/*
* gui_switch_to_previous_window: switch to previous window
* gui_window_switch_previous: switch to previous window
*/
void
gui_switch_to_previous_window (t_gui_window *window)
gui_window_switch_previous (t_gui_window *window)
{
if (!gui_ok)
return;
@@ -1362,11 +1362,11 @@ gui_switch_to_previous_window (t_gui_window *window)
}
/*
* gui_switch_to_next_window: switch to next window
* gui_window_switch_next: switch to next window
*/
void
gui_switch_to_next_window (t_gui_window *window)
gui_window_switch_next (t_gui_window *window)
{
if (!gui_ok)
return;
@@ -1381,11 +1381,11 @@ gui_switch_to_next_window (t_gui_window *window)
}
/*
* gui_switch_to_window_by_buffer: switch to next window displaying a buffer
* gui_window_switch_by_buffer: switch to next window displaying a buffer
*/
void
gui_switch_to_window_by_buffer (t_gui_window *window, int buffer_number)
gui_window_switch_by_buffer (t_gui_window *window, int buffer_number)
{
t_gui_window *ptr_win;
@@ -1407,11 +1407,11 @@ gui_switch_to_window_by_buffer (t_gui_window *window, int buffer_number)
}
/*
* gui_switch_to_dcc_buffer: switch to dcc buffer (create it if it does not exist)
* gui_buffer_switch_dcc: switch to dcc buffer (create it if it does not exist)
*/
void
gui_switch_to_dcc_buffer (t_gui_window *window)
gui_buffer_switch_dcc (t_gui_window *window)
{
t_gui_buffer *ptr_buffer;
@@ -1431,11 +1431,11 @@ gui_switch_to_dcc_buffer (t_gui_window *window)
}
/*
* gui_switch_to_buffer_by_number: switch to another buffer with number
* gui_buffer_switch_by_number: switch to another buffer with number
*/
t_gui_buffer *
gui_switch_to_buffer_by_number (t_gui_window *window, int number)
gui_buffer_switch_by_number (t_gui_window *window, int number)
{
t_gui_buffer *ptr_buffer;
@@ -1463,11 +1463,11 @@ gui_switch_to_buffer_by_number (t_gui_window *window, int number)
}
/*
* gui_switch_to_buffer_by_number: switch to another buffer with number
* gui_buffer_move_to_number: move a buffer to another number
*/
void
gui_move_buffer_to_number (t_gui_window *window, int number)
gui_buffer_move_to_number (t_gui_window *window, int number)
{
t_gui_buffer *ptr_buffer;
int i;
+12 -8
View File
@@ -418,14 +418,14 @@ extern int gui_insert_string_input (t_gui_window *, char *, int);
extern void gui_merge_servers (t_gui_window *);
extern void gui_split_server (t_gui_window *);
extern void gui_window_switch_server (t_gui_window *);
extern void gui_switch_to_previous_buffer (t_gui_window *);
extern void gui_switch_to_next_buffer (t_gui_window *);
extern void gui_switch_to_previous_window (t_gui_window *);
extern void gui_switch_to_next_window (t_gui_window *);
extern void gui_switch_to_window_by_buffer (t_gui_window *, int);
extern void gui_switch_to_dcc_buffer (t_gui_window *);
extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int);
extern void gui_move_buffer_to_number (t_gui_window *, int);
extern void gui_buffer_switch_previous (t_gui_window *);
extern void gui_buffer_switch_next (t_gui_window *);
extern void gui_window_switch_previous (t_gui_window *);
extern void gui_window_switch_next (t_gui_window *);
extern void gui_window_switch_by_buffer (t_gui_window *, int);
extern void gui_buffer_switch_dcc (t_gui_window *);
extern t_gui_buffer *gui_buffer_switch_by_number (t_gui_window *, int);
extern void gui_buffer_move_to_number (t_gui_window *, int);
extern void gui_window_print_log (t_gui_window *);
extern void gui_buffer_print_log (t_gui_buffer *);
@@ -519,6 +519,10 @@ extern void gui_window_split_vertic (t_gui_window *, int);
extern void gui_window_resize (t_gui_window *, int);
extern int gui_window_merge (t_gui_window *);
extern void gui_window_merge_all (t_gui_window *);
extern void gui_window_switch_up (t_gui_window *);
extern void gui_window_switch_down (t_gui_window *);
extern void gui_window_switch_left (t_gui_window *);
extern void gui_window_switch_right (t_gui_window *);
extern void gui_refresh_screen ();
extern void gui_pre_init (int *, char **[]);
extern void gui_init_color_pairs ();