mirror of
https://github.com/weechat/weechat.git
synced 2026-06-24 20:06:38 +02:00
Remove unused option look.input_format, fix refresh bug with input prompt for IRC buffers
This commit is contained in:
@@ -79,7 +79,6 @@ struct t_config_option *config_look_hotlist_names_length;
|
||||
struct t_config_option *config_look_hotlist_names_level;
|
||||
struct t_config_option *config_look_hotlist_short_names;
|
||||
struct t_config_option *config_look_hotlist_sort;
|
||||
struct t_config_option *config_look_input_format;
|
||||
struct t_config_option *config_look_item_time_format;
|
||||
struct t_config_option *config_look_nicklist;
|
||||
struct t_config_option *config_look_nicklist_max_size;
|
||||
@@ -944,12 +943,6 @@ config_weechat_init ()
|
||||
"group_time_asc|group_time_desc|group_number_asc|"
|
||||
"group_number_desc|number_asc|number_desc",
|
||||
0, 0, "group_time_asc", NULL, NULL, NULL, &config_change_hotlist, NULL, NULL, NULL);
|
||||
config_look_input_format = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"input_format", "string",
|
||||
N_("format for input prompt ('%c' is replaced by channel "
|
||||
"or server, '%n' by nick and '%m' by nick modes)"),
|
||||
NULL, 0, 0, "[%n(%m)] ", NULL, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_item_time_format = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"item_time_format", "string",
|
||||
|
||||
@@ -86,7 +86,6 @@ extern struct t_config_option *config_look_hotlist_names_length;
|
||||
extern struct t_config_option *config_look_hotlist_names_level;
|
||||
extern struct t_config_option *config_look_hotlist_short_names;
|
||||
extern struct t_config_option *config_look_hotlist_sort;
|
||||
extern struct t_config_option *config_look_input_format;
|
||||
extern struct t_config_option *config_look_item_time_format;
|
||||
extern struct t_config_option *config_look_nicklist;
|
||||
extern struct t_config_option *config_look_nicklist_max_size;
|
||||
|
||||
+2
-23
@@ -667,35 +667,14 @@ gui_bar_item_default_input_prompt (void *data, struct t_gui_bar_item *item,
|
||||
struct t_gui_window *window,
|
||||
int max_width, int max_height)
|
||||
{
|
||||
char *buf;
|
||||
int length;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) item;
|
||||
(void) window;
|
||||
(void) max_width;
|
||||
(void) max_height;
|
||||
|
||||
if (!window)
|
||||
window = gui_current_window;
|
||||
|
||||
if (!window->buffer->input_nick)
|
||||
return NULL;
|
||||
|
||||
length = strlen (window->buffer->input_nick);
|
||||
if (length == 0)
|
||||
return NULL;
|
||||
|
||||
length += 64 + 1;
|
||||
buf = malloc (length);
|
||||
if (buf)
|
||||
{
|
||||
snprintf (buf, length, "%s%s",
|
||||
gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_input_nick))),
|
||||
window->buffer->input_nick);
|
||||
}
|
||||
|
||||
return buf;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -202,7 +202,6 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
|
||||
new_buffer->input = 1;
|
||||
new_buffer->input_callback = input_callback;
|
||||
new_buffer->input_callback_data = input_callback_data;
|
||||
new_buffer->input_nick = NULL;
|
||||
new_buffer->input_buffer_alloc = GUI_BUFFER_INPUT_BLOCK_SIZE;
|
||||
new_buffer->input_buffer = malloc (GUI_BUFFER_INPUT_BLOCK_SIZE);
|
||||
new_buffer->input_buffer[0] = '\0';
|
||||
@@ -354,8 +353,6 @@ gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property)
|
||||
return buffer->name;
|
||||
else if (string_strcasecmp (property, "title") == 0)
|
||||
return buffer->title;
|
||||
else if (string_strcasecmp (property, "nick") == 0)
|
||||
return buffer->input_nick;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -481,19 +478,6 @@ gui_buffer_set_nicklist_display_groups (struct t_gui_buffer *buffer,
|
||||
gui_nicklist_compute_visible_count (buffer, buffer->nicklist_root);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_set_nick: set nick for a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_set_nick (struct t_gui_buffer *buffer, const char *new_nick)
|
||||
{
|
||||
if (buffer->input_nick)
|
||||
free (buffer->input_nick);
|
||||
buffer->input_nick = (new_nick && new_nick[0]) ? strdup (new_nick) : NULL;
|
||||
gui_buffer_ask_input_refresh (buffer, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_set_highlight_words: set highlight words for a buffer
|
||||
*/
|
||||
@@ -670,10 +654,6 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property,
|
||||
if (error && !error[0])
|
||||
gui_buffer_set_nicklist_display_groups (buffer, number);
|
||||
}
|
||||
else if (string_strcasecmp (property, "nick") == 0)
|
||||
{
|
||||
gui_buffer_set_nick (buffer, value_str);
|
||||
}
|
||||
else if (string_strcasecmp (property, "highlight_words") == 0)
|
||||
{
|
||||
gui_buffer_set_highlight_words (buffer, value_str);
|
||||
@@ -1247,8 +1227,6 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist,
|
||||
return 0;
|
||||
if (!infolist_new_var_integer (ptr_item, "input", buffer->input))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "input_nick", buffer->input_nick))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "input_string", buffer->input_buffer))
|
||||
return 0;
|
||||
if (!infolist_new_var_string (ptr_item, "highlight_words", buffer->highlight_words))
|
||||
@@ -1443,7 +1421,6 @@ gui_buffer_print_log ()
|
||||
log_printf (" input. . . . . . . . . : %d", ptr_buffer->input);
|
||||
log_printf (" input_callback . . . . : 0x%x", ptr_buffer->input_callback);
|
||||
log_printf (" input_callback_data. . : 0x%x", ptr_buffer->input_callback_data);
|
||||
log_printf (" input_nick . . . . . . : '%s'", ptr_buffer->input_nick);
|
||||
log_printf (" input_buffer . . . . . : '%s'", ptr_buffer->input_buffer);
|
||||
log_printf (" input_buffer_alloc . . : %d", ptr_buffer->input_buffer_alloc);
|
||||
log_printf (" input_buffer_size. . . : %d", ptr_buffer->input_buffer_size);
|
||||
|
||||
@@ -119,7 +119,6 @@ struct t_gui_buffer
|
||||
const char *input_data);
|
||||
void *input_callback_data; /* data for callback */
|
||||
/* to this buffer */
|
||||
char *input_nick; /* self nick */
|
||||
char *input_buffer; /* input buffer */
|
||||
int input_buffer_alloc; /* input buffer: allocated size */
|
||||
int input_buffer_size; /* buffer size in bytes */
|
||||
|
||||
@@ -526,19 +526,6 @@ gui_completion_list_add_infolist_hooks (struct t_gui_completion *completion)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_completion_list_add_self_nick: add self nick on server to completion list
|
||||
*/
|
||||
|
||||
void
|
||||
gui_completion_list_add_self_nick (struct t_gui_completion *completion)
|
||||
{
|
||||
if (completion->buffer->input_nick)
|
||||
gui_completion_list_add (completion,
|
||||
completion->buffer->input_nick,
|
||||
0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_completion_list_add_nicks: add nicks to completion list
|
||||
*/
|
||||
@@ -953,9 +940,6 @@ gui_completion_build_list_template (struct t_gui_completion *completion,
|
||||
case 'I': /* infolists hooked */
|
||||
gui_completion_list_add_infolist_hooks (completion);
|
||||
break;
|
||||
case 'm': /* self nickname */
|
||||
gui_completion_list_add_self_nick (completion);
|
||||
break;
|
||||
case 'n': /* nick */
|
||||
gui_completion_list_add_nicks (completion);
|
||||
break;
|
||||
|
||||
@@ -197,80 +197,6 @@ gui_input_insert_string (struct t_gui_buffer *buffer, const char *string,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_input_get_prompt_length: return input prompt length (displayed on screen)
|
||||
*/
|
||||
|
||||
int
|
||||
gui_input_get_prompt_length (struct t_gui_buffer *buffer)
|
||||
{
|
||||
char *pos, saved_char;
|
||||
int char_size, length;
|
||||
|
||||
if (buffer->text_search != GUI_TEXT_SEARCH_DISABLED)
|
||||
{
|
||||
if (buffer->text_search_exact)
|
||||
return utf8_strlen_screen (_("Text search (exact): "));
|
||||
else
|
||||
return utf8_strlen_screen (_("Text search: "));
|
||||
}
|
||||
|
||||
length = 0;
|
||||
pos = CONFIG_STRING(config_look_input_format);
|
||||
while (pos && pos[0])
|
||||
{
|
||||
switch (pos[0])
|
||||
{
|
||||
case '%':
|
||||
pos++;
|
||||
switch (pos[0])
|
||||
{
|
||||
case 'c': /* buffer name */
|
||||
length += utf8_strlen_screen (buffer->name);
|
||||
pos++;
|
||||
break;
|
||||
case 'm': // nick modes
|
||||
/*if (GUI_SERVER(buffer) && GUI_SERVER(buffer)->is_connected)
|
||||
{
|
||||
if (GUI_SERVER(buffer)->nick_modes
|
||||
&& GUI_SERVER(buffer)->nick_modes[0])
|
||||
length += strlen (GUI_SERVER(buffer)->nick_modes);
|
||||
}*/
|
||||
pos++;
|
||||
break;
|
||||
case 'n': /* nick */
|
||||
if (buffer->input_nick)
|
||||
length += utf8_strlen_screen (buffer->input_nick);
|
||||
pos++;
|
||||
break;
|
||||
default:
|
||||
length++;
|
||||
if (pos[0])
|
||||
{
|
||||
if (pos[0] == '%')
|
||||
pos++;
|
||||
else
|
||||
{
|
||||
length++;
|
||||
pos += utf8_char_size (pos);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
char_size = utf8_char_size (pos);
|
||||
saved_char = pos[char_size];
|
||||
pos[char_size] = '\0';
|
||||
length += utf8_strlen_screen (pos);
|
||||
pos[char_size] = saved_char;
|
||||
pos += char_size;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_input_clipboard_copy: copy string into clipboard
|
||||
*/
|
||||
|
||||
@@ -37,7 +37,6 @@ extern void gui_input_move (struct t_gui_buffer *buffer, char *target,
|
||||
const char *source, int size);
|
||||
extern int gui_input_insert_string (struct t_gui_buffer *buffer,
|
||||
const char *string, int pos);
|
||||
extern int gui_input_get_prompt_length (struct t_gui_buffer *buffer);
|
||||
extern void gui_input_return ();
|
||||
extern void gui_input_clipboard_paste ();
|
||||
extern void gui_input_complete_next ();
|
||||
|
||||
@@ -102,7 +102,6 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
|
||||
|
||||
if (channel_type == IRC_CHANNEL_TYPE_CHANNEL)
|
||||
{
|
||||
weechat_buffer_set (new_buffer, "nick", server->nick);
|
||||
if (weechat_config_integer (weechat_config_get ("weechat.look.nicklist")))
|
||||
weechat_buffer_set (new_buffer, "nicklist", "1");
|
||||
weechat_buffer_set (new_buffer, "nicklist_display_groups", "0");
|
||||
|
||||
@@ -3956,7 +3956,7 @@ irc_command_init ()
|
||||
" s: mark a user for receive server notices\n"
|
||||
" w: user receives wallops\n"
|
||||
" o: operator flag"),
|
||||
"%(irc_channel)|%m", &irc_command_mode, NULL);
|
||||
"%(irc_channel)|%(irc_server_nick)", &irc_command_mode, NULL);
|
||||
weechat_hook_command ("motd",
|
||||
N_("get the \"Message Of The Day\""),
|
||||
N_("[target]"),
|
||||
|
||||
@@ -58,6 +58,31 @@ irc_completion_server_cb (void *data, const char *completion_item,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_completion_server_nick_cb: callback for completion with self nick
|
||||
* of current IRC server
|
||||
*/
|
||||
|
||||
int
|
||||
irc_completion_server_nick_cb (void *data, const char *completion_item,
|
||||
struct t_gui_buffer *buffer,
|
||||
struct t_gui_completion *completion)
|
||||
{
|
||||
IRC_GET_SERVER(buffer);
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) completion_item;
|
||||
|
||||
if (ptr_server && ptr_server->nick)
|
||||
{
|
||||
weechat_hook_completion_list_add (completion, ptr_server->nick,
|
||||
1, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* irc_completion_server_nicks_cb: callback for completion with nicks
|
||||
* of current IRC server
|
||||
@@ -363,6 +388,8 @@ void
|
||||
irc_completion_init ()
|
||||
{
|
||||
weechat_hook_completion ("irc_server", &irc_completion_server_cb, NULL);
|
||||
weechat_hook_completion ("irc_server_nick",
|
||||
&irc_completion_server_nick_cb, NULL);
|
||||
weechat_hook_completion ("irc_server_nicks",
|
||||
&irc_completion_server_nicks_cb, NULL);
|
||||
weechat_hook_completion ("irc_servers", &irc_completion_servers_cb, NULL);
|
||||
|
||||
@@ -300,21 +300,13 @@ irc_server_set_with_option (struct t_irc_server *server,
|
||||
void
|
||||
irc_server_set_nick (struct t_irc_server *server, const char *nick)
|
||||
{
|
||||
struct t_irc_channel *ptr_channel;
|
||||
|
||||
if (server->nick)
|
||||
free (server->nick);
|
||||
server->nick = (nick) ? strdup (nick) : NULL;
|
||||
|
||||
weechat_buffer_set (server->buffer, "nick", (void *)nick);
|
||||
|
||||
weechat_buffer_set (server->buffer, "highlight_words", (void *)nick);
|
||||
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
weechat_buffer_set (ptr_channel->buffer, "nick", (void *)nick);
|
||||
}
|
||||
weechat_bar_item_update ("input_prompt");
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user