summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-07-31 11:32:28 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-07-31 11:32:28 +0000
commit38fa7c93ac3d35b2c895ee178add06718442e1ca (patch)
treee9fa39ae30103fcc79ae284d29242a2862d684a2
parent9e328d3fef0d87135d7c4aa5d22f35a5703208cd (diff)
downloadweechat-38fa7c93ac3d35b2c895ee178add06718442e1ca.zip
Jump to next server now saves current channel buffer for each server
-rw-r--r--ChangeLog3
-rw-r--r--src/gui/gui-common.c20
-rw-r--r--src/gui/gui.h3
-rw-r--r--weechat/ChangeLog3
-rw-r--r--weechat/src/gui/gui-common.c20
-rw-r--r--weechat/src/gui/gui.h3
6 files changed, 46 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3da48182c..2bc351fe3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-ChangeLog - 2005-07-30
+ChangeLog - 2005-07-31
Version 0.1.5 (under dev!):
+ * jump to next server now saves current channel buffer for each server
* ctrl-up/ctrl-down keys added to call previous/next command in global
history (common to all buffers)
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c
index 47711121e..507608d7b 100644
--- a/src/gui/gui-common.c
+++ b/src/gui/gui-common.c
@@ -224,6 +224,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
new_buffer->ptr_history = NULL;
new_buffer->num_history = 0;
+ new_buffer->old_channel_buffer = NULL;
+
/* add buffer to buffers queue */
new_buffer->prev_buffer = last_gui_buffer;
if (gui_buffers)
@@ -426,6 +428,12 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
if (buffer_before_dcc == buffer)
buffer_before_dcc = NULL;
+ for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ {
+ if (ptr_buffer->old_channel_buffer == buffer)
+ ptr_buffer->old_channel_buffer = NULL;
+ }
+
if (switch_to_another)
{
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
@@ -1547,8 +1555,16 @@ gui_input_jump_next_server ()
}
if (ptr_server != SERVER(gui_current_window->buffer))
{
- ptr_buffer = (ptr_server->channels) ?
- ptr_server->channels->buffer : ptr_server->buffer;
+ /* save current buffer */
+ SERVER(gui_current_window->buffer)->buffer->old_channel_buffer =
+ gui_current_window->buffer;
+
+ /* come back to memorized chan if found */
+ if (ptr_server->buffer->old_channel_buffer)
+ ptr_buffer = ptr_server->buffer->old_channel_buffer;
+ else
+ ptr_buffer = (ptr_server->channels) ?
+ ptr_server->channels->buffer : ptr_server->buffer;
gui_switch_to_buffer (gui_current_window, ptr_buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 532937510..4919a6ef9 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -201,6 +201,9 @@ struct t_gui_buffer
t_history *ptr_history; /* current command in history */
int num_history; /* number of commands in history */
+ /* channel buffer before jumping to next server */
+ t_gui_buffer *old_channel_buffer; /* only used for server buffer */
+
/* link to previous/next buffer */
t_gui_buffer *prev_buffer; /* link to previous buffer */
t_gui_buffer *next_buffer; /* link to next buffer */
diff --git a/weechat/ChangeLog b/weechat/ChangeLog
index 3da48182c..2bc351fe3 100644
--- a/weechat/ChangeLog
+++ b/weechat/ChangeLog
@@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-ChangeLog - 2005-07-30
+ChangeLog - 2005-07-31
Version 0.1.5 (under dev!):
+ * jump to next server now saves current channel buffer for each server
* ctrl-up/ctrl-down keys added to call previous/next command in global
history (common to all buffers)
diff --git a/weechat/src/gui/gui-common.c b/weechat/src/gui/gui-common.c
index 47711121e..507608d7b 100644
--- a/weechat/src/gui/gui-common.c
+++ b/weechat/src/gui/gui-common.c
@@ -224,6 +224,8 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int dcc,
new_buffer->ptr_history = NULL;
new_buffer->num_history = 0;
+ new_buffer->old_channel_buffer = NULL;
+
/* add buffer to buffers queue */
new_buffer->prev_buffer = last_gui_buffer;
if (gui_buffers)
@@ -426,6 +428,12 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
if (buffer_before_dcc == buffer)
buffer_before_dcc = NULL;
+ for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ {
+ if (ptr_buffer->old_channel_buffer == buffer)
+ ptr_buffer->old_channel_buffer = NULL;
+ }
+
if (switch_to_another)
{
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
@@ -1547,8 +1555,16 @@ gui_input_jump_next_server ()
}
if (ptr_server != SERVER(gui_current_window->buffer))
{
- ptr_buffer = (ptr_server->channels) ?
- ptr_server->channels->buffer : ptr_server->buffer;
+ /* save current buffer */
+ SERVER(gui_current_window->buffer)->buffer->old_channel_buffer =
+ gui_current_window->buffer;
+
+ /* come back to memorized chan if found */
+ if (ptr_server->buffer->old_channel_buffer)
+ ptr_buffer = ptr_server->buffer->old_channel_buffer;
+ else
+ ptr_buffer = (ptr_server->channels) ?
+ ptr_server->channels->buffer : ptr_server->buffer;
gui_switch_to_buffer (gui_current_window, ptr_buffer);
gui_redraw_buffer (gui_current_window->buffer);
}
diff --git a/weechat/src/gui/gui.h b/weechat/src/gui/gui.h
index 532937510..4919a6ef9 100644
--- a/weechat/src/gui/gui.h
+++ b/weechat/src/gui/gui.h
@@ -201,6 +201,9 @@ struct t_gui_buffer
t_history *ptr_history; /* current command in history */
int num_history; /* number of commands in history */
+ /* channel buffer before jumping to next server */
+ t_gui_buffer *old_channel_buffer; /* only used for server buffer */
+
/* link to previous/next buffer */
t_gui_buffer *prev_buffer; /* link to previous buffer */
t_gui_buffer *next_buffer; /* link to next buffer */