core: add option weechat.look.paste_auto_add_newline (closes #543)

This commit is contained in:
Sébastien Helleu 2015-10-03 12:08:30 +02:00
parent 964de12a54
commit fab0d4e740
22 changed files with 116 additions and 14 deletions

View File

@ -19,6 +19,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
=== New features
* core: add option weechat.look.paste_auto_add_newline (issue #543)
* core: display a more explicit error when a filter fails to be added
(issue #522)
* api: add function string_hex_dump()

View File

@ -742,6 +742,11 @@
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette (Standardwert: `""`)
* [[option_weechat.look.paste_auto_add_newline]] *weechat.look.paste_auto_add_newline*
** Beschreibung: `automatically add a newline at the end of pasted text if there are at least two lines and if a confirmation is asked`
** Typ: boolesch
** Werte: on, off (Standardwert: `on`)
* [[option_weechat.look.paste_bracketed]] *weechat.look.paste_bracketed*
** Beschreibung: `aktiviert den "bracketed paste mode" des Terminals (wird nicht durch alle Terminals/Multiplexer unterstützt): Dieser Modus erlaubt das Einfügen von Steuersequenzen die in Klammern gesetzt sind. WeeChat kann dadurch ermitteln ob ein Text eingefügt oder geschrieben wurde ("ESC[200~", gefolgt von dem einzufügenden Text und einem abschließenden "ESC[201~")`
** Typ: boolesch

View File

@ -742,6 +742,11 @@
** type: string
** values: any string (default value: `""`)
* [[option_weechat.look.paste_auto_add_newline]] *weechat.look.paste_auto_add_newline*
** description: `automatically add a newline at the end of pasted text if there are at least two lines and if a confirmation is asked`
** type: boolean
** values: on, off (default value: `on`)
* [[option_weechat.look.paste_bracketed]] *weechat.look.paste_bracketed*
** description: `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~")`
** type: boolean

View File

@ -742,6 +742,11 @@
** type: chaîne
** valeurs: toute chaîne (valeur par défaut: `""`)
* [[option_weechat.look.paste_auto_add_newline]] *weechat.look.paste_auto_add_newline*
** description: `ajouter automatiquement une nouvelle ligne à la fin du texte collé s'il y a au moins deux lignes et si une confirmation est demandée`
** type: booléen
** valeurs: on, off (valeur par défaut: `on`)
* [[option_weechat.look.paste_bracketed]] *weechat.look.paste_bracketed*
** description: `activer le mode du terminal "bracketed paste" (pas supporté par tous les terminaux/multiplexeurs) : dans ce mode, le texte collé est entouré avec des séquences de contrôle de sorte que WeeChat puisse différencier le texte collé du texte tapé ("ESC[200~", suivi par le texte collé, suivi par "ESC[201~")`
** type: booléen

View File

@ -742,6 +742,11 @@
** tipo: stringa
** valori: qualsiasi stringa (valore predefinito: `""`)
* [[option_weechat.look.paste_auto_add_newline]] *weechat.look.paste_auto_add_newline*
** descrizione: `automatically add a newline at the end of pasted text if there are at least two lines and if a confirmation is asked`
** tipo: bool
** valori: on, off (valore predefinito: `on`)
* [[option_weechat.look.paste_bracketed]] *weechat.look.paste_bracketed*
** descrizione: `abilita la modalità "bracketed paste" per il terminale (non supportata da tutti i terminali/multiplexer): in questa modalità, il testo incollato viene racchiuso da sequenze di controllo in modo che WeeChat possa differenziare il testo incollato dal testo digitato ("ESC[200~", seguito dal testo incollato, seguito da "ESC[201~")`
** tipo: bool

View File

@ -742,6 +742,11 @@
** タイプ: 文字列
** 値: 未制約文字列 (デフォルト値: `""`)
* [[option_weechat.look.paste_auto_add_newline]] *weechat.look.paste_auto_add_newline*
** 説明: `automatically add a newline at the end of pasted text if there are at least two lines and if a confirmation is asked`
** タイプ: ブール
** 値: on, off (デフォルト値: `on`)
* [[option_weechat.look.paste_bracketed]] *weechat.look.paste_bracketed*
** 説明: `端末の「括弧付きペーストモード」を有効化 (一部の端末/マルチプレクサで利用可能): このモードでは、ペーストされたテキストはコントロールシーケンスで括られます。これにより WeeChat はペーストされたテキストとタイプされたテキストを区別する ("ESC[200~" 、ペーストされたテキスト、"ESC[201~")`
** タイプ: ブール

View File

@ -742,6 +742,11 @@
** typ: ciąg
** wartości: dowolny ciąg (domyślna wartość: `""`)
* [[option_weechat.look.paste_auto_add_newline]] *weechat.look.paste_auto_add_newline*
** opis: `automatically add a newline at the end of pasted text if there are at least two lines and if a confirmation is asked`
** typ: bool
** wartości: on, off (domyślna wartość: `on`)
* [[option_weechat.look.paste_bracketed]] *weechat.look.paste_bracketed*
** opis: `włącza tryb terminala "bracketed paste mode" (nie wszystkie terminale/multiplexery ją wspierają): w tym trybie, wklejany tekst jest otoczony sekwencją kontrolna, dzięki czemu WeeChat może odróżnić tekst wklejony od wpisanego ("ESC[200~", wklejony tekst, "ESC[201~")`
** typ: bool

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-09-30 20:54+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3218,6 +3218,11 @@ msgstr "text pro zobrazení před přezdívkou v okně rozhovoru"
msgid "text to display after nick in prefix of message, example: \">\""
msgstr "text pro zobrazení za přezdívkou v okně rozhovoru"
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-09-30 20:54+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <>\n"
@ -3811,6 +3811,11 @@ msgstr "Text, der vor dem Nick dargestellt werden soll, Beispiel: \"<\""
msgid "text to display after nick in prefix of message, example: \">\""
msgstr "Text, der nach dem Nick dargestellt werden soll, Beispiel: \">\""
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-09-30 20:55+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3382,6 +3382,11 @@ msgstr "texto a mostrar antes del apodo en la ventana de charla"
msgid "text to display after nick in prefix of message, example: \">\""
msgstr "texto a mostrar tras el apodo en la ventana de charla"
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"PO-Revision-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-10-03 12:05+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -3708,6 +3708,13 @@ msgstr "texte à afficher avant le pseudo dans le préfixe, exemple : \"<\""
msgid "text to display after nick in prefix of message, example: \">\""
msgstr "texte à afficher après le pseudo dans le préfixe, exemple : \">\""
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
"ajouter automatiquement une nouvelle ligne à la fin du texte collé s'il y a "
"au moins deux lignes et si une confirmation est demandée"
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-09-09 09:13+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2811,6 +2811,11 @@ msgstr "a név előtt megjelenítendő szöveg a beszédablakban"
msgid "text to display after nick in prefix of message, example: \">\""
msgstr "a név után megjelenítendő szöveg a beszédablakban"
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-09-30 20:55+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3479,6 +3479,11 @@ msgid "text to display after nick in prefix of message, example: \">\""
msgstr ""
"testo da visualizzare dopo il nick nel prefisso del messaggio, esempio: \">\""
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-09-30 20:55+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n"
@ -3587,6 +3587,11 @@ msgid "text to display after nick in prefix of message, example: \">\""
msgstr ""
"メッセージプレフィックス中のニックネームの後に表示するテキスト、例: \">\""
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-09-30 20:56+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3666,6 +3666,11 @@ msgid "text to display after nick in prefix of message, example: \">\""
msgstr ""
"teks wyświetlany za nickiem w prefiksie wiadomości, przykład: przykład: \">\""
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-09-30 20:56+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3400,6 +3400,11 @@ msgid "text to display after nick in prefix of message, example: \">\""
msgstr ""
"texto a ser exibido depois do apelido no prefixo da mensage, examplo: \">\""
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-09-09 09:13+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2843,6 +2843,11 @@ msgstr "текст, который отображать до ника в окн
msgid "text to display after nick in prefix of message, example: \">\""
msgstr "текст, который отображать после ника в окне чата"
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2015-03-10 21:33+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2552,6 +2552,11 @@ msgstr ""
msgid "text to display after nick in prefix of message, example: \">\""
msgstr ""
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2015-09-30 20:53+0200\n"
"POT-Creation-Date: 2015-10-03 12:04+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -2548,6 +2548,11 @@ msgstr ""
msgid "text to display after nick in prefix of message, example: \">\""
msgstr ""
msgid ""
"automatically add a newline at the end of pasted text if there are at least "
"two lines and if a confirmation is asked"
msgstr ""
msgid ""
"enable terminal \"bracketed paste mode\" (not supported in all terminals/"
"multiplexers): in this mode, pasted text is bracketed with control sequences "

View File

@ -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",

View File

@ -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;

View File

@ -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'))