Merge remote-tracking branch 'origin/pr/3407'

This commit is contained in:
Florian Bruhin 2017-12-18 16:11:16 +01:00
commit f203535e00
3 changed files with 16 additions and 8 deletions

View File

@ -138,10 +138,10 @@ class CompletionItemDelegate(QStyledItemDelegate):
self._painter.translate(text_rect.left(), text_rect.top())
self._get_textdoc(index)
self._draw_textdoc(text_rect)
self._draw_textdoc(text_rect, index.column())
self._painter.restore()
def _draw_textdoc(self, rect):
def _draw_textdoc(self, rect, col):
"""Draw the QTextDocument of an item.
Args:
@ -156,7 +156,9 @@ class CompletionItemDelegate(QStyledItemDelegate):
elif not self._opt.state & QStyle.State_Enabled:
color = config.val.colors.completion.category.fg
else:
color = config.val.colors.completion.fg
colors = config.val.colors.completion.fg
# if multiple colors are set, use different colors per column
color = colors[col % len(colors)]
self._painter.setPen(color)
ctx = QAbstractTextDocumentLayout.PaintContext()

View File

@ -1540,9 +1540,15 @@ zoom.text_only:
## colors
colors.completion.fg:
default: white
type: QtColor
desc: Text color of the completion widget.
default: ["white", "white", "white"]
type:
name: ListOrValue
valtype: QtColor
desc: >-
Text color of the completion widget.
May be a single color to use for all columns or a list of three colors,
one for each column.
colors.completion.odd.bg:
default: '#444444'

View File

@ -385,7 +385,7 @@ class TestConfig:
def test_get(self, conf):
"""Test conf.get() with a QColor (where get/get_obj is different)."""
assert conf.get('colors.completion.fg') == QColor('white')
assert conf.get('colors.completion.category.fg') == QColor('white')
@pytest.mark.parametrize('value', [{}, {'normal': {'a': 'nop'}}])
def test_get_bindings(self, config_stub, conf, value):
@ -400,7 +400,7 @@ class TestConfig:
assert not conf._mutables
def test_get_obj_simple(self, conf):
assert conf.get_obj('colors.completion.fg') == 'white'
assert conf.get_obj('colors.completion.category.fg') == 'white'
@pytest.mark.parametrize('option', ['content.headers.custom',
'keyhint.blacklist',