mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 23:06:38 +02:00
core: fix auto-apply of window layout in current window when option irc.look.buffer_switch_autojoin is on
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
WeeChat ChangeLog
|
||||
=================
|
||||
Sébastien Helleu <flashcode@flashtux.org>
|
||||
v0.4.3-dev, 2013-10-26
|
||||
v0.4.3-dev, 2013-10-27
|
||||
|
||||
|
||||
This document lists all changes for each version.
|
||||
@@ -14,6 +14,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
|
||||
Version 0.4.3 (under dev!)
|
||||
--------------------------
|
||||
|
||||
* core: fix auto-apply of window layout in current window when option
|
||||
irc.look.buffer_switch_autojoin is on
|
||||
* core: fix bind of keys in cursor/mouse context when key starts with "@"
|
||||
(remove the warning about unsafe key)
|
||||
* core: fix truncated prefix when filters are toggled (bug #40204)
|
||||
|
||||
+13
-6
@@ -1492,6 +1492,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
{
|
||||
long number;
|
||||
char *error;
|
||||
int auto_switch;
|
||||
|
||||
if (!property || !value)
|
||||
return;
|
||||
@@ -1527,13 +1528,19 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
else if (string_strcasecmp (property, "display") == 0)
|
||||
{
|
||||
/*
|
||||
* if it is auto-switch to a buffer, then we don't set read marker,
|
||||
* otherwise we reset it (if current buffer is not displayed) after
|
||||
* switch
|
||||
* on "automatic" switch:
|
||||
* - check if the buffer displayed in window is the buffer in layout:
|
||||
* if yes, do NOT switch to buffer
|
||||
* - do NOT set the read marker
|
||||
*/
|
||||
gui_window_switch_to_buffer (gui_current_window, buffer,
|
||||
(string_strcasecmp (value, "auto") == 0) ?
|
||||
0 : 1);
|
||||
auto_switch = (string_strcasecmp (value, "auto") == 0);
|
||||
if (!auto_switch
|
||||
|| (gui_layout_window_check_buffer (gui_current_window) != 1))
|
||||
{
|
||||
gui_window_switch_to_buffer (gui_current_window,
|
||||
buffer,
|
||||
(auto_switch) ? 0 : 1);
|
||||
}
|
||||
}
|
||||
else if (string_strcasecmp (property, "print_hooks_enabled") == 0)
|
||||
{
|
||||
|
||||
@@ -611,6 +611,34 @@ gui_layout_window_save (struct t_gui_layout *layout)
|
||||
gui_windows_tree);
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks whether a window has its layout buffer displayed or not.
|
||||
*
|
||||
* Returns:
|
||||
* 1: the window has layout info and the proper buffer displayed
|
||||
* 0: the window has layout info but NOT the proper buffer displayed
|
||||
* -1: the window has no layout info
|
||||
*/
|
||||
|
||||
int
|
||||
gui_layout_window_check_buffer (struct t_gui_window *window)
|
||||
{
|
||||
/* no layout? return -1 */
|
||||
if (!window->layout_plugin_name || !window->layout_buffer_name)
|
||||
return -1;
|
||||
|
||||
/* layout and buffer displayed matches? return 1 */
|
||||
if ((strcmp (window->layout_plugin_name,
|
||||
gui_buffer_get_plugin_name (window->buffer)) == 0)
|
||||
&& (strcmp (window->layout_buffer_name, (window->buffer)->name) == 0))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* buffer displayed does not match the layout, return 0 */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assigns a buffer to windows.
|
||||
*/
|
||||
|
||||
@@ -105,6 +105,7 @@ extern struct t_gui_layout_window *gui_layout_window_add (struct t_gui_layout_wi
|
||||
const char *plugin_name,
|
||||
const char *buffer_name);
|
||||
extern void gui_layout_window_save (struct t_gui_layout *layout);
|
||||
extern int gui_layout_window_check_buffer (struct t_gui_window *window);
|
||||
extern void gui_layout_window_assign_buffer (struct t_gui_buffer *buffer);
|
||||
extern void gui_layout_window_apply (struct t_gui_layout *layout,
|
||||
int internal_id_current_window);
|
||||
|
||||
Reference in New Issue
Block a user