From 0b4d70a2073104192c2fe62267a37d1d9872baa2 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Thu, 15 Jan 2015 13:22:55 -0800 Subject: [PATCH] remove attr comments. fix two scroll bugs. --- lib/widget.js | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/lib/widget.js b/lib/widget.js index 9d118a4..afd095f 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -1166,9 +1166,6 @@ Screen.prototype.attrCode = function(code, cur, def) { c = +code[i] || 0; switch (c) { case 0: // normal - //bg = 0x1ff; - //fg = 0x1ff; - //flags = 0; bg = def & 0x1ff; fg = (def >> 9) & 0x1ff; flags = (def >> 18) & 0x1ff; @@ -1177,48 +1174,39 @@ Screen.prototype.attrCode = function(code, cur, def) { flags |= 1; break; case 22: - //flags &= ~1; flags = (def >> 18) & 0x1ff; break; case 4: // underline flags |= 2; break; case 24: - //flags &= ~2; flags = (def >> 18) & 0x1ff; break; case 5: // blink flags |= 4; break; case 25: - //flags &= ~4; flags = (def >> 18) & 0x1ff; break; case 7: // inverse flags |= 8; break; case 27: - //flags &= ~8; flags = (def >> 18) & 0x1ff; break; case 8: // invisible flags |= 16; break; case 28: - //flags &= ~16; flags = (def >> 18) & 0x1ff; break; case 39: // default fg - //fg = 0x1ff; fg = (def >> 9) & 0x1ff; break; case 49: // default bg - //bg = 0x1ff; bg = def & 0x1ff; break; case 100: // default fg/bg - //fg = 0x1ff; - //bg = 0x1ff; fg = (def >> 9) & 0x1ff; bg = def & 0x1ff; break; @@ -1230,7 +1218,6 @@ Screen.prototype.attrCode = function(code, cur, def) { } else if (c === 48 && +code[i+1] === 2) { i += 2; bg = colors.match(+code[i], +code[i+1], +code[i+2]); - //if (bg === -1) bg = 0x1ff; if (bg === -1) bg = def & 0x1ff; i += 2; break; @@ -1241,7 +1228,6 @@ Screen.prototype.attrCode = function(code, cur, def) { } else if (c === 38 && +code[i+1] === 2) { i += 2; fg = colors.match(+code[i], +code[i+1], +code[i+2]); - //if (fg === -1) fg = 0x1ff; if (fg === -1) fg = (def >> 9) & 0x1ff; i += 2; break; @@ -1252,7 +1238,6 @@ Screen.prototype.attrCode = function(code, cur, def) { bg = c - 100; bg += 8; } else if (c === 49) { - //bg = 0x1ff; bg = def & 0x1ff; } else if (c >= 30 && c <= 37) { fg = c - 30; @@ -1260,11 +1245,8 @@ Screen.prototype.attrCode = function(code, cur, def) { fg = c - 90; fg += 8; } else if (c === 39) { - //fg = 0x1ff; fg = (def >> 9) & 0x1ff; } else if (c === 100) { - //fg = 0x1ff; - //bg = 0x1ff; fg = (def >> 9) & 0x1ff; bg = def & 0x1ff; } @@ -1441,7 +1423,10 @@ Screen.prototype._focus = function(self, old) { el.scrollTo(self.rtop); self.screen.render(); } else if (self.rtop + self.height - self.ibottom > el.childBase + visible) { - el.scrollTo(self.rtop - (visible - self.height)); + // el.scrollTo(self.rtop); + // el.scrollTo(self.rtop - (visible - self.height)); + el.scrollTo(self.rtop + self.height); + // el.scrollTo(self.rtop + self.height - (visible - self.height)); self.screen.render(); } } @@ -3038,10 +3023,11 @@ Element.prototype._getCoords = function(get, noscroll) { // XXX // Fixes non-`fixed` labels to work with scrolling (they're ON the border): - if (this.position.left < 0 - || this.position.right < 0 - || this.position.top < 0 - || this.position.bottom < 0) { + // if (this.position.left < 0 + // || this.position.right < 0 + // || this.position.top < 0 + // || this.position.bottom < 0) { + if (this._isLabel) { b = 0; } @@ -5542,7 +5528,6 @@ RadioSet.prototype.__proto__ = Box.prototype; RadioSet.prototype.type = 'radio-set'; - /** * RadioButton */