add invertSelected option to List. fixes #124.
This commit is contained in:
parent
489aa2dbe3
commit
46a76abbdd
|
@ -695,6 +695,8 @@ A scrollable list which can display selectable items.
|
|||
item that is found in `items`.
|
||||
- __interactive__ - whether the list is interactive and can have items selected
|
||||
(default: true).
|
||||
- __invertSelected__ - whether to automatically override tags and invert fg of
|
||||
item when selected (default: `true`).
|
||||
|
||||
##### Properties:
|
||||
|
||||
|
|
|
@ -3969,7 +3969,8 @@ Element.prototype.render = function() {
|
|||
attr = this.screen.attrCode(c[0], attr, dattr);
|
||||
// Ignore foreground changes for selected items.
|
||||
if (this.parent._isList && this.parent.interactive
|
||||
&& this.parent.items[this.parent.selected] === this) {
|
||||
&& this.parent.items[this.parent.selected] === this
|
||||
&& this.parent.options.invertSelected !== false) {
|
||||
attr = (attr & ~(0x1ff << 9)) | (dattr & (0x1ff << 9));
|
||||
}
|
||||
ch = content[ci] || bch;
|
||||
|
|
|
@ -69,9 +69,11 @@ var list = blessed.list({
|
|||
height: '50%',
|
||||
top: 'center',
|
||||
left: 'center',
|
||||
tags: true,
|
||||
invertSelected: false,
|
||||
items: [
|
||||
'one',
|
||||
'two',
|
||||
'{red-fg}two{/red-fg}',
|
||||
'three',
|
||||
'four',
|
||||
'five',
|
||||
|
|
Loading…
Reference in New Issue