diff --git a/exec/SlyEdit.js b/exec/SlyEdit.js index a04d3d7d078413948b040240749821f071d03b28..faf9c6d2e69f36a470921e29c61a41ca98b9dc19 100644 --- a/exec/SlyEdit.js +++ b/exec/SlyEdit.js @@ -42,6 +42,12 @@ * Updated to save the message if the user disconnects, * to support Synchronet's message draft feature * that was added recently. + * 2019-04-11 Eric Oulashin Version 1.63 Beta + * Started working on supporting word-wrapping for + * the entire width of any terminal size, beyond + * 79. + * 2019-04-18 Eric Oulashin Version 1.63 + * Releasing this version. */ /* Command-line arguments: @@ -119,26 +125,32 @@ if (!console.term_supports(USER_ANSI)) } // Constants -const EDITOR_VERSION = "1.62"; -const EDITOR_VER_DATE = "2018-11-11"; +const EDITOR_VERSION = "1.63"; +const EDITOR_VER_DATE = "2019-04-18"; // Program variables var gEditTop = 6; // The top line of the edit area var gEditBottom = console.screen_rows-2; // The last line of the edit area +/* // gEditLeft and gEditRight are the rightmost and leftmost columns of the edit // area, respectively. They default to an edit area 80 characters wide // in the center of the screen, but for IceEdit mode, the edit area will // be on the left side of the screen to match up with the screen header. // gEditLeft and gEditRight are 1-based. -var gEditLeft = (console.screen_columns/2).toFixed(0) - 40 + 1; -var gEditRight = gEditLeft + 79; // Based on gEditLeft being 1-based +*/ +//var gEditLeft = (console.screen_columns/2).toFixed(0) - 40 + 1; +//var gEditRight = gEditLeft + 79; // Based on gEditLeft being 1-based +var gEditLeft = 1; +var gEditRight = gEditLeft + console.screen_columns - 1; // Based on gEditLeft being 1-based +/* // If the screen has less than 80 columns, then use the whole screen. if (console.screen_columns < 80) { gEditLeft = 1; gEditRight = console.screen_columns; } +*/ // Colors var gQuoteWinTextColor = "\1n\1" + "7\1k"; // Normal text color for the quote window (DCT default) @@ -454,19 +466,6 @@ var gOldSubj = gMsgSubj; // Now it's edit time. var exitCode = doEditLoop(); -// Remove any extra blank lines that may be at the end of -// the message (in gEditLines). -if ((exitCode == 0) && (gEditLines.length > 0)) -{ - var lineIndex = gEditLines.length - 1; - while ((lineIndex > 0) && (lineIndex < gEditLines.length) && - (gEditLines[lineIndex].length() == 0)) - { - gEditLines.splice(lineIndex, 1); - --lineIndex; - } -} - // Clear the screen and display the end-of-program information (if the setting // is enabled). console.clear("\1n"); @@ -476,11 +475,40 @@ if (gConfigSettings.displayEndInfoScreen) console.crlf(); } -// If the user wrote & saved a message, then output the message +// If the user wrote & saved a message, then remove any extra blank lines that +// may be at the end of the message (in gEditLines), and output the message // lines to a file with the passed-in input filename. var savedTheMessage = false; if ((exitCode == 0) && (gEditLines.length > 0)) { + // Remove any extra blank lines at the end of the message + var lineIndex = gEditLines.length - 1; + while ((lineIndex > 0) && (lineIndex < gEditLines.length) && (gEditLines[lineIndex].length() == 0)) + { + gEditLines.splice(lineIndex, 1); + --lineIndex; + } + + // New (2019-04-14): For paragraphs of non-quote lines, make the paragraph + // all one line. Copy to another array of edit lines, and then set gEditLines + // to that array. + //var gEditLines = new Array(); + //textLine = new TextLine(); + /* + function TextLine(pText, pHardNewlineEnd, pIsQuoteLine) + { + this.text = ""; // The line text + this.hardNewlineEnd = false; // Whether or not the line has a hard newline at the end + this.isQuoteLine = false; // Whether or not this is a quote line + // Copy the parameters if they are valid. + if ((pText != null) && (typeof(pText) == "string")) + this.text = pText; + if ((pHardNewlineEnd != null) && (typeof(pHardNewlineEnd) == "boolean")) + this.hardNewlineEnd = pHardNewlineEnd; + if ((pIsQuoteLine != null) && (typeof(pIsQuoteLine) == "boolean")) + this.isQuoteLine = pIsQuoteLine; + */ + // Store whether the user is still posting the message in the original sub-board // and whether that's the only sub-board they're posting in. var postingInOriginalSubBoard = gCrossPostMsgSubs.subCodeExists(gMsgAreaInfo.subBoardCode); @@ -1870,168 +1898,169 @@ function doDeleteKey(pCurpos, pCurrentWordLength) // currentLength: The length of the current word function doPrintableChar(pUserInput, pCurpos, pCurrentWordLength) { - // Create the return object. - var retObj = new Object(); - retObj.x = pCurpos.x; - retObj.y = pCurpos.y; - retObj.currentWordLength = pCurrentWordLength; + // Create the return object. + var retObj = { + x: pCurpos.x, + y: pCurpos.y, + currentWordLength: pCurrentWordLength + }; - // Note: gTextLineIndex is where the new character will appear in the line. - // If gTextLineIndex is somehow past the end of the current line, then - // fill it with spaces up to gTextLineIndex. - if (gTextLineIndex > gEditLines[gEditLinesIndex].length()) - { - var numSpaces = gTextLineIndex - gEditLines[gEditLinesIndex].length(); - if (numSpaces > 0) - gEditLines[gEditLinesIndex].text += format("%" + numSpaces + "s", ""); - gEditLines[gEditLinesIndex].text += pUserInput; - } - // If gTextLineIndex is at the end of the line, then just append the char. - else if (gTextLineIndex == gEditLines[gEditLinesIndex].length()) - gEditLines[gEditLinesIndex].text += pUserInput; - else - { - // gTextLineIndex is at the beginning or in the middle of the line. - if (inInsertMode()) - { - gEditLines[gEditLinesIndex].text = spliceIntoStr(gEditLines[gEditLinesIndex].text, - gTextLineIndex, pUserInput); - } - else - { - gEditLines[gEditLinesIndex].text = gEditLines[gEditLinesIndex].text.substr(0, gTextLineIndex) - + pUserInput + gEditLines[gEditLinesIndex].text.substr(gTextLineIndex+1); - } - } + // Note: gTextLineIndex is where the new character will appear in the line. + // If gTextLineIndex is somehow past the end of the current line, then + // fill it with spaces up to gTextLineIndex. + if (gTextLineIndex > gEditLines[gEditLinesIndex].length()) + { + var numSpaces = gTextLineIndex - gEditLines[gEditLinesIndex].length(); + if (numSpaces > 0) + gEditLines[gEditLinesIndex].text += format("%" + numSpaces + "s", ""); + gEditLines[gEditLinesIndex].text += pUserInput; + } + // If gTextLineIndex is at the end of the line, then just append the char. + else if (gTextLineIndex == gEditLines[gEditLinesIndex].length()) + gEditLines[gEditLinesIndex].text += pUserInput; + else + { + // gTextLineIndex is at the beginning or in the middle of the line. + if (inInsertMode()) + { + gEditLines[gEditLinesIndex].text = spliceIntoStr(gEditLines[gEditLinesIndex].text, + gTextLineIndex, pUserInput); + } + else + { + gEditLines[gEditLinesIndex].text = gEditLines[gEditLinesIndex].text.substr(0, gTextLineIndex) + + pUserInput + gEditLines[gEditLinesIndex].text.substr(gTextLineIndex+1); + } + } - // Handle text replacement (AKA macros). Added 2013-08-31. - var madeTxtReplacement = false; // For screen refresh purposes - if (gConfigSettings.enableTextReplacements && (pUserInput == " ")) - { - var txtReplaceObj = gEditLines[gEditLinesIndex].doMacroTxtReplacement(gTxtReplacements, gTextLineIndex, - gConfigSettings.textReplacementsUseRegex); - madeTxtReplacement = txtReplaceObj.madeTxtReplacement; - if (madeTxtReplacement) - { - retObj.x += txtReplaceObj.wordLenDiff; - gTextLineIndex += txtReplaceObj.wordLenDiff; - } - } + // Handle text replacement (AKA macros). Added 2013-08-31. + var madeTxtReplacement = false; // For screen refresh purposes + if (gConfigSettings.enableTextReplacements && (pUserInput == " ")) + { + var txtReplaceObj = gEditLines[gEditLinesIndex].doMacroTxtReplacement(gTxtReplacements, gTextLineIndex, + gConfigSettings.textReplacementsUseRegex); + madeTxtReplacement = txtReplaceObj.madeTxtReplacement; + if (madeTxtReplacement) + { + retObj.x += txtReplaceObj.wordLenDiff; + gTextLineIndex += txtReplaceObj.wordLenDiff; + } + } - // Store a copy of the current line so that we can compare it later to see - // if it was modified by reAdjustTextLines(). - var originalAfterCharApplied = gEditLines[gEditLinesIndex].text; + // Store a copy of the current line so that we can compare it later to see + // if it was modified by reAdjustTextLines(). + var originalAfterCharApplied = gEditLines[gEditLinesIndex].text; - // If the line is now too long to fit in the edit area, then we will have - // to re-adjust the text lines. - var reAdjusted = false; - if (gEditLines[gEditLinesIndex].length() >= gEditWidth) - reAdjusted = reAdjustTextLines(gEditLines, gEditLinesIndex, gEditLines.length, gEditWidth); + // If the line is now too long to fit in the edit area, then we will have + // to re-adjust the text lines. + var reAdjusted = false; + if (gEditLines[gEditLinesIndex].length() >= gEditWidth) + reAdjusted = reAdjustTextLines(gEditLines, gEditLinesIndex, gEditLines.length, gEditWidth); - // placeCursorAtEnd specifies whether or not to place the cursor at its - // spot using console.gotoxy() at the end. This is an optimization. - var placeCursorAtEnd = true; + // placeCursorAtEnd specifies whether or not to place the cursor at its + // spot using console.gotoxy() at the end. This is an optimization. + var placeCursorAtEnd = true; - // If the current text line is now different (modified by reAdjustTextLines()) - // or text replacements were made, then we'll need to refresh multiple lines - // on the screen. - if ((reAdjusted && (gEditLines[gEditLinesIndex].text != originalAfterCharApplied)) || madeTxtReplacement) - { - // If gTextLineIndex is >= gEditLines[gEditLinesIndex].length(), then - // we know the current word was wrapped to the next line. Figure out what - // retObj.x, retObj.currentWordLength, gEditLinesIndex, and gTextLineIndex - // should be, and increment retObj.y. Also figure out what lines on the - // screen to update, and deal with scrolling if necessary. - if (gTextLineIndex >= gEditLines[gEditLinesIndex].length()) - { - // I changed this on 2010-02-14 to (hopefully) place the cursor where - // it should be - // Old line (prior to 2010-02-14): - //var numChars = gTextLineIndex - gEditLines[gEditLinesIndex].length(); - // New (2010-02-14): - var numChars = 0; - // Special case: If the current line's length is exactly the longest - // edit with, then the # of chars should be 0 or 1, depending on whether the - // entered character was a space or not. Otherwise, calculate numChars - // normally. - if (gEditLines[gEditLinesIndex].length() == gEditWidth-1) - numChars = ((pUserInput == " ") ? 0 : 1); - else - numChars = gTextLineIndex - gEditLines[gEditLinesIndex].length(); - retObj.x = gEditLeft + numChars; - var originalEditLinesIndex = gEditLinesIndex++; - gTextLineIndex = numChars; - // The following line is now done at the end: - //retObj.currentWordLength = getWordLength(gEditLinesIndex, gTextLineIndex); - - // Figure out which lines we need to update on the screen and whether - // to do scrolling and what retObj.y should be. - if (retObj.y < gEditBottom) - { - // We're above the last line on the screen, so we can go one - // line down. - var originalY = retObj.y++; - // Update the lines on the screen. - var bottommostRow = calcBottomUpdateRow(originalY, originalEditLinesIndex); - displayEditLines(originalY, originalEditLinesIndex, bottommostRow, true, true); - } - else - { - // We're on the last line in the edit area, so we need to scroll - // the text lines up on the screen. - var editLinesTopIndex = gEditLinesIndex - (pCurpos.y - gEditTop); - displayEditLines(gEditTop, editLinesTopIndex, gEditBottom, true, true); - } - } - else - { - // gTextLineIndex is < the line's length. Update the lines on the - // screen from the current line down. Increment retObj.x, - // retObj.currentWordLength, and gTextLineIndex. - var bottommostRow = calcBottomUpdateRow(retObj.y, gEditLinesIndex); - displayEditLines(retObj.y, gEditLinesIndex, bottommostRow, true, true); - if (pUserInput == " ") - retObj.currentWordLength = 0; - else - ++retObj.currentWordLength; - ++retObj.x; - ++gTextLineIndex; - } - } - else - { - // The text line wasn't changed by reAdjustTextLines. + // If the current text line is now different (modified by reAdjustTextLines()) + // or text replacements were made, then we'll need to refresh multiple lines + // on the screen. + if ((reAdjusted && (gEditLines[gEditLinesIndex].text != originalAfterCharApplied)) || madeTxtReplacement) + { + // If gTextLineIndex is >= gEditLines[gEditLinesIndex].length(), then + // we know the current word was wrapped to the next line. Figure out what + // retObj.x, retObj.currentWordLength, gEditLinesIndex, and gTextLineIndex + // should be, and increment retObj.y. Also figure out what lines on the + // screen to update, and deal with scrolling if necessary. + if (gTextLineIndex >= gEditLines[gEditLinesIndex].length()) + { + // I changed this on 2010-02-14 to (hopefully) place the cursor where + // it should be + // Old line (prior to 2010-02-14): + //var numChars = gTextLineIndex - gEditLines[gEditLinesIndex].length(); + // New (2010-02-14): + var numChars = 0; + // Special case: If the current line's length is exactly the longest + // edit with, then the # of chars should be 0 or 1, depending on whether the + // entered character was a space or not. Otherwise, calculate numChars + // normally. + if (gEditLines[gEditLinesIndex].length() == gEditWidth-1) + numChars = ((pUserInput == " ") ? 0 : 1); + else + numChars = gTextLineIndex - gEditLines[gEditLinesIndex].length(); + retObj.x = gEditLeft + numChars; + var originalEditLinesIndex = gEditLinesIndex++; + gTextLineIndex = numChars; + // The following line is now done at the end: + //retObj.currentWordLength = getWordLength(gEditLinesIndex, gTextLineIndex); + + // Figure out which lines we need to update on the screen and whether + // to do scrolling and what retObj.y should be. + if (retObj.y < gEditBottom) + { + // We're above the last line on the screen, so we can go one + // line down. + var originalY = retObj.y++; + // Update the lines on the screen. + var bottommostRow = calcBottomUpdateRow(originalY, originalEditLinesIndex); + displayEditLines(originalY, originalEditLinesIndex, bottommostRow, true, true); + } + else + { + // We're on the last line in the edit area, so we need to scroll + // the text lines up on the screen. + var editLinesTopIndex = gEditLinesIndex - (pCurpos.y - gEditTop); + displayEditLines(gEditTop, editLinesTopIndex, gEditBottom, true, true); + } + } + else + { + // gTextLineIndex is < the line's length. Update the lines on the + // screen from the current line down. Increment retObj.x, + // retObj.currentWordLength, and gTextLineIndex. + var bottommostRow = calcBottomUpdateRow(retObj.y, gEditLinesIndex); + displayEditLines(retObj.y, gEditLinesIndex, bottommostRow, true, true); + if (pUserInput == " ") + retObj.currentWordLength = 0; + else + ++retObj.currentWordLength; + ++retObj.x; + ++gTextLineIndex; + } + } + else + { + // The text line wasn't changed by reAdjustTextLines. - // If gTextLineIndex is not the last index of the line, then refresh the - // entire line on the screen. Otherwise, just output the character that - // the user typed. - if (gTextLineIndex < gEditLines[gEditLinesIndex].length()-1) - displayEditLines(retObj.y, gEditLinesIndex, retObj.y, false, true); - else - { - console.print(pUserInput); - placeCursorAtEnd = false; // Since we just output the character - } + // If gTextLineIndex is not the last index of the line, then refresh the + // entire line on the screen. Otherwise, just output the character that + // the user typed. + if (gTextLineIndex < gEditLines[gEditLinesIndex].length()-1) + displayEditLines(retObj.y, gEditLinesIndex, retObj.y, false, true); + else + { + console.print(pUserInput); + placeCursorAtEnd = false; // Since we just output the character + } - // Keep housekeeping variables up to date. - ++retObj.x; - ++gTextLineIndex; - /* retObj.currentWordLength is now calculated at the end, but we could do this: - if (pUserInput == " ") - retObj.currentWordLength = 0; - else - ++retObj.currentWordLength; - */ - } + // Keep housekeeping variables up to date. + ++retObj.x; + ++gTextLineIndex; + /* retObj.currentWordLength is now calculated at the end, but we could do this: + if (pUserInput == " ") + retObj.currentWordLength = 0; + else + ++retObj.currentWordLength; + */ + } - // Make sure the current word length is correct. - retObj.currentWordLength = getWordLength(gEditLinesIndex, gTextLineIndex); + // Make sure the current word length is correct. + retObj.currentWordLength = getWordLength(gEditLinesIndex, gTextLineIndex); - // Make sure the cursor is placed where it should be. - if (placeCursorAtEnd) - console.gotoxy(retObj.x, retObj.y); + // Make sure the cursor is placed where it should be. + if (placeCursorAtEnd) + console.gotoxy(retObj.x, retObj.y); - return retObj; + return retObj; } // Helper function for doEditLoop(): Performs the action for when the user diff --git a/exec/SlyEdit_DCTStuff.js b/exec/SlyEdit_DCTStuff.js index 5b43efa2a1c1628e7e7745289b97d7752f6a5120..fbf85237b7d476d79b6459b809b829c1a8d96095 100644 --- a/exec/SlyEdit_DCTStuff.js +++ b/exec/SlyEdit_DCTStuff.js @@ -64,6 +64,13 @@ * DrawQuoteWindowTopBorder_DCTStyle(). Updated the * quote window bottom border to display the new * scroll keys in DrawQuoteWindowBottomBorder_DCTStyle(). + * 2019-04-11 Eric Oulashin Fixed displayTextAreaTopBorder_DCTStyle() and + * DisplayTextAreaBottomBorder_DCTStyle() to display + * correctly in wide terminal modes. Somehow they + * had become broken over the years. Also, updated + * redrawScreen_DCTStyle() to not display the vertical + * bars for terminal widths >= 82, for wide text + * wrapping support. */ load("sbbsdefs.js"); @@ -127,20 +134,20 @@ function redrawScreen_DCTStyle(pEditLeft, pEditRight, pEditTop, pEditBottom, pEd // border only once, for efficiency). if (typeof(redrawScreen_DCTStyle.topBorder) == "undefined") { - var innerWidth = console.screen_columns - 2; - redrawScreen_DCTStyle.topBorder = UPPER_LEFT_SINGLE; - for (var i = 0; i < innerWidth; ++i) - redrawScreen_DCTStyle.topBorder += HORIZONTAL_SINGLE; - redrawScreen_DCTStyle.topBorder += UPPER_RIGHT_SINGLE; - redrawScreen_DCTStyle.topBorder = randomTwoColorString(redrawScreen_DCTStyle.topBorder, - gConfigSettings.DCTColors.TopBorderColor1, - gConfigSettings.DCTColors.TopBorderColor2); - } - // Print the border line on the screen - console.clear(); - console.print(redrawScreen_DCTStyle.topBorder); + var innerWidth = console.screen_columns - 2; + redrawScreen_DCTStyle.topBorder = UPPER_LEFT_SINGLE; + for (var i = 0; i < innerWidth; ++i) + redrawScreen_DCTStyle.topBorder += HORIZONTAL_SINGLE; + redrawScreen_DCTStyle.topBorder += UPPER_RIGHT_SINGLE; + redrawScreen_DCTStyle.topBorder = randomTwoColorString(redrawScreen_DCTStyle.topBorder, + gConfigSettings.DCTColors.TopBorderColor1, + gConfigSettings.DCTColors.TopBorderColor2); + } + // Print the border line on the screen + console.clear(); + console.print(redrawScreen_DCTStyle.topBorder); - // Next line + // Next line // From name var lineNum = 2; console.gotoxy(1, lineNum); @@ -253,6 +260,7 @@ function redrawScreen_DCTStyle(pEditLeft, pEditRight, pEditTop, pEditBottom, pEd // Line 4: Top border for message area ++lineNum; displayTextAreaTopBorder_DCTStyle(lineNum, pEditLeft, pEditRight); + /* // If the screen is at least 82 characters wide, display horizontal // lines around the message editing area. if (console.screen_columns >= 82) @@ -269,6 +277,7 @@ function redrawScreen_DCTStyle(pEditLeft, pEditRight, pEditTop, pEditBottom, pEd gConfigSettings.DCTColors.EditAreaBorderColor2)); } } + */ // Display the bottom message area border and help line DisplayTextAreaBottomBorder_DCTStyle(pEditBottom+1, null, pEditLeft, pEditRight, pInsertMode); @@ -290,28 +299,31 @@ function redrawScreen_DCTStyle(pEditLeft, pEditRight, pEditTop, pEditBottom, pEd // pEditRight: The rightmost edit area column on the screen function displayTextAreaTopBorder_DCTStyle(pLineNum, pEditLeft, pEditRight) { - // The border will use random bright/normal colors. The colors - // should stay the same each time we draw it, so a "static" - // variable is used for the border text. If that variable has - // not been defined yet, then build it. - if (typeof(displayTextAreaTopBorder_DCTStyle.border) == "undefined") - { - var numHorizontalChars = pEditRight - pEditLeft - 1; - if (console.screen_columns >= 82) - numHorizontalChars += 2; - - displayTextAreaTopBorder_DCTStyle.border = UPPER_LEFT_SINGLE; - for (var i = 0; i < numHorizontalChars; ++i) - displayTextAreaTopBorder_DCTStyle.border += HORIZONTAL_SINGLE; - displayTextAreaTopBorder_DCTStyle.border += UPPER_RIGHT_SINGLE; - displayTextAreaTopBorder_DCTStyle.border = - randomTwoColorString(displayTextAreaTopBorder_DCTStyle.border, - gConfigSettings.DCTColors.EditAreaBorderColor1, - gConfigSettings.DCTColors.EditAreaBorderColor2); - } + // The border will use random bright/normal colors. The colors + // should stay the same each time we draw it, so a "static" + // variable is used for the border text. If that variable has + // not been defined yet, then build it. + if (typeof(displayTextAreaTopBorder_DCTStyle.border) == "undefined") + { + var numHorizontalChars = pEditRight - pEditLeft - 1; + /* + if (console.screen_columns >= 82) + numHorizontalChars += 2; + */ + + displayTextAreaTopBorder_DCTStyle.border = UPPER_LEFT_SINGLE; + for (var i = 0; i < numHorizontalChars; ++i) + displayTextAreaTopBorder_DCTStyle.border += HORIZONTAL_SINGLE; + displayTextAreaTopBorder_DCTStyle.border += UPPER_RIGHT_SINGLE; + displayTextAreaTopBorder_DCTStyle.border = + randomTwoColorString(displayTextAreaTopBorder_DCTStyle.border, + gConfigSettings.DCTColors.EditAreaBorderColor1, + gConfigSettings.DCTColors.EditAreaBorderColor2); + } // Draw the line on the screen - console.gotoxy((console.screen_columns >= 82 ? pEditLeft-1 : pEditLeft), pLineNum); + //console.gotoxy((console.screen_columns >= 82 ? pEditLeft-1 : pEditLeft), pLineNum); + console.gotoxy(pEditLeft, pLineNum); console.print(displayTextAreaTopBorder_DCTStyle.border); } @@ -328,44 +340,47 @@ function displayTextAreaTopBorder_DCTStyle(pLineNum, pEditLeft, pEditRight) function DisplayTextAreaBottomBorder_DCTStyle(pLineNum, pUseQuotes, pEditLeft, pEditRight, pInsertMode, pCanChgMsgColor) { - // The border will use random bright/normal colors. The colors - // should stay the same each time we draw it, so a "static" - // variable is used for the border text. If that variable has - // not been defined yet, then build it. - if (typeof(DisplayTextAreaBottomBorder_DCTStyle.border) == "undefined") - { - var innerWidth = pEditRight - pEditLeft - 1; - // If the screen is at least 82 characters wide, add 2 to innerWidth - // to make room for the vertical lines around the text area. - if (console.screen_columns >= 82) - innerWidth += 2; - - DisplayTextAreaBottomBorder_DCTStyle.border = LOWER_LEFT_SINGLE; - - // This loop uses innerWidth-6 to make way for the insert mode - // text. - for (var i = 0; i < innerWidth-6; ++i) - DisplayTextAreaBottomBorder_DCTStyle.border += HORIZONTAL_SINGLE; - DisplayTextAreaBottomBorder_DCTStyle.border = - randomTwoColorString(DisplayTextAreaBottomBorder_DCTStyle.border, - gConfigSettings.DCTColors.EditAreaBorderColor1, - gConfigSettings.DCTColors.EditAreaBorderColor2); - // Insert mode - DisplayTextAreaBottomBorder_DCTStyle.border += gConfigSettings.DCTColors.EditModeBrackets - + "[" + gConfigSettings.DCTColors.EditMode - + pInsertMode - + gConfigSettings.DCTColors.EditModeBrackets - + "]"; - // The last 2 border characters - DisplayTextAreaBottomBorder_DCTStyle.border += - randomTwoColorString(HORIZONTAL_SINGLE + LOWER_RIGHT_SINGLE, - gConfigSettings.DCTColors.EditAreaBorderColor1, - gConfigSettings.DCTColors.EditAreaBorderColor2); - } + // The border will use random bright/normal colors. The colors + // should stay the same each time we draw it, so a "static" + // variable is used for the border text. If that variable has + // not been defined yet, then build it. + if (typeof(DisplayTextAreaBottomBorder_DCTStyle.border) == "undefined") + { + var innerWidth = pEditRight - pEditLeft - 1; + /* + // If the screen is at least 82 characters wide, add 2 to innerWidth + // to make room for the vertical lines around the text area. + if (console.screen_columns >= 82) + innerWidth += 2; + */ + + DisplayTextAreaBottomBorder_DCTStyle.border = LOWER_LEFT_SINGLE; + + // This loop uses innerWidth-6 to make way for the insert mode + // text. + for (var i = 0; i < innerWidth-6; ++i) + DisplayTextAreaBottomBorder_DCTStyle.border += HORIZONTAL_SINGLE; + DisplayTextAreaBottomBorder_DCTStyle.border = + randomTwoColorString(DisplayTextAreaBottomBorder_DCTStyle.border, + gConfigSettings.DCTColors.EditAreaBorderColor1, + gConfigSettings.DCTColors.EditAreaBorderColor2); + // Insert mode + DisplayTextAreaBottomBorder_DCTStyle.border += gConfigSettings.DCTColors.EditModeBrackets + + "[" + gConfigSettings.DCTColors.EditMode + + pInsertMode + + gConfigSettings.DCTColors.EditModeBrackets + + "]"; + // The last 2 border characters + DisplayTextAreaBottomBorder_DCTStyle.border += + randomTwoColorString(HORIZONTAL_SINGLE + LOWER_RIGHT_SINGLE, + gConfigSettings.DCTColors.EditAreaBorderColor1, + gConfigSettings.DCTColors.EditAreaBorderColor2); + } - // Draw the border line on the screen. - console.gotoxy((console.screen_columns >= 82 ? pEditLeft-1 : pEditLeft), pLineNum); - console.print(DisplayTextAreaBottomBorder_DCTStyle.border); + // Draw the border line on the screen. + //console.gotoxy((console.screen_columns >= 82 ? pEditLeft-1 : pEditLeft), pLineNum); + console.gotoxy(pEditLeft, pLineNum); + console.print(DisplayTextAreaBottomBorder_DCTStyle.border); } // Displays the help line at the bottom of the screen, in the style diff --git a/exec/SlyEdit_IceStuff.js b/exec/SlyEdit_IceStuff.js index 1f153fdd7e9ffdda4b032a596b58c42337332328..e6c2f8c8172670641a0aec107196ce469798af40 100644 --- a/exec/SlyEdit_IceStuff.js +++ b/exec/SlyEdit_IceStuff.js @@ -56,6 +56,9 @@ * CTRL key help text at the right in the bottom border are * correctly displayed with a high blue color, regardless of * what is specified in the color theme file. + * 2019-04-11 Eric Oulashin Updated redrawScreen_IceStyle() to not display the vertical + * bars for terminal widths >= 82, for wide text wrapping + * support. */ load("sbbsdefs.js"); @@ -291,6 +294,7 @@ function redrawScreen_IceStyle(pEditLeft, pEditRight, pEditTop, pEditBottom, pEd DisplayTextAreaBottomBorder_IceStyle(pEditBottom + 1, pUseQuotes); DisplayBottomHelpLine_IceStyle(console.screen_rows, pUseQuotes); + /* // If the screen is at least 82 columns wide output vertical lines // to frame the edit area. if (console.screen_columns >= 82) @@ -305,6 +309,7 @@ function redrawScreen_IceStyle(pEditLeft, pEditRight, pEditTop, pEditBottom, pEd gConfigSettings.iceColors.BorderColor2)); } } + */ // Go to the start of the edit area console.gotoxy(pEditLeft, pEditTop); @@ -401,7 +406,7 @@ function DisplayBottomHelpLine_IceStyle(pLineNum, pUsingQuotes) // This line contains the copyright mesage & ESC key help var screenText = iceText(EDITOR_PROGRAM_NAME + " v", "w") + "ch" + EDITOR_VERSION.toString() + " " - + iceText("Copyright", "w") + " ch2018 " + + iceText("Copyright", "w") + " ch2019 " + iceText("Eric Oulashin", "w") + " nb" + DOT_CHAR + " " + iceText("Press ESCape For Help", "w"); // Calculate the starting position to center the help text, and front-pad