diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2017-06-08 06:56:42 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2017-06-08 06:56:42 +0200 |
commit | f140a9198ef677ca34ff69741225a99c312fd6a3 (patch) | |
tree | f9d4e66a83acad2e2dc6c891e0ff64dddf28916b | |
parent | e2589aaaca104d9ef66d1405401d814bb63fb4b0 (diff) | |
download | weechat-f140a9198ef677ca34ff69741225a99c312fd6a3.zip |
buflist: add option buflist.look.auto_scroll (issue #332)
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | doc/de/autogen/user/buflist_options.adoc | 6 | ||||
-rw-r--r-- | doc/en/autogen/user/buflist_options.adoc | 6 | ||||
-rw-r--r-- | doc/fr/autogen/user/buflist_options.adoc | 6 | ||||
-rw-r--r-- | doc/it/autogen/user/buflist_options.adoc | 6 | ||||
-rw-r--r-- | doc/ja/autogen/user/buflist_options.adoc | 6 | ||||
-rw-r--r-- | doc/pl/autogen/user/buflist_options.adoc | 6 | ||||
-rw-r--r-- | po/cs.po | 11 | ||||
-rw-r--r-- | po/de.po | 11 | ||||
-rw-r--r-- | po/es.po | 11 | ||||
-rw-r--r-- | po/fr.po | 20 | ||||
-rw-r--r-- | po/hu.po | 11 | ||||
-rw-r--r-- | po/it.po | 11 | ||||
-rw-r--r-- | po/ja.po | 11 | ||||
-rw-r--r-- | po/pl.po | 11 | ||||
-rw-r--r-- | po/pt.po | 11 | ||||
-rw-r--r-- | po/pt_BR.po | 11 | ||||
-rw-r--r-- | po/ru.po | 11 | ||||
-rw-r--r-- | po/tr.po | 11 | ||||
-rw-r--r-- | po/weechat.pot | 11 | ||||
-rw-r--r-- | src/plugins/buflist/buflist-bar-item.c | 170 | ||||
-rw-r--r-- | src/plugins/buflist/buflist-config.c | 15 | ||||
-rw-r--r-- | src/plugins/buflist/buflist-config.h | 1 | ||||
-rw-r--r-- | src/plugins/buflist/buflist.c | 6 | ||||
-rw-r--r-- | src/plugins/buflist/buflist.h | 3 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 1 |
26 files changed, 370 insertions, 15 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 2c940d393..b62d495ed 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -22,6 +22,7 @@ New features:: * api: allow update of variables "scroll_x" and "scroll_y" in bar_window with function hdata_update * api: add functions config_option_get_string() and hdata_compare() + * buflist: add option buflist.look.auto_scroll (issue #332) * buflist: add keys kbd:[F1]/kbd:[F2], kbd:[Alt+F1]/kbd:[Alt+F2] to scroll the buflist bar Improvements:: diff --git a/doc/de/autogen/user/buflist_options.adoc b/doc/de/autogen/user/buflist_options.adoc index 0b6512f6d..ca38a1ebd 100644 --- a/doc/de/autogen/user/buflist_options.adoc +++ b/doc/de/autogen/user/buflist_options.adoc @@ -80,6 +80,12 @@ ** Werte: beliebige Zeichenkette ** Standardwert: `+"${color:green}${number}${if:${number_displayed}?.: }"+` +* [[option_buflist.look.auto_scroll]] *buflist.look.auto_scroll* +** Beschreibung: pass:none[automatically scroll the buflist bar to always see the current buffer (this works only with a bar on the left/right position with a "vertical" filling); this value is the percent number of lines displayed before the current buffer when scrolling (-1 = disable scroll); for example 50 means that after a scroll, the current buffer is at the middle of bar, 0 means on top of bar, 100 means at bottom of bar] +** Typ: integer +** Werte: -1 .. 100 +** Standardwert: `+50+` + * [[option_buflist.look.display_conditions]] *buflist.look.display_conditions* ** Beschreibung: pass:none[Bedingungen wann ein Buffer dargestellt werden soll (Hinweis: Inhalt ist evaluiert, siehe /help buflist); Beispielsweise werden Server-Buffer versteckt, sofern sie mit dem Core-Buffer zusammengefügt worden sind: "${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!=core.weechat) || ${buffer.active}==1)"] ** Typ: Zeichenkette diff --git a/doc/en/autogen/user/buflist_options.adoc b/doc/en/autogen/user/buflist_options.adoc index d5591b479..5cc2cefc3 100644 --- a/doc/en/autogen/user/buflist_options.adoc +++ b/doc/en/autogen/user/buflist_options.adoc @@ -80,6 +80,12 @@ ** values: any string ** default value: `+"${color:green}${number}${if:${number_displayed}?.: }"+` +* [[option_buflist.look.auto_scroll]] *buflist.look.auto_scroll* +** description: pass:none[automatically scroll the buflist bar to always see the current buffer (this works only with a bar on the left/right position with a "vertical" filling); this value is the percent number of lines displayed before the current buffer when scrolling (-1 = disable scroll); for example 50 means that after a scroll, the current buffer is at the middle of bar, 0 means on top of bar, 100 means at bottom of bar] +** type: integer +** values: -1 .. 100 +** default value: `+50+` + * [[option_buflist.look.display_conditions]] *buflist.look.display_conditions* ** description: pass:none[conditions to display a buffer (note: content is evaluated, see /help buflist); for example to hide server buffers if they are merged with core buffer: "${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!=core.weechat) || ${buffer.active}==1)"] ** type: string diff --git a/doc/fr/autogen/user/buflist_options.adoc b/doc/fr/autogen/user/buflist_options.adoc index 2d2857a85..b518bcd43 100644 --- a/doc/fr/autogen/user/buflist_options.adoc +++ b/doc/fr/autogen/user/buflist_options.adoc @@ -80,6 +80,12 @@ ** valeurs: toute chaîne ** valeur par défaut: `+"${color:green}${number}${if:${number_displayed}?.: }"+` +* [[option_buflist.look.auto_scroll]] *buflist.look.auto_scroll* +** description: pass:none[faire défiler automatiquement la barre buflist pour toujours voir le tampon courant (cela fonctionne seulement avec une barre en position gauche/droite avec un remplissage "vertical") ; cette valeur est un pourcentage de lignes affichées avant le tampon courant lors du défilement (-1 = désactiver le défilement) ; par exemple 50 signifie qu'après un défilement, le tampon courant est au milieu de la barre, 0 signifie en haut de la barre et 100 signifie en bas de la barre] +** type: entier +** valeurs: -1 .. 100 +** valeur par défaut: `+50+` + * [[option_buflist.look.display_conditions]] *buflist.look.display_conditions* ** description: pass:none[conditions pour afficher un tampon (note : le contenu est évalué, voir /help buflist) ; par exemple pour cacher les tampons de serveurs s'ils sont fusionnés avec le tampon "core" : "${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!=core.weechat) || ${buffer.active}==1)"] ** type: chaîne diff --git a/doc/it/autogen/user/buflist_options.adoc b/doc/it/autogen/user/buflist_options.adoc index c6a4351d7..bedc45859 100644 --- a/doc/it/autogen/user/buflist_options.adoc +++ b/doc/it/autogen/user/buflist_options.adoc @@ -80,6 +80,12 @@ ** valori: qualsiasi stringa ** valore predefinito: `+"${color:green}${number}${if:${number_displayed}?.: }"+` +* [[option_buflist.look.auto_scroll]] *buflist.look.auto_scroll* +** descrizione: pass:none[automatically scroll the buflist bar to always see the current buffer (this works only with a bar on the left/right position with a "vertical" filling); this value is the percent number of lines displayed before the current buffer when scrolling (-1 = disable scroll); for example 50 means that after a scroll, the current buffer is at the middle of bar, 0 means on top of bar, 100 means at bottom of bar] +** tipo: intero +** valori: -1 .. 100 +** valore predefinito: `+50+` + * [[option_buflist.look.display_conditions]] *buflist.look.display_conditions* ** descrizione: pass:none[conditions to display a buffer (note: content is evaluated, see /help buflist); for example to hide server buffers if they are merged with core buffer: "${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!=core.weechat) || ${buffer.active}==1)"] ** tipo: stringa diff --git a/doc/ja/autogen/user/buflist_options.adoc b/doc/ja/autogen/user/buflist_options.adoc index a534c926d..a27a5e93e 100644 --- a/doc/ja/autogen/user/buflist_options.adoc +++ b/doc/ja/autogen/user/buflist_options.adoc @@ -80,6 +80,12 @@ ** 値: 未制約文字列 ** デフォルト値: `+"${color:green}${number}${if:${number_displayed}?.: }"+` +* [[option_buflist.look.auto_scroll]] *buflist.look.auto_scroll* +** 説明: pass:none[automatically scroll the buflist bar to always see the current buffer (this works only with a bar on the left/right position with a "vertical" filling); this value is the percent number of lines displayed before the current buffer when scrolling (-1 = disable scroll); for example 50 means that after a scroll, the current buffer is at the middle of bar, 0 means on top of bar, 100 means at bottom of bar] +** タイプ: 整数 +** 値: -1 .. 100 +** デフォルト値: `+50+` + * [[option_buflist.look.display_conditions]] *buflist.look.display_conditions* ** 説明: pass:none[バッファの表示条件 (注意: 値は評価されます、/help eval を参照してください); サーババッファがコアバッファにマージされている場合にサーババッファを隠す例: "${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!=core.weechat) || ${buffer.active}==1)"] ** タイプ: 文字列 diff --git a/doc/pl/autogen/user/buflist_options.adoc b/doc/pl/autogen/user/buflist_options.adoc index 0ff785cfd..4731437bb 100644 --- a/doc/pl/autogen/user/buflist_options.adoc +++ b/doc/pl/autogen/user/buflist_options.adoc @@ -80,6 +80,12 @@ ** wartości: dowolny ciąg ** domyślna wartość: `+"${color:green}${number}${if:${number_displayed}?.: }"+` +* [[option_buflist.look.auto_scroll]] *buflist.look.auto_scroll* +** opis: pass:none[automatically scroll the buflist bar to always see the current buffer (this works only with a bar on the left/right position with a "vertical" filling); this value is the percent number of lines displayed before the current buffer when scrolling (-1 = disable scroll); for example 50 means that after a scroll, the current buffer is at the middle of bar, 0 means on top of bar, 100 means at bottom of bar] +** typ: liczba +** wartości: -1 .. 100 +** domyślna wartość: `+50+` + * [[option_buflist.look.display_conditions]] *buflist.look.display_conditions* ** opis: pass:none[warunki do wyświetlenia buforu (uwaga: zawartość jest przetwarzana, zobacz /help buflist); na przykład w celu ukrycia buforów serwerów, kiedy są połączone z głównym buforem: "${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!=core.weechat) || ${buffer.active}==1)"] ** typ: ciąg @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2017-05-13 22:06+0200\n" "Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4978,6 +4978,15 @@ msgid "%s: %d signals hooked" msgstr " napojené signály:" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2017-06-02 20:00+0200\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <kde-i18n-de@kde.org>\n" @@ -5926,6 +5926,15 @@ msgid "%s: %d signals hooked" msgstr "%s: %d Signale hooked" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2017-01-06 22:01+0100\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5192,6 +5192,15 @@ msgid "%s: %d signals hooked" msgstr " señales enganchadas:" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" -"PO-Revision-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" +"PO-Revision-Date: 2017-06-08 06:45+0200\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -5799,6 +5799,22 @@ msgid "%s: %d signals hooked" msgstr "%s: %d signaux accrochés" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" +"faire défiler automatiquement la barre buflist pour toujours voir le tampon " +"courant (cela fonctionne seulement avec une barre en position gauche/droite " +"avec un remplissage \"vertical\") ; cette valeur est un pourcentage de " +"lignes affichées avant le tampon courant lors du défilement (-1 = désactiver " +"le défilement) ; par exemple 50 signifie qu'après un défilement, le tampon " +"courant est au milieu de la barre, 0 signifie en haut de la barre et 100 " +"signifie en bas de la barre" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2017-01-06 22:03+0100\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4516,6 +4516,15 @@ msgid "%s: %d signals hooked" msgstr " üzenetkezelők:\n" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2017-01-06 22:04+0100\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5330,6 +5330,15 @@ msgid "%s: %d signals hooked" msgstr " hook sui segnali:" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2017-06-03 09:00+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/master/" @@ -5526,6 +5526,15 @@ msgid "%s: %d signals hooked" msgstr "%s: %d 個のシグナルがフックされました" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2017-04-08 14:49+0200\n" "Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5654,6 +5654,15 @@ msgid "%s: %d signals hooked" msgstr "%s: %d powiązanych sygnałów" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2017-04-08 14:50+0200\n" "Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n" "Language-Team: Portuguese <>\n" @@ -5586,6 +5586,15 @@ msgid "%s: %d signals hooked" msgstr " sinais ligados:" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" diff --git a/po/pt_BR.po b/po/pt_BR.po index 3ac5fb772..242640278 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2016-09-03 08:24+0200\n" "Last-Translator: Eduardo Elias <camponez@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5132,6 +5132,15 @@ msgid "%s: %d signals hooked" msgstr " sinais relacionados:" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2017-01-06 22:06+0100\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4554,6 +4554,15 @@ msgid "%s: %d signals hooked" msgstr " обработчики сообщений:\n" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+0200\n" "PO-Revision-Date: 2017-01-06 22:07+0100\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4119,6 +4119,15 @@ msgid "%s: %d signals hooked" msgstr "" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" diff --git a/po/weechat.pot b/po/weechat.pot index 377ec8046..8b7e40071 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2017-06-05 14:55+0200\n" +"POT-Creation-Date: 2017-06-08 06:42+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" @@ -4104,6 +4104,15 @@ msgid "%s: %d signals hooked" msgstr "" msgid "" +"automatically scroll the buflist bar to always see the current buffer (this " +"works only with a bar on the left/right position with a \"vertical\" " +"filling); this value is the percent number of lines displayed before the " +"current buffer when scrolling (-1 = disable scroll); for example 50 means " +"that after a scroll, the current buffer is at the middle of bar, 0 means on " +"top of bar, 100 means at bottom of bar" +msgstr "" + +msgid "" "conditions to display a buffer (note: content is evaluated, see /help " "buflist); for example to hide server buffers if they are merged with core " "buffer: \"${buffer.hidden}==0 && ((${type}!=server && ${buffer.full_name}!" diff --git a/src/plugins/buflist/buflist-bar-item.c b/src/plugins/buflist/buflist-bar-item.c index 232d1fdf0..2612259be 100644 --- a/src/plugins/buflist/buflist-bar-item.c +++ b/src/plugins/buflist/buflist-bar-item.c @@ -36,6 +36,8 @@ struct t_hashtable *buflist_hashtable_options = NULL; struct t_hashtable *buflist_hashtable_options_conditions = NULL; struct t_arraylist *buflist_list_buffers = NULL; +int old_line_number_current_buffer = -1; + /* * Updates buflist bar item if buflist is enabled. @@ -49,6 +51,159 @@ buflist_bar_item_update () } /* + * Checks if the bar can be scrolled, the bar must have: + * - a position "left" or "right" + * - a filling "vertical" + * - "buflist" as first item. + * + * Returns: + * 1: bar can be scrolled + * 0: bar must not be scrolled + */ + +int +buflist_bar_item_bar_can_scroll (struct t_gui_bar *bar) +{ + const char *ptr_bar_name, *ptr_bar_position, *ptr_bar_filling; + int items_count, *items_subcount; + char ***items_name, str_option[1024]; + + ptr_bar_name = weechat_hdata_string (buflist_hdata_bar, bar, "name"); + if (!ptr_bar_name) + return 0; + + /* check that bar option "position" is "left" or "right" */ + snprintf (str_option, sizeof (str_option), + "weechat.bar.%s.position", + ptr_bar_name); + ptr_bar_position = weechat_config_string (weechat_config_get (str_option)); + if (!ptr_bar_position + || ((strcmp (ptr_bar_position, "left") != 0) + && (strcmp (ptr_bar_position, "right") != 0))) + { + return 0; + } + + /* check that bar option "filling_left_right" is "vertical" */ + snprintf (str_option, sizeof (str_option), + "weechat.bar.%s.filling_left_right", + ptr_bar_name); + ptr_bar_filling = weechat_config_string (weechat_config_get (str_option)); + if (!ptr_bar_filling || (strcmp (ptr_bar_filling, "vertical") != 0)) + { + return 0; + } + + /* check that "buflist" is the first item in bar */ + items_count = weechat_hdata_integer (buflist_hdata_bar, bar, + "items_count"); + if (items_count <= 0) + return 0; + items_subcount = weechat_hdata_pointer (buflist_hdata_bar, bar, + "items_subcount"); + if (!items_subcount || (items_subcount[0] <= 0)) + return 0; + items_name = weechat_hdata_pointer (buflist_hdata_bar, bar, "items_name"); + if (!items_name || (strcmp (items_name[0][0], BUFLIST_BAR_ITEM_NAME) != 0)) + return 0; + + /* OK, bar can be scrolled! */ + return 1; +} + +/* + * Auto-scrolls a bar window displaying buflist item. + */ + +void +buflist_bar_item_auto_scroll_bar_window (struct t_gui_bar_window *bar_window, + int line_number) +{ + int height, scroll_y, new_scroll_y, auto_scroll; + char str_scroll[64]; + struct t_hashtable *hashtable; + + if (!bar_window || (line_number < 0)) + return; + + height = weechat_hdata_integer (buflist_hdata_bar_window, bar_window, + "height"); + scroll_y = weechat_hdata_integer (buflist_hdata_bar_window, bar_window, + "scroll_y"); + + /* no scroll needed if the line_number is already displayed */ + if ((line_number >= scroll_y) && (line_number < scroll_y + height)) + return; + + hashtable = weechat_hashtable_new (8, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING, + NULL, NULL); + if (hashtable) + { + auto_scroll = weechat_config_integer (buflist_config_look_auto_scroll); + new_scroll_y = line_number - (((height - 1) * auto_scroll) / 100); + if (new_scroll_y < 0) + new_scroll_y = 0; + snprintf (str_scroll, sizeof (str_scroll), + "%d", new_scroll_y); + weechat_hashtable_set (hashtable, "scroll_y", str_scroll); + weechat_hdata_update (buflist_hdata_bar_window, bar_window, hashtable); + weechat_hashtable_free (hashtable); + } +} + +/* + * Auto-scrolls all bars with buflist item as first item. + */ + +void +buflist_bar_item_auto_scroll (int line_number) +{ + struct t_gui_bar *ptr_bar; + struct t_gui_bar_window *ptr_bar_window; + struct t_gui_window *ptr_window; + + if (line_number < 0) + return; + + /* auto-scroll in root bars */ + ptr_bar = weechat_hdata_get_list (buflist_hdata_bar, "gui_bars"); + while (ptr_bar) + { + ptr_bar_window = weechat_hdata_pointer (buflist_hdata_bar, ptr_bar, + "bar_window"); + if (ptr_bar_window && buflist_bar_item_bar_can_scroll (ptr_bar)) + { + buflist_bar_item_auto_scroll_bar_window (ptr_bar_window, + line_number); + } + ptr_bar = weechat_hdata_move (buflist_hdata_bar, ptr_bar, 1); + } + + /* auto-scroll in window bars */ + ptr_window = weechat_hdata_get_list (buflist_hdata_window, "gui_windows"); + while (ptr_window) + { + ptr_bar_window = weechat_hdata_pointer (buflist_hdata_window, + ptr_window, "bar_windows"); + while (ptr_bar_window) + { + ptr_bar = weechat_hdata_pointer (buflist_hdata_bar_window, + ptr_bar_window, "bar"); + if (buflist_bar_item_bar_can_scroll (ptr_bar)) + { + buflist_bar_item_auto_scroll_bar_window (ptr_bar_window, + line_number); + } + ptr_bar_window = weechat_hdata_move (buflist_hdata_bar_window, + ptr_bar_window, 1); + } + ptr_window = weechat_hdata_move (buflist_hdata_window, ptr_window, 1); + } +} + +/* * Returns content of bar item "buffer_plugin": bar item with buffer plugin. */ @@ -79,7 +234,7 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data, const char *ptr_lag; int num_buffers, is_channel, is_private; int i, j, length_max_number, current_buffer, number, prev_number, priority; - int rc, count; + int rc, count, line_number, line_number_current_buffer; /* make C compiler happy */ (void) pointer; @@ -93,6 +248,8 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data, return NULL; prev_number = -1; + line_number = 0; + line_number_current_buffer = 0; buflist = weechat_string_dyn_alloc (256); @@ -171,6 +328,8 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data, weechat_hashtable_set (buflist_hashtable_extra_vars, "current_buffer", (current_buffer) ? "1" : "0"); + if (current_buffer) + line_number_current_buffer = line_number; /* buffer number */ number = weechat_hdata_integer (buflist_hdata_buffer, @@ -349,6 +508,8 @@ buflist_bar_item_buflist_cb (const void *pointer, void *data, free (line); if (!rc) goto error; + + line_number++; } str_buflist = *buflist; @@ -362,6 +523,13 @@ end: weechat_string_dyn_free (buflist, 0); weechat_arraylist_free (buffers); + if ((line_number_current_buffer != old_line_number_current_buffer) + && (weechat_config_integer (buflist_config_look_auto_scroll) >= 0)) + { + buflist_bar_item_auto_scroll (line_number_current_buffer); + } + old_line_number_current_buffer = line_number_current_buffer; + return str_buflist; } diff --git a/src/plugins/buflist/buflist-config.c b/src/plugins/buflist/buflist-config.c index b24044e87..0c3df353d 100644 --- a/src/plugins/buflist/buflist-config.c +++ b/src/plugins/buflist/buflist-config.c @@ -32,6 +32,7 @@ struct t_config_file *buflist_config_file = NULL; /* buflist config, look section */ +struct t_config_option *buflist_config_look_auto_scroll; struct t_config_option *buflist_config_look_display_conditions; struct t_config_option *buflist_config_look_enabled; struct t_config_option *buflist_config_look_mouse_jump_visited_buffer; @@ -336,6 +337,20 @@ buflist_config_init () return 0; } + buflist_config_look_auto_scroll = weechat_config_new_option ( + buflist_config_file, ptr_section, + "auto_scroll", "integer", + N_("automatically scroll the buflist bar to always see the current " + "buffer (this works only with a bar on the left/right position " + "with a \"vertical\" filling); this value is the percent number " + "of lines displayed before the current buffer when scrolling " + "(-1 = disable scroll); for example 50 means that after a scroll, " + "the current buffer is at the middle of bar, 0 means on top of " + "bar, 100 means at bottom of bar"), + NULL, -1, 100, "50", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); buflist_config_look_display_conditions = weechat_config_new_option ( buflist_config_file, ptr_section, "display_conditions", "string", diff --git a/src/plugins/buflist/buflist-config.h b/src/plugins/buflist/buflist-config.h index e62cb36c9..263dff9f2 100644 --- a/src/plugins/buflist/buflist-config.h +++ b/src/plugins/buflist/buflist-config.h @@ -32,6 +32,7 @@ extern struct t_config_file *buflist_config_file; +extern struct t_config_option *buflist_config_look_auto_scroll; extern struct t_config_option *buflist_config_look_display_conditions; extern struct t_config_option *buflist_config_look_enabled; extern struct t_config_option *buflist_config_look_mouse_jump_visited_buffer; diff --git a/src/plugins/buflist/buflist.c b/src/plugins/buflist/buflist.c index 5e87e205c..97d33387c 100644 --- a/src/plugins/buflist/buflist.c +++ b/src/plugins/buflist/buflist.c @@ -40,8 +40,11 @@ WEECHAT_PLUGIN_PRIORITY(8000); struct t_weechat_plugin *weechat_buflist_plugin = NULL; +struct t_hdata *buflist_hdata_window = NULL; struct t_hdata *buflist_hdata_buffer = NULL; struct t_hdata *buflist_hdata_hotlist = NULL; +struct t_hdata *buflist_hdata_bar = NULL; +struct t_hdata *buflist_hdata_bar_window = NULL; /* @@ -403,8 +406,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[]) weechat_plugin = plugin; + buflist_hdata_window = weechat_hdata_get ("window"); buflist_hdata_buffer = weechat_hdata_get ("buffer"); buflist_hdata_hotlist = weechat_hdata_get ("hotlist"); + buflist_hdata_bar = weechat_hdata_get ("bar"); + buflist_hdata_bar_window = weechat_hdata_get ("bar_window"); if (!buflist_config_init ()) return WEECHAT_RC_ERROR; diff --git a/src/plugins/buflist/buflist.h b/src/plugins/buflist/buflist.h index 7574f678d..91e3062e3 100644 --- a/src/plugins/buflist/buflist.h +++ b/src/plugins/buflist/buflist.h @@ -27,8 +27,11 @@ extern struct t_weechat_plugin *weechat_buflist_plugin; +extern struct t_hdata *buflist_hdata_window; extern struct t_hdata *buflist_hdata_buffer; extern struct t_hdata *buflist_hdata_hotlist; +extern struct t_hdata *buflist_hdata_bar; +extern struct t_hdata *buflist_hdata_bar_window; extern void buflist_add_bar (); extern void buflist_buffer_get_irc_pointers(struct t_gui_buffer *buffer, diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index d45dd7344..a78db2cd6 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -42,6 +42,7 @@ struct t_gui_window; struct t_gui_buffer; struct t_gui_bar; struct t_gui_bar_item; +struct t_gui_bar_window; struct t_gui_completion; struct t_gui_nick; struct t_gui_nick_group; |