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`.
|
item that is found in `items`.
|
||||||
- __interactive__ - whether the list is interactive and can have items selected
|
- __interactive__ - whether the list is interactive and can have items selected
|
||||||
(default: true).
|
(default: true).
|
||||||
|
- __invertSelected__ - whether to automatically override tags and invert fg of
|
||||||
|
item when selected (default: `true`).
|
||||||
|
|
||||||
##### Properties:
|
##### Properties:
|
||||||
|
|
||||||
|
|
|
@ -3969,7 +3969,8 @@ Element.prototype.render = function() {
|
||||||
attr = this.screen.attrCode(c[0], attr, dattr);
|
attr = this.screen.attrCode(c[0], attr, dattr);
|
||||||
// Ignore foreground changes for selected items.
|
// Ignore foreground changes for selected items.
|
||||||
if (this.parent._isList && this.parent.interactive
|
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));
|
attr = (attr & ~(0x1ff << 9)) | (dattr & (0x1ff << 9));
|
||||||
}
|
}
|
||||||
ch = content[ci] || bch;
|
ch = content[ci] || bch;
|
||||||
|
|
|
@ -69,9 +69,11 @@ var list = blessed.list({
|
||||||
height: '50%',
|
height: '50%',
|
||||||
top: 'center',
|
top: 'center',
|
||||||
left: 'center',
|
left: 'center',
|
||||||
|
tags: true,
|
||||||
|
invertSelected: false,
|
||||||
items: [
|
items: [
|
||||||
'one',
|
'one',
|
||||||
'two',
|
'{red-fg}two{/red-fg}',
|
||||||
'three',
|
'three',
|
||||||
'four',
|
'four',
|
||||||
'five',
|
'five',
|
||||||
|
|
Loading…
Reference in New Issue