mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 06:46:38 +02:00
core: add option weechat.look.paste_auto_add_newline (closes #543)
This commit is contained in:
@@ -148,6 +148,7 @@ struct t_config_option *config_look_mouse;
|
||||
struct t_config_option *config_look_mouse_timer_delay;
|
||||
struct t_config_option *config_look_nick_prefix;
|
||||
struct t_config_option *config_look_nick_suffix;
|
||||
struct t_config_option *config_look_paste_auto_add_newline;
|
||||
struct t_config_option *config_look_paste_bracketed;
|
||||
struct t_config_option *config_look_paste_bracketed_timer_delay;
|
||||
struct t_config_option *config_look_paste_max_lines;
|
||||
@@ -2653,6 +2654,12 @@ config_weechat_init_options ()
|
||||
N_("text to display after nick in prefix of message, example: \">\""),
|
||||
NULL, 0, 0, "", NULL, 0, NULL, NULL,
|
||||
&config_change_nick_prefix_suffix, NULL, NULL, NULL);
|
||||
config_look_paste_auto_add_newline = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"paste_auto_add_newline", "boolean",
|
||||
N_("automatically add a newline at the end of pasted text if there "
|
||||
"are at least two lines and if a confirmation is asked"),
|
||||
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_paste_bracketed = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"paste_bracketed", "boolean",
|
||||
|
||||
@@ -194,6 +194,7 @@ extern struct t_config_option *config_look_mouse;
|
||||
extern struct t_config_option *config_look_mouse_timer_delay;
|
||||
extern struct t_config_option *config_look_nick_prefix;
|
||||
extern struct t_config_option *config_look_nick_suffix;
|
||||
extern struct t_config_option *config_look_paste_auto_add_newline;
|
||||
extern struct t_config_option *config_look_paste_bracketed;
|
||||
extern struct t_config_option *config_look_paste_bracketed_timer_delay;
|
||||
extern struct t_config_option *config_look_paste_max_lines;
|
||||
|
||||
+2
-1
@@ -1816,7 +1816,8 @@ gui_key_paste_accept ()
|
||||
* add final newline if there is not in pasted text
|
||||
* (for at least 2 lines pasted)
|
||||
*/
|
||||
if ((gui_key_get_paste_lines () > 1)
|
||||
if (CONFIG_BOOLEAN(config_look_paste_auto_add_newline)
|
||||
&& (gui_key_get_paste_lines () > 1)
|
||||
&& (gui_key_buffer_size > 0)
|
||||
&& (gui_key_buffer[gui_key_buffer_size - 1] != '\r')
|
||||
&& (gui_key_buffer[gui_key_buffer_size - 1] != '\n'))
|
||||
|
||||
Reference in New Issue
Block a user