From 8e0dc505b1b4aeaa6477fb7ac120eac045cc35cf Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Wed, 1 Jul 2015 22:53:01 -0600 Subject: [PATCH] * Fix bug in MCI parsing with lower case alpha character such as 'f' for fIRST lETTER text styles * Minor fixes --- core/ansi_escape_parser.js | 2 +- core/horizontal_menu_view.js | 12 +++++++----- mods/art/demo_fse_local_user.ans | Bin 564 -> 652 bytes 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/ansi_escape_parser.js b/core/ansi_escape_parser.js index 619ded94..918c3125 100644 --- a/core/ansi_escape_parser.js +++ b/core/ansi_escape_parser.js @@ -135,7 +135,7 @@ function ANSIEscapeParser(options) { function parseMCI(buffer) { // :TODO: move this to "constants" seciton @ top - var mciRe = /\%([A-Z]{2})([0-9]{1,2})?(?:\(([0-9A-Z,]+)\))*/g; + var mciRe = /\%([A-Z]{2})([0-9]{1,2})?(?:\(([0-9A-Za-z,]+)\))*/g; var pos = 0; var match; var mciCode; diff --git a/core/horizontal_menu_view.js b/core/horizontal_menu_view.js index 9faab4d4..85aa3dc1 100644 --- a/core/horizontal_menu_view.js +++ b/core/horizontal_menu_view.js @@ -47,7 +47,7 @@ function HorizontalMenuView(options) { for(var i = 0; i < self.items.length; ++i) { self.items[i].col = col; - col += spacer.length + self.items[i].length + spacer.length; + col += spacer.length + self.items[i].text.length + spacer.length; } } @@ -62,14 +62,16 @@ function HorizontalMenuView(options) { return; } - var text = strUtil.stylizeString(item.text, item.focused ? self.focusTextStyle : self.textStyle); + var text = strUtil.stylizeString( + item.text, + this.hasFocus && item.focused ? self.focusTextStyle : self.textStyle); - var extraPad = self.getSpacer().length * 2; + var drawWidth = text.length + self.getSpacer().length * 2; // * 2 = sides self.client.term.write( - ansi.goto(self.position.row, self.items[index].col) + + ansi.goto(self.position.row, item.col) + (index === self.focusedItemIndex ? self.getFocusSGR() : self.getSGR()) + - strUtil.pad(text, text.length + extraPad, self.fillChar, 'center') + strUtil.pad(text, drawWidth, self.fillChar, 'center') ); }; } diff --git a/mods/art/demo_fse_local_user.ans b/mods/art/demo_fse_local_user.ans index 09ddde55ea3921956d378107849d1c9b580a5b6d..be3e147759ac886e20d2899a636657276582ae8f 100644 GIT binary patch literal 652 zcmb1+Hn29dHZia^HqX`8)s>DmHq8Z*=3o-Y28jV>!J>vBK?n!PK;i*8*2V@v#V~2O z08l@5U zsfoN?Qo)X)&aMUqz;LD(FfuSSH83+W?EP>I@R9L09Znln>H{q}T{qF-@JU>KkIr%S9N1oJTW5}KfffkNFlK(HIbJ~ vD%dg9+10=R7>d*aMh1qa24+U4n;97x7#RZ?BpARz*we{ZA