mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 09:43:13 +02:00
core: add support of terminal "bracketed paste mode" (task #11316)
This commit is contained in:
+10
-2
@@ -2393,6 +2393,12 @@ COMMAND_CALLBACK(input)
|
||||
gui_input_undo (buffer);
|
||||
else if (string_strcasecmp (argv[1], "redo") == 0)
|
||||
gui_input_redo (buffer);
|
||||
else if (string_strcasecmp (argv[1], "paste_start") == 0)
|
||||
gui_key_paste_bracketed_start ();
|
||||
else if (string_strcasecmp (argv[1], "paste_stop") == 0)
|
||||
{
|
||||
/* do nothing here */
|
||||
}
|
||||
}
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
@@ -5762,7 +5768,9 @@ command_init ()
|
||||
" switch_active_buffer: switch to next merged buffer\n"
|
||||
" switch_active_buffer_previous: switch to previous "
|
||||
"merged buffer\n"
|
||||
" insert: insert text in command line\n\n"
|
||||
" insert: insert text in command line\n"
|
||||
" paste_start: start paste (bracketed paste mode)\n"
|
||||
" paste_stop: stop paste (bracketed paste mode)\n\n"
|
||||
"This command is used by key bindings or plugins."),
|
||||
"return|complete_next|complete_previous|search_text|"
|
||||
"search_switch_case|search_previous|search_next|search_stop|"
|
||||
@@ -5778,7 +5786,7 @@ command_init ()
|
||||
"jump_next_visited_buffer|hotlist_clear|grab_key|"
|
||||
"grab_key_command|grab_mouse|grab_mouse_area|set_unread|"
|
||||
"set_unread_current_buffer|switch_active_buffer|"
|
||||
"switch_active_buffer_previous|insert",
|
||||
"switch_active_buffer_previous|insert|paste_start|paste_stop",
|
||||
&command_input, NULL);
|
||||
hook_command (NULL, "key",
|
||||
N_("bind/unbind keys"),
|
||||
|
||||
+28
-2
@@ -83,6 +83,7 @@ struct t_config_option *config_look_bar_more_left;
|
||||
struct t_config_option *config_look_bar_more_right;
|
||||
struct t_config_option *config_look_bar_more_up;
|
||||
struct t_config_option *config_look_bar_more_down;
|
||||
struct t_config_option *config_look_bracketed_paste_mode;
|
||||
struct t_config_option *config_look_buffer_notify_default;
|
||||
struct t_config_option *config_look_buffer_time_format;
|
||||
struct t_config_option *config_look_color_basic_force_bold;
|
||||
@@ -311,6 +312,22 @@ config_change_buffer_content (void *data, struct t_config_option *option)
|
||||
gui_current_window->refresh_needed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_bracketed_paste_mode: called when bracketed paste mode is
|
||||
* changed
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_bracketed_paste_mode (void *data, struct t_config_option *option)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) option;
|
||||
|
||||
if (gui_ok)
|
||||
gui_window_set_bracketed_paste_mode (CONFIG_BOOLEAN(config_look_bracketed_paste_mode));
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_mouse: called when mouse state is changed
|
||||
*/
|
||||
@@ -1682,6 +1699,15 @@ config_weechat_init_options ()
|
||||
N_("string displayed when bar can be scrolled down "
|
||||
"(for bars with filling different from \"horizontal\")"),
|
||||
NULL, 0, 0, "++", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_bracketed_paste_mode = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"bracketed_paste_mode", "boolean",
|
||||
N_("enable terminal \"bracketed paste mode\" (not supported in all "
|
||||
"terminals/multiplexers): in this mode, pasted text is bracketed "
|
||||
"with control sequences so that WeeChat can differentiate pasted "
|
||||
"text from typed-in text \"(ESC[200~\", followed by the pasted text, "
|
||||
"followed by \"ESC[201~\")"),
|
||||
NULL, 0, 0, "off", NULL, 0, NULL, NULL, &config_change_bracketed_paste_mode, NULL, NULL, NULL);
|
||||
config_look_buffer_notify_default = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"buffer_notify_default", "integer",
|
||||
@@ -1960,8 +1986,8 @@ config_weechat_init_options ()
|
||||
weechat_config_file, ptr_section,
|
||||
"paste_max_lines", "integer",
|
||||
N_("max number of lines for paste without asking user "
|
||||
"(0 = disable this feature)"),
|
||||
NULL, 0, INT_MAX, "3", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
"(-1 = disable this feature)"),
|
||||
NULL, -1, INT_MAX, "3", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_prefix[GUI_CHAT_PREFIX_ERROR] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"prefix_error", "string",
|
||||
|
||||
@@ -108,6 +108,7 @@ extern struct t_config_option *config_look_bar_more_left;
|
||||
extern struct t_config_option *config_look_bar_more_right;
|
||||
extern struct t_config_option *config_look_bar_more_up;
|
||||
extern struct t_config_option *config_look_bar_more_down;
|
||||
extern struct t_config_option *config_look_bracketed_paste_mode;
|
||||
extern struct t_config_option *config_look_buffer_notify_default;
|
||||
extern struct t_config_option *config_look_buffer_time_format;
|
||||
extern struct t_config_option *config_look_command_chars;
|
||||
|
||||
Reference in New Issue
Block a user