Skip to content

Commit

Permalink
Fix tree widget mouse handling
Browse files Browse the repository at this point in the history
Instead of only listening to `list.key()`, which ignores mouse-clicks,
we use the `list`s own select event to re-propagate the `tree`s select
event.
This way the mouse-clicks also trigger the `select`.
Since the existing `options.keys` are also passed to the `blessed.list()`
and thus influence its `select` event, they should behave exactly the
way they did til now.
  • Loading branch information
LinuCC committed May 3, 2018
1 parent e6c5870 commit 9dfc2ce
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/widget/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function Tree(options) {
left: 1,
style: options.style,
padding: options.padding,
keys: true,
keys: options.keys,
tags: options.tags,
input: options.input,
vi: options.vi,
Expand All @@ -41,7 +41,7 @@ function Tree(options) {

this.append(this.rows);

this.rows.key(options.keys, function() {
this.rows.on('select', function() {
var selectedNode = self.nodeLines[this.getItemIndex(this.selected)];
if (selectedNode.children) {
selectedNode.extended = !selectedNode.extended;
Expand Down

0 comments on commit 9dfc2ce

Please sign in to comment.