Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit d3507aad authored by nightfox's avatar nightfox

SlyEdit version 1.41:

- Added the ability to use the PageUp and PageDown keys for page navigation in the message, replacing Ctrl-W and Ctrl-S.  Also, enabled page navigation in the quote line selection window, as well as being able to go directly to the first & last pages of quote lines.
- Corrected the width of the top border of the quote window in DCT mode for wide terminals (more than 80 characters).
- Improved the detection of paragraphs for wrapping quote lines: If the next line of text is indented compared to the previous line, the indented line is considered the start of a new paragraph, and its lines will be wrapped separately from the previous paragraph.
- Minor bug fix: When the cursor is on a line with a blank line below it, When backspacing to the beginning of the line and then to the line before it, the blank line below used to not be preserved when typing onto the next line again.
- The control key passthru & BBS status configuration (i.e., screen pause) are now restored not only in normal exit, but also if there is an exit due to a runtime error (although I would not expect that to happen).
parent 7dade158
......@@ -13,46 +13,21 @@
* 2009-08-22 Eric Oulashin Version 1.00
* Initial public release
* ....Removed some comments...
* 2013-10-22 Eric Oulashin Version 1.36 Beta
* Worked on debugging & fixing a bug when quoting
* with author initials to fix a bug where a large
* section in certain messages wasn't getting quoted.
* 2013-10-28 Eric Oulashin Version 1.36
* Releasing this version, as it seems to be quoting
* all messages well with author initials.
* 2013-11-09 Eric Oulashin Version 1.37 Beta
* Started trying to debug an issue where SlyEdit
* sometimes uses the replying user's initials
* in the last line of a paragraph of the original
* author's message.
* 2013-11-10 Eric Oulashin Version 1.37
* Releasing this version
* 2013-11-11 Eric Oulashin Version 1.38
* Minor bug fix: If there are no text replacements
* to list when the user tries to list them, the cursor
* now returns to its proper place after displaying
* the error.
* 2013-11-25 Eric Oulashin Version 1.39 Beta
* Minor bug fix in wrapQuoteLinesUsingAuthorInitials() in
* SlyEdit_Misc.js starting on line 2739: Added more
* checks to ensure that the gQuoteLines object it
* references is valid.
* Minor bug fix: Updated the Ice-style color display
* for the control key help text in the lower right so
* that normal/high attributes don't interfere with the
* high blue color of the parenthesis.
* 2013-11-27 Eric Oulashin Version 1.39
* Releasing this version after having done some testing.
* 2014-05-12 Eric Oulashin Version 1.40 (not released yet)
* Added a check in wrapQuoteLinesUsingAuthorInitials() in
* SlyEdit_Misc.js: When building the last section info object,
* added a check to the while loop that makes sure
* sectionInfo.endArrIndex is greater than 0 to avoid an index
* out-of-bounds issue with the check that references
* gQuoteLines[sectionInfo.endArrIndex-1]. This should hopefully
* fix a bug with SlyEdit crashing at that point.
* 2014-05-21 Eric Oulashin Version 1.40
* Going ahead and releasing this version
* 2014-11-01 Eric Oulashin Version 1.41 Beta
* Added support for PageUp & PageDown keys for
* message & quote line scrolling
* 2014-11-08 Eric OUlashin Started working on improved paragraph detection
* for paragraphs where the first line is indented
* when wrapping non-quoted text in reply messages
* 2014-11-09 Eric Oulashin Bug fix in doQuoteSelection(): Reset gQuoteLinesIndex
* to 0 when re-formatting the quote lines to ensure
* valid behavior. gQuoteLinesTopIndex was already
* being reset to 0.
* 2014-11-15 Eric Oulashin Version 1.41
* Decided to release this version with the PageUp/PageDown
* key support, improved paragraph detetion & wrapping
* for quote lines, backspace fix, and fixed DCT quote
* window top border for wide terminals.
*/
/* Command-line arguments:
......@@ -130,8 +105,8 @@ if (!console.term_supports(USER_ANSI))
}
// Constants
const EDITOR_VERSION = "1.40";
const EDITOR_VER_DATE = "2014-05-21";
const EDITOR_VERSION = "1.41";
const EDITOR_VER_DATE = "2014-11-15";
// Program variables
......@@ -387,6 +362,9 @@ bbs.sys_status &=~SS_PAUSEON;
bbs.sys_status |= SS_PAUSEOFF;
var gOldPassthru = console.ctrlkey_passthru;
console.ctrlkey_passthru = "+ACGKLOPQRTUVWXYZ_";
// Set some on-exit code to ensure that the original ctrl key passthru & system
// status settings are restored upon script exit, even if there is a runtime error.
js.on_exit("console.ctrlkey_passthru = gOldPassthru; bbs.sys_status = gOldStatus;");
// Enable delete line in SyncTERM (Disabling ANSI Music in the process)
console.write("\033[=1M");
console.clear();
......@@ -797,10 +775,8 @@ function doEditLoop()
const CMDLIST_HELP_KEY = CTRL_P;
const QUOTE_KEY = CTRL_Q;
const PROGRAM_INFO_HELP_KEY = CTRL_R;
const PAGE_DOWN_KEY = CTRL_S;
const LIST_TXT_REPLACEMENTS_KEY = CTRL_T;
const USER_SETTINGS_KEY = CTRL_U;
const PAGE_UP_KEY = CTRL_W;
const EXPORT_FILE_KEY = CTRL_X;
const SAVE_KEY = CTRL_Z;
......@@ -829,7 +805,7 @@ function doEditLoop()
var continueOn = true;
while (continueOn)
{
userInput = getUserKey(K_NOCRLF|K_NOSPIN, gConfigSettings);
userInput = getKeyWithESCChars(K_NOCRLF|K_NOSPIN, gConfigSettings);
// If userInput is blank, then the input timeout was probably
// reached, so abort.
if (userInput == "")
......@@ -870,6 +846,7 @@ function doEditLoop()
returnCode = 0; // Save
continueOn = false;
break;
case KEY_F1:
case CMDLIST_HELP_KEY:
displayCommandList(true, true, true, gCanCrossPost, gConfigSettings.userIsSysop,
gConfigSettings.enableTextReplacements, gConfigSettings.allowUserSettings);
......@@ -1249,7 +1226,7 @@ function doEditLoop()
currentWordLength = retObj.currentWordLength;
console.print(chooseEditColor()); // Make sure the edit color is correct
break;
case PAGE_UP_KEY: // Move 1 page up in the message
case KEY_PAGE_UP: // Move 1 page up in the message
// Calculate the index of the message line shown at the top
// of the edit area.
var topEditIndex = gEditLinesIndex-(curpos.y-gEditTop);
......@@ -1296,7 +1273,7 @@ function doEditLoop()
}
console.print(chooseEditColor()); // Make sure the edit color is correct
break;
case PAGE_DOWN_KEY: // Move 1 page down in the message
case KEY_PAGE_DOWN: // Move 1 page down in the message
// Calculate the index of the message line shown at the top
// of the edit area, and the index of the line that would be
// shown at the bottom of the edit area.
......@@ -1576,6 +1553,11 @@ function doBackspace(pCurpos, pCurrentWordLength)
// previous line.
if (gEditLines[prevLineIndex].length() <= gEditWidth-1)
{
// Copy the current line's "hard newline end" setting to the
// previous line (so that if there's a blank line below the
// current line, the blank line will be preserved), then remove
// the current edit line.
gEditLines[gEditLinesIndex-1].hardNewlineEnd = gEditLines[gEditLinesIndex].hardNewlineEnd;
gEditLines.splice(gEditLinesIndex, 1);
--gEditLinesIndex;
......@@ -1866,10 +1848,6 @@ function doPrintableChar(pUserInput, pCurpos, pCurrentWordLength)
// on the screen.
if ((reAdjusted && (gEditLines[gEditLinesIndex].text != originalAfterCharApplied)) || madeTxtReplacement)
{
// TODO: In case the user entered a whole line of text without any spaces,
// the new character would appear on the next line, so we need to figure
// out where the cursor location should be.
// 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
......@@ -1877,8 +1855,8 @@ function doPrintableChar(pUserInput, pCurpos, pCurrentWordLength)
// screen to update, and deal with scrolling if necessary.
if (gTextLineIndex >= gEditLines[gEditLinesIndex].length())
{
// TODO: I changed this on 2010-02-14 to (hopefully) place the cursor
// where it should be
// 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):
......@@ -2441,7 +2419,10 @@ function doQuoteSelection(pCurpos, pCurrentWordLength)
gQuoteLines.push(doQuoteSelection.backupQuoteLines[i]);
}
gQuoteLinesTopIndex = gQuoteLinesIndex = 0; // To prevent bad things
// Reset the selected quote line index & top displayed quote line index
// back to 0 to ensure valid screen display & scrolling behavior
gQuoteLinesIndex = 0;
gQuoteLinesTopIndex = 0;
// Update the quote line prefix text and wrap the quote lines
setQuotePrefix();
......@@ -2469,6 +2450,12 @@ function doQuoteSelection(pCurpos, pCurrentWordLength)
const quoteWinTopScreenRow = quoteTopScreenRow-1;
const quoteWinWidth = gEditRight - gEditLeft + 1;
// For pageUp/pageDown functionality - Calculate the top quote line index
// for the last page.
var quoteWinInnerHeight = quoteBottomScreenRow - quoteTopScreenRow + 1; // # of quote lines in the quote window
var numPages = Math.ceil(gQuoteLines.length / quoteWinInnerHeight);
var topIndexForLastPage = (quoteWinInnerHeight * numPages) - quoteWinInnerHeight;
// Display the top border of the quote window.
fpDrawQuoteWindowTopBorder(quoteWinHeight, gEditLeft, gEditRight);
......@@ -2487,7 +2474,7 @@ function doQuoteSelection(pCurpos, pCurrentWordLength)
while (continueOn)
{
// Get a keypress from the user
userInput = getUserKey(K_UPPER|K_NOCRLF|K_NOSPIN, gConfigSettings);
userInput = getKeyWithESCChars(K_UPPER|K_NOCRLF|K_NOSPIN|K_NOECHO, gConfigSettings);
if (userInput == "")
{
// The input timeout was reached. Abort.
......@@ -2549,6 +2536,93 @@ function doQuoteSelection(pCurpos, pCurrentWordLength)
screenLine = downRetObj.screenLine;
quoteLine = downRetObj.quoteLine;
break;
case KEY_HOME: // Select the first quote line on the current page
if (gQuoteLinesIndex != gQuoteLinesTopIndex)
{
gQuoteLinesIndex = gQuoteLinesTopIndex;
// Write the current quote line with unhighlighted colors
console.gotoxy(gEditLeft, screenLine);
printf(gFormatStrWithAttr, gQuoteWinTextColor, quoteLine);
// Calculate the new screen line and draw the new quote line with
// highlighted colors
screenLine = quoteTopScreenRow + (gQuoteLinesIndex - gQuoteLinesTopIndex);
quoteLine = getQuoteTextLine(gQuoteLinesIndex, quoteWinWidth);
console.gotoxy(gEditLeft, screenLine);
printf(gFormatStrWithAttr, gQuoteLineHighlightColor, quoteLine);
console.gotoxy(gEditLeft, screenLine);
}
break;
case KEY_END: // Select the last quote line on the current page
var lastIndexForCurrentPage = gQuoteLinesTopIndex + quoteWinInnerHeight - 1;
if (gQuoteLinesIndex != lastIndexForCurrentPage)
{
gQuoteLinesIndex = lastIndexForCurrentPage;
// Write the current quote line with unhighlighted colors
console.gotoxy(gEditLeft, screenLine);
printf(gFormatStrWithAttr, gQuoteWinTextColor, quoteLine);
// Calculate the new screen line and draw the new quote line with
// highlighted colors
screenLine = quoteTopScreenRow + (gQuoteLinesIndex - gQuoteLinesTopIndex);
quoteLine = getQuoteTextLine(gQuoteLinesIndex, quoteWinWidth);
console.gotoxy(gEditLeft, screenLine);
printf(gFormatStrWithAttr, gQuoteLineHighlightColor, quoteLine);
console.gotoxy(gEditLeft, screenLine);
}
break;
case KEY_PAGE_UP: // Go up 1 page in the quote lines
// If the current top quote line index is greater than 0, then go to
// the previous page of quote lines and select the top index on that
// page as the current selected quote line.
if (gQuoteLinesTopIndex > 0)
{
gQuoteLinesTopIndex -= quoteWinInnerHeight;
if (gQuoteLinesTopIndex < 0)
gQuoteLinesTopIndex = 0;
gQuoteLinesIndex = gQuoteLinesTopIndex;
quoteLine = getQuoteTextLine(gQuoteLinesIndex, quoteWinWidth);
screenLine = quoteTopScreenRow + (gQuoteLinesIndex - gQuoteLinesTopIndex);
displayQuoteWindowLines(gQuoteLinesTopIndex, quoteWinHeight, quoteWinWidth, true,
gQuoteLinesIndex);
}
break;
case KEY_PAGE_DOWN: // Go down 1 page in the quote lines
// If the current top quote line index is below the top index for the
// last page, then go to the next page of quote lines and select the
// top index on that page as the current selected quote line.
if (gQuoteLinesTopIndex < topIndexForLastPage)
{
gQuoteLinesTopIndex += quoteWinInnerHeight;
if (gQuoteLinesTopIndex > topIndexForLastPage)
gQuoteLinesTopIndex = topIndexForLastPage;
gQuoteLinesIndex = gQuoteLinesTopIndex;
quoteLine = getQuoteTextLine(gQuoteLinesIndex, quoteWinWidth);
screenLine = quoteTopScreenRow + (gQuoteLinesIndex - gQuoteLinesTopIndex);
displayQuoteWindowLines(gQuoteLinesTopIndex, quoteWinHeight, quoteWinWidth, true,
gQuoteLinesIndex);
}
break;
case "F": // Go to the first page
if (gQuoteLinesTopIndex > 0)
{
gQuoteLinesTopIndex = 0;
gQuoteLinesIndex = gQuoteLinesTopIndex;
quoteLine = getQuoteTextLine(gQuoteLinesIndex, quoteWinWidth);
screenLine = quoteTopScreenRow + (gQuoteLinesIndex - gQuoteLinesTopIndex);
displayQuoteWindowLines(gQuoteLinesTopIndex, quoteWinHeight, quoteWinWidth, true,
gQuoteLinesIndex);
}
break;
case "L": // Go to the last page
if (gQuoteLinesTopIndex < topIndexForLastPage)
{
gQuoteLinesTopIndex = topIndexForLastPage;
gQuoteLinesIndex = gQuoteLinesTopIndex;
quoteLine = getQuoteTextLine(gQuoteLinesIndex, quoteWinWidth);
screenLine = quoteTopScreenRow + (gQuoteLinesIndex - gQuoteLinesTopIndex);
displayQuoteWindowLines(gQuoteLinesTopIndex, quoteWinHeight, quoteWinWidth, true,
gQuoteLinesIndex);
}
break;
case KEY_ENTER:
// numTimesToMoveDown specifies how many times to move the cursor
// down after inserting the quote line into the message.
......@@ -2648,8 +2722,8 @@ function doQuoteSelection(pCurpos, pCurrentWordLength)
// pQuoteWinHeight: The height of the quote window
// pQuoteWinWidth: The width of the quote window
// pQuoteBottomScreenLine: The bottommost screen line where quote lines are displayed
function moveDownOneQuoteLine(pQuoteLinesIndex, pScreenLine, pQuoteWinHeight, pQuoteWinWidth,
pQuoteBottomScreenLine)
function moveDownOneQuoteLine(pQuoteLinesIndex, pScreenLine, pQuoteWinHeight,
pQuoteWinWidth, pQuoteBottomScreenLine)
{
// Create the return object
var returnObj = new Object();
......
......@@ -58,6 +58,10 @@
* of different widths.
* 2013-09-16 Eric Oulashin Fixed off-by-one bug for the horizontal position in
* Updated updateInsertModeOnScreen_DCTStyle().
* 2014-11-04 Eric Oulashin Fixed the quote window top border length in
* DrawQuoteWindowTopBorder_DCTStyle(). Updated the
* quote window bottom border to display the new
* scroll keys in DrawQuoteWindowBottomBorder_DCTStyle().
*/
load("sbbsdefs.js");
......@@ -453,8 +457,8 @@ function DrawQuoteWindowTopBorder_DCTStyle(pQuoteWinHeight, pEditLeft, pEditRigh
+ gConfigSettings.DCTColors.QuoteWinBorderTextColor
+ "Quote Window " + gConfigSettings.DCTColors.QuoteWinBorderColor;
var curLength = strip_ctrl(DrawQuoteWindowTopBorder_DCTStyle.border).length;
var endCol = console.screen_columns-1;
for (var i = curLength; i < endCol; ++i)
var borderWidth = pEditRight - pEditLeft;
for (var i = curLength; i < borderWidth; ++i)
DrawQuoteWindowTopBorder_DCTStyle.border += HORIZONTAL_SINGLE;
DrawQuoteWindowTopBorder_DCTStyle.border += UPPER_RIGHT_SINGLE;
}
......@@ -478,22 +482,20 @@ function DrawQuoteWindowBottomBorder_DCTStyle(pEditLeft, pEditRight)
if (typeof(DrawQuoteWindowBottomBorder_DCTStyle.border) == "undefined")
{
// Create a string containing the quote help text.
var quoteHelpText = " " + gConfigSettings.DCTColors.QuoteWinBorderTextColor
+ "[Enter] Quote Line " + gConfigSettings.DCTColors.QuoteWinBorderColor
+ " ";
for (var i = 0; i < 3; ++i)
quoteHelpText += HORIZONTAL_SINGLE;
quoteHelpText += " " + gConfigSettings.DCTColors.QuoteWinBorderTextColor
+ "[ESC] Stop Quoting " + gConfigSettings.DCTColors.QuoteWinBorderColor
+ " ";
for (var i = 0; i < 3; ++i)
quoteHelpText += HORIZONTAL_SINGLE;
quoteHelpText += " " + gConfigSettings.DCTColors.QuoteWinBorderTextColor
+ "[Up/Down] Scroll Lines ";
var quoteHelpText = gConfigSettings.DCTColors.QuoteWinBorderTextColor
+ "[Enter] Accept" + gConfigSettings.DCTColors.QuoteWinBorderColor
+ HORIZONTAL_SINGLE + HORIZONTAL_SINGLE + gConfigSettings.DCTColors.QuoteWinBorderTextColor
+ "[^Q/ESC] End" + gConfigSettings.DCTColors.QuoteWinBorderColor
+ HORIZONTAL_SINGLE + HORIZONTAL_SINGLE + gConfigSettings.DCTColors.QuoteWinBorderTextColor
+ "[" + UP_ARROW + "/" + DOWN_ARROW + "/PgUp/PgDn] Scroll"
+ gConfigSettings.DCTColors.QuoteWinBorderColor + HORIZONTAL_SINGLE
+ HORIZONTAL_SINGLE + gConfigSettings.DCTColors.QuoteWinBorderTextColor
+ "[F/L] First/last page";
var helpTextLen = strip_ctrl(quoteHelpText).length;
// Figure out the starting horizontal position on the screen so that
// the quote help text line can be centered.
var helpTextStartX = ((console.screen_columns/2) - (strip_ctrl(quoteHelpText).length/2)).toFixed(0);
var helpTextStartX = Math.floor((console.screen_columns/2) - (helpTextLen/2));
// Start creating DrawQuoteWindowBottomBorder_DCTStyle.border with the
// bottom border lines, up until helpTextStartX.
......@@ -504,7 +506,7 @@ function DrawQuoteWindowBottomBorder_DCTStyle(pEditLeft, pEditRight)
// Add the help text, then display the rest of the bottom border characters.
DrawQuoteWindowBottomBorder_DCTStyle.border += quoteHelpText
+ gConfigSettings.DCTColors.QuoteWinBorderColor;
for (var XPos = pEditLeft+2+strip_ctrl(quoteHelpText).length; XPos <= pEditRight-1; ++XPos)
for (var XPos = helpTextStartX + helpTextLen; XPos <= pEditRight-2; ++XPos)
DrawQuoteWindowBottomBorder_DCTStyle.border += HORIZONTAL_SINGLE;
DrawQuoteWindowBottomBorder_DCTStyle.border += LOWER_RIGHT_SINGLE;
}
......
......@@ -399,7 +399,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") + " ch2013 "
+ iceText("Copyright", "w") + " ch2014 "
+ 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
......@@ -491,19 +491,23 @@ function DrawQuoteWindowBottomBorder_IceStyle(pEditLeft, pEditRight)
gConfigSettings.iceColors.BorderColor1,
gConfigSettings.iceColors.BorderColor2)
+ gConfigSettings.iceColors.BorderColor2 + THIN_RECTANGLE_LEFT
+ gConfigSettings.iceColors.QuoteWinBorderTextColor + "^Q/ESC-End"
+ gConfigSettings.iceColors.QuoteWinBorderTextColor + "^Q/ESC=End"
+ gConfigSettings.iceColors.BorderColor2 + THIN_RECTANGLE_RIGHT
+ gConfigSettings.iceColors.BorderColor1 + HORIZONTAL_DOUBLE
+ gConfigSettings.iceColors.BorderColor2 + THIN_RECTANGLE_LEFT
+ gConfigSettings.iceColors.QuoteWinBorderTextColor + "CR-Accept"
+ gConfigSettings.iceColors.QuoteWinBorderTextColor + "CR=Accept"
+ gConfigSettings.iceColors.BorderColor2 + THIN_RECTANGLE_RIGHT
+ gConfigSettings.iceColors.BorderColor1 + HORIZONTAL_DOUBLE
+ gConfigSettings.iceColors.BorderColor2 + THIN_RECTANGLE_LEFT
+ gConfigSettings.iceColors.QuoteWinBorderTextColor + "Up/Down-Scroll"
+ gConfigSettings.iceColors.QuoteWinBorderTextColor + "Up/Down/PgUp/PgDn=Scroll"
+ gConfigSettings.iceColors.BorderColor2 + THIN_RECTANGLE_RIGHT
+ gConfigSettings.iceColors.BorderColor1 + HORIZONTAL_DOUBLE
+ gConfigSettings.iceColors.BorderColor2 + THIN_RECTANGLE_LEFT
+ gConfigSettings.iceColors.QuoteWinBorderTextColor + "F/L=First/Last pg"
+ gConfigSettings.iceColors.BorderColor2 + THIN_RECTANGLE_RIGHT;
// The border from here to the end of the line: Random high/low blue
var screenText = "";
for (var posX = pEditLeft + 43; posX <= pEditRight; ++posX)
for (var posX = pEditLeft + 73; posX <= pEditRight; ++posX)
screenText += HORIZONTAL_DOUBLE;
screenText += LOWER_RIGHT_VSINGLE_HDOUBLE;
DrawQuoteWindowBottomBorder_IceStyle.border += randomTwoColorString(screenText,
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment