Skip to content
Snippets Groups Projects
Commit ec83b41c authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Merge branch 'dd_lightbar_menu_write_item_check_ANSI_before_gotoxy' into 'master'

DDLightbarMenu: When writing an item with UTF-8 text, check ANSI support before moving the cursor (and this is important if the menu is being used in non-lightbar mode)

See merge request !419
parents cc67c1b6 b9112c40
Branches
Tags
1 merge request!419DDLightbarMenu: When writing an item with UTF-8 text, check ANSI support before moving the cursor (and this is important if the menu is being used in non-lightbar mode)
...@@ -1202,6 +1202,7 @@ function DDLightbarMenu_WriteItem(pIdx, pItemLen, pHighlight, pSelected, pScreen ...@@ -1202,6 +1202,7 @@ function DDLightbarMenu_WriteItem(pIdx, pItemLen, pHighlight, pSelected, pScreen
{ {
var len = this.nextDrawOnlyItemSubstr.end - this.nextDrawOnlyItemSubstr.start; var len = this.nextDrawOnlyItemSubstr.end - this.nextDrawOnlyItemSubstr.start;
var shortenedText = substrWithAttrCodes(itemText, this.nextDrawOnlyItemSubstr.start, len); var shortenedText = substrWithAttrCodes(itemText, this.nextDrawOnlyItemSubstr.start, len);
if (this.ANSISupported())
console.gotoxy(pScreenX+this.nextDrawOnlyItemSubstr.start, pScreenY); console.gotoxy(pScreenX+this.nextDrawOnlyItemSubstr.start, pScreenY);
console.print(shortenedText + "\x01n", printModeBits); console.print(shortenedText + "\x01n", printModeBits);
} }
...@@ -1251,6 +1252,7 @@ function DDLightbarMenu_WriteItem(pIdx, pItemLen, pHighlight, pSelected, pScreen ...@@ -1251,6 +1252,7 @@ function DDLightbarMenu_WriteItem(pIdx, pItemLen, pHighlight, pSelected, pScreen
{ {
itemLen = itemColor[i].end - itemColor[i].start; itemLen = itemColor[i].end - itemColor[i].start;
var textToPrint = substrWithAttrCodes(itemText, itemStartIdx, itemLen); var textToPrint = substrWithAttrCodes(itemText, itemStartIdx, itemLen);
if (this.ANSISupported())
console.gotoxy(itemStartX + itemColor[i].start, itemY); console.gotoxy(itemStartX + itemColor[i].start, itemY);
console.print(textToPrint, P_AUTO_UTF8); // printModeBits console.print(textToPrint, P_AUTO_UTF8); // printModeBits
itemStartIdx += itemLen; itemStartIdx += itemLen;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment