neo-blessed icon indicating copy to clipboard operation
neo-blessed copied to clipboard

wrong offset for scrollable grandchildren

Open mynery opened this issue 4 years ago • 0 comments

If I create a scrollable box with grandchildren, I expect them to move in sync with their respective parents, but they don't.

My example is the following:

const blessed = require('neo-blessed');                                                           

screen = blessed.screen({smartCSR: true});
screen.key(['C-c'], function(ch, key) {
  return process.exit(0);
});

var brokenbox = blessed.box({
  height: 5, width: 7,
  keys: true, scrollable: true, alwaysScroll: true
});
for (var i = 0; i < 10; i++) {
  var button = blessed.button({
    top: i, width: 5, height: 1,
    content: i.toString()
  }); 
  button.append(blessed.text({ top: 0, right: 0, content: i.toString() }));
  brokenbox.append(button);
}
screen.append(brokenbox);
brokenbox.focus();

screen.render();

Expected behavior: If I scroll down once, the last line shows "5 5". Actual behavior: If I scroll down once, the last line shows "5", the line above shows "4 5".

mynery avatar Apr 04 '20 22:04 mynery