From 212d5fe932137da5e2961421e506f1206867f665 Mon Sep 17 00:00:00 2001 From: nanjekyejoannah Date: Mon, 1 Aug 2016 11:28:27 +0300 Subject: [PATCH 1/7] commit resolving issue #1395 --- qutebrowser/completion/completiondelegate.py | 2 +- qutebrowser/completion/completionwidget.py | 2 ++ qutebrowser/config/configdata.py | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/qutebrowser/completion/completiondelegate.py b/qutebrowser/completion/completiondelegate.py index ab7b3ad88..cc5794a6c 100644 --- a/qutebrowser/completion/completiondelegate.py +++ b/qutebrowser/completion/completiondelegate.py @@ -206,7 +206,7 @@ class CompletionItemDelegate(QStyledItemDelegate): else: self._doc.setPlainText(self._opt.text) else: - self._doc.setHtml('{}'.format(html.escape(self._opt.text))) + self._doc.setHtml('{}'.format(html.escape(self._opt.text))) def _draw_focus_rect(self): """Draw the focus rectangle of an ItemViewItem.""" diff --git a/qutebrowser/completion/completionwidget.py b/qutebrowser/completion/completionwidget.py index 80e87dbe4..da0a77157 100644 --- a/qutebrowser/completion/completionwidget.py +++ b/qutebrowser/completion/completionwidget.py @@ -69,6 +69,8 @@ class CompletionView(QTreeView): {{ color['completion.category.border.top'] }}; border-bottom: 1px solid {{ color['completion.category.border.bottom'] }}; + font: {{ config.get('completion', 'bold') }}; + } QTreeView::item:selected, QTreeView::item:selected:hover { diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 5110a6090..d8f81bcd6 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -466,6 +466,18 @@ def data(readonly=False): SettingValue(typ.Int(minval=0), '2'), "Padding of scrollbar handle in completion window (in px)."), + ('_monospace', + SettingValue(typ.Font(), 'Terminus, Monospace, ' + '"DejaVu Sans Mono", Monaco, ' + '"Bitstream Vera Sans Mono", "Andale Mono", ' + '"Courier New", Courier, "Liberation Mono", ' + 'monospace, Fixed, Consolas, Terminal'), + "Default monospace fonts."), + + ('bold', + SettingValue(typ.Font(), 'bold' + DEFAULT_FONT_SIZE + ' ${_monospace}' ), + "Font used in the completion fonts."), + readonly=readonly )), @@ -1244,6 +1256,7 @@ def data(readonly=False): SettingValue(typ.Font(), DEFAULT_FONT_SIZE + ' ${_monospace}'), "Font used in the completion widget."), + ('tabbar', SettingValue(typ.QtFont(), DEFAULT_FONT_SIZE + ' ${_monospace}'), "Font used in the tab bar."), From 1e946856537e8b5a9cc6a00504aebeeb710f6017 Mon Sep 17 00:00:00 2001 From: nanjekyejoannah Date: Mon, 1 Aug 2016 14:00:30 +0300 Subject: [PATCH 2/7] Refactoring to resolve issue #1395 --- qutebrowser/completion/completiondelegate.py | 2 +- qutebrowser/completion/completionwidget.py | 2 +- qutebrowser/config/configdata.py | 20 ++++++-------------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/qutebrowser/completion/completiondelegate.py b/qutebrowser/completion/completiondelegate.py index cc5794a6c..d63658cc3 100644 --- a/qutebrowser/completion/completiondelegate.py +++ b/qutebrowser/completion/completiondelegate.py @@ -206,7 +206,7 @@ class CompletionItemDelegate(QStyledItemDelegate): else: self._doc.setPlainText(self._opt.text) else: - self._doc.setHtml('{}'.format(html.escape(self._opt.text))) + self._doc.setHtml(html.escape(self._opt.text)) def _draw_focus_rect(self): """Draw the focus rectangle of an ItemViewItem.""" diff --git a/qutebrowser/completion/completionwidget.py b/qutebrowser/completion/completionwidget.py index da0a77157..24b59f622 100644 --- a/qutebrowser/completion/completionwidget.py +++ b/qutebrowser/completion/completionwidget.py @@ -69,7 +69,7 @@ class CompletionView(QTreeView): {{ color['completion.category.border.top'] }}; border-bottom: 1px solid {{ color['completion.category.border.bottom'] }}; - font: {{ config.get('completion', 'bold') }}; + font: {{ font['completion.category'] }}; } diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index d8f81bcd6..f8c7fb054 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -120,6 +120,7 @@ SECTION_DESC = { DEFAULT_FONT_SIZE = '10pt' if sys.platform == 'darwin' else '8pt' +orientation = 'bold' def data(readonly=False): @@ -414,7 +415,7 @@ def data(readonly=False): ('auto-open', SettingValue(typ.Bool(), 'true'), "Automatically open completion when typing."), - + ('download-path-suggestion', SettingValue( typ.String(valid_values=typ.ValidValues( @@ -466,18 +467,6 @@ def data(readonly=False): SettingValue(typ.Int(minval=0), '2'), "Padding of scrollbar handle in completion window (in px)."), - ('_monospace', - SettingValue(typ.Font(), 'Terminus, Monospace, ' - '"DejaVu Sans Mono", Monaco, ' - '"Bitstream Vera Sans Mono", "Andale Mono", ' - '"Courier New", Courier, "Liberation Mono", ' - 'monospace, Fixed, Consolas, Terminal'), - "Default monospace fonts."), - - ('bold', - SettingValue(typ.Font(), 'bold' + DEFAULT_FONT_SIZE + ' ${_monospace}' ), - "Font used in the completion fonts."), - readonly=readonly )), @@ -1253,9 +1242,12 @@ def data(readonly=False): "Default monospace fonts."), ('completion', - SettingValue(typ.Font(), DEFAULT_FONT_SIZE + ' ${_monospace}'), + SettingValue(typ.Font(), DEFAULT_FONT_SIZE + ' ${_monospace}'), "Font used in the completion widget."), + ('completion.category', + SettingValue(typ.Font(), 'bold' + '${completion}'), + "Font used in the completion fonts."), ('tabbar', SettingValue(typ.QtFont(), DEFAULT_FONT_SIZE + ' ${_monospace}'), From 633c95bca67a3aed029874c40fca77e9c302e963 Mon Sep 17 00:00:00 2001 From: nanjekyejoannah Date: Mon, 1 Aug 2016 14:14:15 +0300 Subject: [PATCH 3/7] resolving style things in commit resolving issue #1395 --- qutebrowser/config/configdata.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index f8c7fb054..5855a273f 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -120,7 +120,7 @@ SECTION_DESC = { DEFAULT_FONT_SIZE = '10pt' if sys.platform == 'darwin' else '8pt' -orientation = 'bold' + def data(readonly=False): @@ -415,7 +415,6 @@ def data(readonly=False): ('auto-open', SettingValue(typ.Bool(), 'true'), "Automatically open completion when typing."), - ('download-path-suggestion', SettingValue( typ.String(valid_values=typ.ValidValues( From 4d3cbe659d7df4edf5382150f3a31c8a18991384 Mon Sep 17 00:00:00 2001 From: nanjekyejoannah Date: Mon, 1 Aug 2016 14:30:20 +0300 Subject: [PATCH 4/7] refactor for configdatap.py resolving #1395 --- qutebrowser/config/configdata.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 5855a273f..744398dce 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -415,6 +415,7 @@ def data(readonly=False): ('auto-open', SettingValue(typ.Bool(), 'true'), "Automatically open completion when typing."), + ('download-path-suggestion', SettingValue( typ.String(valid_values=typ.ValidValues( @@ -1245,8 +1246,8 @@ def data(readonly=False): "Font used in the completion widget."), ('completion.category', - SettingValue(typ.Font(), 'bold' + '${completion}'), - "Font used in the completion fonts."), + SettingValue(typ.Font(), 'bold ${completion}'), + "Font used in the completion categories."), ('tabbar', SettingValue(typ.QtFont(), DEFAULT_FONT_SIZE + ' ${_monospace}'), From 3d4e76b1a4febd8865fe50008b3996f75d4d121a Mon Sep 17 00:00:00 2001 From: nanjekyejoannah Date: Mon, 1 Aug 2016 15:20:44 +0300 Subject: [PATCH 5/7] commit resolving issue#1395 --- qutebrowser/completion/completionwidget.py | 1 - qutebrowser/config/configdata.py | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/qutebrowser/completion/completionwidget.py b/qutebrowser/completion/completionwidget.py index 24b59f622..1ac49f28a 100644 --- a/qutebrowser/completion/completionwidget.py +++ b/qutebrowser/completion/completionwidget.py @@ -70,7 +70,6 @@ class CompletionView(QTreeView): border-bottom: 1px solid {{ color['completion.category.border.bottom'] }}; font: {{ font['completion.category'] }}; - } QTreeView::item:selected, QTreeView::item:selected:hover { diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 744398dce..caf1978a5 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -122,7 +122,6 @@ SECTION_DESC = { DEFAULT_FONT_SIZE = '10pt' if sys.platform == 'darwin' else '8pt' - def data(readonly=False): """Get the default config data. @@ -1242,10 +1241,10 @@ def data(readonly=False): "Default monospace fonts."), ('completion', - SettingValue(typ.Font(), DEFAULT_FONT_SIZE + ' ${_monospace}'), + SettingValue(typ.Font(), DEFAULT_FONT_SIZE + ' ${_monospace}'), "Font used in the completion widget."), - - ('completion.category', + + ('completion.category', SettingValue(typ.Font(), 'bold ${completion}'), "Font used in the completion categories."), @@ -1592,7 +1591,8 @@ KEY_DATA = collections.OrderedDict([ ('rl-unix-line-discard', ['']), ('rl-kill-line', ['']), ('rl-kill-word', ['']), - ('rl-unix-word-rubout', ['', '']), + ('rl-unix-word-rubout', ['']), + ('rl-backward-kill-word', ['']), ('rl-yank', ['']), ('rl-delete-char', ['']), ('rl-backward-delete-char', ['']), From 1bba1e3ea940ab62cd61dcb3370e06fd4e4ad7a1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 1 Aug 2016 14:35:57 +0200 Subject: [PATCH 6/7] Remove whitespace --- qutebrowser/config/configdata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index caf1978a5..4898c7ab1 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -1243,7 +1243,7 @@ def data(readonly=False): ('completion', SettingValue(typ.Font(), DEFAULT_FONT_SIZE + ' ${_monospace}'), "Font used in the completion widget."), - + ('completion.category', SettingValue(typ.Font(), 'bold ${completion}'), "Font used in the completion categories."), From cc94383785bf5f6fd73188632ad8afd7f831c4b3 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 1 Aug 2016 14:37:58 +0200 Subject: [PATCH 7/7] Update docs --- CHANGELOG.asciidoc | 2 ++ README.asciidoc | 1 + doc/help/settings.asciidoc | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index d5cefaa76..266562bc3 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -24,6 +24,8 @@ Added did before v0.8.0. - New `:rl-unix-filename-rubout` command which is similar to readline's `unix-filename-rubout`. +- New `fonts -> completion.category` setting to customize the font used for + completion category headers. Changed ~~~~~~~ diff --git a/README.asciidoc b/README.asciidoc index 3a8000c7c..96d246334 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -178,6 +178,7 @@ Contributors, sorted by the number of commits in descending order: * error800 * Liam BEGUIN * skinnay +* nanjekyejoannah * Zach-Button * Tomasz Kramkowski * Ismail S diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index d12fa472f..0b75d1fc0 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -266,6 +266,7 @@ |Setting|Description |<>|Default monospace fonts. |<>|Font used in the completion widget. +|<>|Font used in the completion categories. |<>|Font used in the tab bar. |<>|Font used in the statusbar. |<>|Font used for the downloadbar. @@ -2100,6 +2101,12 @@ Font used in the completion widget. Default: +pass:[8pt ${_monospace}]+ +[[fonts-completion.category]] +=== completion.category +Font used in the completion categories. + +Default: +pass:[bold ${completion}]+ + [[fonts-tabbar]] === tabbar Font used in the tab bar.