1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

core: disable paste detection and confirmation if bar item "input_paste" is not used in a visible bar (task #12327)

This commit is contained in:
Nils Görs
2012-12-05 19:04:07 +01:00
committed by Sebastien Helleu
parent dd99a1cf2c
commit 03cbb1c8f6
5 changed files with 30 additions and 12 deletions
+2
View File
@@ -7,6 +7,8 @@ v0.4.0-dev, 2012-12-05
Version 0.4.0 (under dev!)
--------------------------
* core: disable paste detection and confirmation if bar item "input_paste" is
not used in a visible bar (task #12327)
* core: use high priority (50000) for commands /command and /input so that an
alias will not take precedence over these commands (bug #36353)
* core: execute command with higher priority when many commands with same name
+9 -1
View File
@@ -221,7 +221,8 @@ gui_bar_item_used_in_bar (struct t_gui_bar *bar, const char *item_name,
*/
int
gui_bar_item_used_in_at_least_one_bar (const char *item_name, int partial_name)
gui_bar_item_used_in_at_least_one_bar (const char *item_name, int partial_name,
int ignore_hidden_bars)
{
struct t_gui_bar *ptr_bar;
int i, j, length;
@@ -230,6 +231,13 @@ gui_bar_item_used_in_at_least_one_bar (const char *item_name, int partial_name)
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
/* if bar is hidden and that hidden bars are ignored, just skip it */
if (ignore_hidden_bars
&& CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]))
{
continue;
}
for (i = 0; i < ptr_bar->items_count; i++)
{
for (j = 0; j < ptr_bar->items_subcount[i]; j++)
+2 -1
View File
@@ -80,7 +80,8 @@ extern int gui_bar_item_used_in_bar (struct t_gui_bar *bar,
const char *item_name,
int partial_name);
extern int gui_bar_item_used_in_at_least_one_bar (const char *item_name,
int partial_name);
int partial_name,
int ignore_hidden_bars);
extern void gui_bar_item_set_prefix_name_suffix (const char *item_name,
char **prefix, char **name,
char **suffix);
+2 -1
View File
@@ -1842,7 +1842,8 @@ gui_bar_create_default_input ()
char *buf;
/* search an input_text item */
if (!gui_bar_item_used_in_at_least_one_bar (gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT], 1))
if (!gui_bar_item_used_in_at_least_one_bar (gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT],
1, 0))
{
ptr_bar = gui_bar_search (GUI_BAR_DEFAULT_NAME_INPUT);
if (ptr_bar)
+15 -9
View File
@@ -45,6 +45,7 @@
#include "../plugins/plugin.h"
#include "gui-key.h"
#include "gui-bar.h"
#include "gui-bar-item.h"
#include "gui-bar-window.h"
#include "gui-buffer.h"
#include "gui-chat.h"
@@ -1584,16 +1585,21 @@ gui_key_paste_check (int bracketed_paste)
int max_lines;
max_lines = CONFIG_INTEGER(config_look_paste_max_lines);
if (max_lines >= 0)
if ((max_lines < 0)
|| !gui_bar_item_used_in_at_least_one_bar (gui_bar_item_names[GUI_BAR_ITEM_INPUT_PASTE],
0, 1))
{
if (!bracketed_paste && (max_lines == 0))
max_lines = 1;
if (gui_key_get_paste_lines () > max_lines)
{
/* ask user what to do */
gui_key_paste_start ();
return 1;
}
return 0;
}
if (!bracketed_paste && (max_lines == 0))
max_lines = 1;
if (gui_key_get_paste_lines () > max_lines)
{
/* ask user what to do */
gui_key_paste_start ();
return 1;
}
return 0;