Skip to content
Snippets Groups Projects
Commit 49f327b5 authored by Eric Oulashin's avatar Eric Oulashin Committed by Rob Swindell
Browse files

SlyEdit: For quote lines, a small tweak for long line (>120 character) adding...

SlyEdit: For quote lines, a small tweak for long line (>120 character) adding a CRLF for paragraph formatting
parent 4d278c3f
No related branches found
No related tags found
2 merge requests!463MRC mods by Codefenix (2024-10-20),!313SlyEdit: For quote lines, a small tweak for long line (>120 character) adding a CRLF for paragraph formatting
...@@ -2906,10 +2906,10 @@ function wrapTextLinesForQuoting(pTextLines, pQuotePrefix, pIndentQuoteLines, pT ...@@ -2906,10 +2906,10 @@ function wrapTextLinesForQuoting(pTextLines, pQuotePrefix, pIndentQuoteLines, pT
// Get the length of the current line (if it needs wrapping, then wrap it & get the // Get the length of the current line (if it needs wrapping, then wrap it & get the
// length of the last line after wrapping), so that if that length is short, we might // length of the last line after wrapping), so that if that length is short, we might
// put a CRLF at the end to signify the end of the paragraph/section // put a CRLF at the end to signify the end of the paragraph/section
var lineLength = 0; var lineLastLength = 0;
var currentLineScreenLen = console.strlen(pTextLines[textLineIdx]); var currentLineScreenLen = console.strlen(pTextLines[textLineIdx]);
if (currentLineScreenLen < console.screen_columns - 1) if (currentLineScreenLen < console.screen_columns - 1)
lineLength = currentLineScreenLen; lineLastLength = currentLineScreenLen;
else else
{ {
var currentLine = pTextLines[textLineIdx]; var currentLine = pTextLines[textLineIdx];
...@@ -2917,14 +2917,17 @@ function wrapTextLinesForQuoting(pTextLines, pQuotePrefix, pIndentQuoteLines, pT ...@@ -2917,14 +2917,17 @@ function wrapTextLinesForQuoting(pTextLines, pQuotePrefix, pIndentQuoteLines, pT
currentLine = currentLine.trim(); currentLine = currentLine.trim();
var paragraphLines = lfexpand(word_wrap(currentLine, console.screen_columns-1, null, true)).split("\r\n"); var paragraphLines = lfexpand(word_wrap(currentLine, console.screen_columns-1, null, true)).split("\r\n");
paragraphLines.pop(); // There will be an extra empty line at the end; remove it paragraphLines.pop(); // There will be an extra empty line at the end; remove it
lineLength = console.strlen(paragraphLines[paragraphLines.length-1]); if (paragraphLines.length > 0)
lineLastLength = console.strlen(paragraphLines[paragraphLines.length-1]);
} }
// Put a CRLF at the end in certain conditions // Put a CRLF at the end in certain conditions
if (nextLineIsOriginOrTearLine) if (nextLineIsOriginOrTearLine)
sectionText += "\r\n"; sectionText += "\r\n";
// Append a CRLF if the line isn't blank and its length is less than 85% of the user's terminal width // Append a CRLF if the line isn't blank and its length is less than 85% of the user's terminal width
//else if (numLinesInSection > 1 && !nextLineIsBlank && console.strlen(pTextLines[textLineIdx]) < Math.floor(console.screen_columns * 0.85)) //else if (numLinesInSection > 1 && !nextLineIsBlank && console.strlen(pTextLines[textLineIdx]) < Math.floor(console.screen_columns * 0.85))
else if (numLinesInSection > 1 && !nextLineIsBlank && lineLength < Math.floor(console.screen_columns * 0.85)) // ..and also if the text line is originally over 120 characters (a bit arbitrary, but if a line is that long, then
// it's probably its own paragraph
else if (numLinesInSection > 1 && !nextLineIsBlank && lineLastLength < Math.floor(console.screen_columns * 0.85) && console.strlen(pTextLines[textLineIdx]) > 120)
sectionText += "\r\n"; sectionText += "\r\n";
else if (nextLineIsBlank) else if (nextLineIsBlank)
sectionText += "\r\n"; sectionText += "\r\n";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment