diff --git a/docs/SlyEdit_ReadMe.txt b/docs/slyedit_readme.txt similarity index 98% rename from docs/SlyEdit_ReadMe.txt rename to docs/slyedit_readme.txt index 51263f1e1ef09810a4334c5ee48c5b98969c901d..6b8de55021798fc1d02417fce91f495f523112f5 100644 --- a/docs/SlyEdit_ReadMe.txt +++ b/docs/slyedit_readme.txt @@ -1,12 +1,13 @@ SlyEdit message editor - Version 1.82 - Release date: 2022-12-01 + Version 1.83 + Release date: 2022-12-14 by Eric Oulashin Sysop of Digital Distortion BBS - BBS internet address: digdist.bbsindex.com + BBS internet address: digitaldistortionbbs.com + Alternate: digdist.synchro.net Email: eric.oulashin@gmail.com @@ -144,7 +145,7 @@ ICE parameter for IceEdit emulation: � �Native (32-bit) Executable No � � �Use Shell to Execute No � � �Record Terminal Width Yes � - � �Word-wrap Quoted Text Yes, for 80 columns � + � �Word-wrap Quoted Text Yes, for terminal width � � �Automatically Quoted Text All � � �Editor Information Files QuickBBS MSGINF/MSGTMP � � �Expand Line Feeds to CRLF Yes � @@ -917,6 +918,14 @@ message to lower-case and comparing them with the words in the dictionary. =================== Version Date Description ------- ---- ----------- +1.83 2022-12-13 Quote lines that are wider than the user's terminal width + are now wrapped to the user's terminal width to ensure + all the quote lines are entirely available to be quoted. +1.82 2022-12-01 Bug fix: Added some safety checks when reading the + configuration file +1.81 2022-11-26 Refactored the way the configuration file is read. Also, + the color configuration files now can just specify + attribute characters, without the control character. 1.80 2022-07-04 Added the ability to change/set the text color (using the CTRL-K hotkey). If desired, changing the text color can be disabled if, and the colors can be saved as ANSI diff --git a/exec/SlyEdit.js b/exec/SlyEdit.js index 6fe257d56e3397a19f5504b97a79e4eeeca748a8..4212fe739464bdc164ff6e50942cfa497e555719 100644 --- a/exec/SlyEdit.js +++ b/exec/SlyEdit.js @@ -21,6 +21,10 @@ * 2022-12-01 Eric Oulashin Version 1.82 * Added some safety checks when reading the configuration file * (that section of code was refactored recently). + * 2022-12-13 Eric Oulashin Version 1.83 + * Quote lines that are wider than the user's terminal width are + * now wrapped to the user's terminal width to ensure all the + * quote lines are entirely available to be quoted. */ "use strict"; @@ -118,8 +122,8 @@ if (console.screen_columns < 80) } // Version information -var EDITOR_VERSION = "1.82"; -var EDITOR_VER_DATE = "2022-12-01"; +var EDITOR_VERSION = "1.83"; +var EDITOR_VER_DATE = "2022-12-14"; // Program variables @@ -953,7 +957,7 @@ function readQuoteOrMessageFile() { textLine = inputFile.readln(2048); // Only use textLine if it's actually a string. - if (typeof(textLine) == "string") + if (typeof(textLine) === "string") { textLine = strip_ctrl(textLine); // If the line has only whitespace and/or > characters, @@ -961,7 +965,22 @@ function readQuoteOrMessageFile() // gQuoteLines. if (/^[\s>]+$/.test(textLine)) textLine = ""; - gQuoteLines.push(textLine); + // If the quote line length is within the user's terminal width, then add it as-is. + if (textLine.length <= console.screen_columns-1) + gQuoteLines.push(textLine); + else + { + // Word-wrap the quote line to ensure the quote lines are no wider than the user's + // terminal width (minus 1 character) + var wrappedLine = word_wrap(textLine, console.screen_columns-1, textLine.length, false); + var wrappedLines = wrappedLine.split("\n"); + // If splitting results in an empty line at the end of the array (due to a newline at the + // end of the last line), then remove that line. Then add the wrapped lines to the quote lines. + if (wrappedLines.length > 0 && wrappedLines[wrappedLines.length-1].length == 0) + wrappedLines.splice(-1); + for (var i = 0; i < wrappedLines.length; ++i) + gQuoteLines.push(wrappedLines[i]); + } } } } diff --git a/xtrn/DDMsgReader/DDMsgReader.js b/xtrn/DDMsgReader/DDMsgReader.js index 38cdbe26001a2f4f78ec05b84716d7430334f90c..4bed0e61e9b4f741f8e6e59daddd473baebdb39f 100644 --- a/xtrn/DDMsgReader/DDMsgReader.js +++ b/xtrn/DDMsgReader/DDMsgReader.js @@ -66,6 +66,9 @@ * configured text strings. * 2022-12-12 Eric Oulashin Fix for "assignment to undeclared variable" error in GetMsgSubBrdLine(); * appeared when changing to a different message area from the reader + * 2012-12-14 Eric Oulashin Version 1.58 + * When writing QUOTES.TXT, quote lines are now wrapped if the user's + * external editor configuration is configured to do so. */ "use strict"; @@ -170,8 +173,8 @@ var ansiterm = require("ansiterm_lib.js", 'expand_ctrl_a'); // Reader version information -var READER_VERSION = "1.57.1"; -var READER_DATE = "2022-12-12"; +var READER_VERSION = "1.58"; +var READER_DATE = "2022-12-14"; // Keyboard key codes for displaying on the screen var UP_ARROW = ascii(24); @@ -9749,21 +9752,23 @@ function DigDistMsgReader_ReplyToMsg(pMsgHdr, pMsgText, pPrivate, pMsgIdx) var quoteFile = null; if (this.CanQuote()) { + // Get the user's setting for whether or not to wrap quote lines (and how long) from + // their external editor settings + var editorQuoteCfg = getExternalEditorQuoteWrapCfgFromSCFG(user.editor); + // Write the message text to the quotes file quoteFile = new File(system.node_dir + "QUOTES.TXT"); if (quoteFile.open("w")) { var msgNum = (typeof(pMsgIdx) === "number" ? pMsgIdx+1 : null); + var msgText = ""; if (typeof(pMsgText) == "string") - { - //quoteFile.write(word_wrap(pMsgText, 80/*79*/)); - quoteFile.write(pMsgText); - } + msgText = pMsgText; else - { - var msgText = msgbase.get_msg_body(false, pMsgHdr.number, false, false, true, true); - //quoteFile.write(word_wrap(msgText, 80/*79*/)); - quoteFile.write(msgText); - } + msgText = msgbase.get_msg_body(false, pMsgHdr.number, false, false, true, true); + if (editorQuoteCfg.quoteWrapEnabled && editorQuoteCfg.quoteWrapCols > 0) + msgText = word_wrap(msgText, editorQuoteCfg.quoteWrapCols, msgText.length, false); + quoteFile.write(msgText); + quoteFile.close(); // Let the user quote in the reply replyMode |= WM_QUOTE; @@ -20073,6 +20078,73 @@ function msgSenderIsASysop(pMsgHdr) return senderIsSysop; } +// Gets the quote wrap settings for an external editor +// +// Parameters: +// pEditorCode: The internal code of an external editor +// +// Return value: An object containing the following properties: +// quoteWrapEnabled: Boolean: Whether or not quote wrapping is enabled for the editor +// quoteWrapCols: The number of columns to wrap quote lines +// If the given editor code is not found, quoteWrapEnabled will be false and quoteWrapCols will be -1 +function getExternalEditorQuoteWrapCfgFromSCFG(pEditorCode) +{ + var retObj = { + quoteWrapEnabled: false, + quoteWrapCols: -1 + }; + + if (typeof(pEditorCode) !== "string") + return retObj; + if (pEditorCode.length == 0) + return retObj; + + var editorCode = pEditorCode.toLowerCase(); + if (!xtrn_area.editor.hasOwnProperty(editorCode)) + return retObj; + + // Set up a cache so that we don't have to keep repeatedly parsing the Synchronet + // config every time the user replies to a message + if (typeof(getExternalEditorQuoteWrapCfgFromSCFG.cache) === "undefined") + getExternalEditorQuoteWrapCfgFromSCFG.cache = {}; + // If we haven't looked up the quote wrap cols setting yet, then do so; otherwise, use the + // cached setting. + if (!getExternalEditorQuoteWrapCfgFromSCFG.cache.hasOwnProperty(editorCode)) + { + if ((xtrn_area.editor[editorCode].settings & XTRN_QUOTEWRAP) == XTRN_QUOTEWRAP) + { + retObj.quoteWrapEnabled = true; + retObj.quoteWrapCols = console.screen_columns - 1; + + // See exportcfg.js for an example of using cnflib.js + // TODO: If running Synchronet 3.20, then there will be an easier way to get the quotewrap + // columns, from the .ini configuration + var cnflib = load({}, "cnflib.js"); + var xtrnCnf = cnflib.read("xtrn.cnf"); + if (typeof(xtrnCnf) === "object") + { + for (var i = 0; i < xtrnCnf.xedit.length; ++i) + { + if (xtrnCnf.xedit[i].code.toLowerCase() == editorCode) + { + if (xtrnCnf.xedit[i].hasOwnProperty("quotewrap_cols")) + { + if (xtrnCnf.xedit[i].quotewrap_cols > 0) + retObj.quoteWrapCols = xtrnCnf.xedit[i].quotewrap_cols; + } + break; + } + } + } + } + getExternalEditorQuoteWrapCfgFromSCFG.cache[editorCode] = retObj; + } + else + retObj = getExternalEditorQuoteWrapCfgFromSCFG.cache[editorCode]; + + return retObj; +} + /////////////////////////////////////////////////////////////////////////////////// // For debugging: Writes some text on the screen at a given location with a given pause. diff --git a/xtrn/DDMsgReader/readme.txt b/xtrn/DDMsgReader/readme.txt index 714e1b271c70a9e91b47da1303630abaaa48f9aa..4e9b5125b0725cdd7c38a1f3f3a0ce8084b5d351 100644 --- a/xtrn/DDMsgReader/readme.txt +++ b/xtrn/DDMsgReader/readme.txt @@ -1,6 +1,6 @@ Digital Distortion Message Reader - Version 1.57.1 - Release date: 2022-12-12 + Version 1.58 + Release date: 2022-12-14 by diff --git a/xtrn/DDMsgReader/revision_history.txt b/xtrn/DDMsgReader/revision_history.txt index aa1adf2c61ea0c0cdd08868aa6f1ae751b973da8..b2c7d455453ebb6291cecebeace6d27216ee79e7 100644 --- a/xtrn/DDMsgReader/revision_history.txt +++ b/xtrn/DDMsgReader/revision_history.txt @@ -5,6 +5,9 @@ Revision History (change log) ============================= Version Date Description ------- ---- ----------- +1.58 2022-12-14 Now wraps quote lines, if applicable, according to the + quote line wrap settings of the user's external editor, + if the user uses one 1.57.1 2022-12-12 Fix for "assignment to undeclared variable" error 1.57 2022-12-02 @-codes were only expanded when reading personal mail; now, DDMsgReader also checks to make sure the sender is a