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

DDMsgReader: Allow word-wrapping header lines of arbitrary length

parent bb482869
No related branches found
No related tags found
2 merge requests!463MRC mods by Codefenix (2024-10-20),!287DDMsgReader: Allow word-wrapping header lines of arbitrary length
...@@ -12722,7 +12722,7 @@ function DigDistMsgReader_GetExtdMsgHdrInfo(pMsgHdr, pKludgeOnly) ...@@ -12722,7 +12722,7 @@ function DigDistMsgReader_GetExtdMsgHdrInfo(pMsgHdr, pKludgeOnly)
if ((lastHdrFieldLabel == null) || (hdrFieldLabel != lastHdrFieldLabel)) if ((lastHdrFieldLabel == null) || (hdrFieldLabel != lastHdrFieldLabel))
{ {
msgHdrInfoLines.push(""); msgHdrInfoLines.push("");
msgHdrInfoLines.push(hdrFieldLabel + "!"); msgHdrInfoLines.push(hdrFieldLabel);
} }
var infoLineWrapped = msgHdr.field_list[fieldI].data; var infoLineWrapped = msgHdr.field_list[fieldI].data;
var infoLineWrappedArray = lfexpand(infoLineWrapped).split("\r\n"); var infoLineWrappedArray = lfexpand(infoLineWrapped).split("\r\n");
...@@ -12868,24 +12868,18 @@ function DigDistMsgReader_GetExtdMsgHdrInfo(pMsgHdr, pKludgeOnly) ...@@ -12868,24 +12868,18 @@ function DigDistMsgReader_GetExtdMsgHdrInfo(pMsgHdr, pKludgeOnly)
   
// Make sure the header lines aren't too long for the user's terminal. // Make sure the header lines aren't too long for the user's terminal.
// Leave a column for the scrollbar. // Leave a column for the scrollbar.
// Note: substrWithAttrCodes(pStr, pStartIdx, pLen) is defined in dd_lightbar_menu.js var maxLen = console.screen_columns - 1;
var hdrInfoLinesWrapped = [];
for (var i = 0; i < msgHdrInfoLines.length; ++i) for (var i = 0; i < msgHdrInfoLines.length; ++i)
{ {
var maxLen = console.screen_columns - 1; var wrappedLines = word_wrap(msgHdrInfoLines[i], maxLen).split("\n");
var strLen = console.strlen(msgHdrInfoLines[i]); for (var wrappedI = 0; wrappedI < wrappedLines.length; ++wrappedI)
if (console.strlen(msgHdrInfoLines[i]) > maxLen)
{ {
// This assumes the line will probably not span more than 2 lines after if (console.strlen(wrappedLines[wrappedI]) > 0)
// being split hdrInfoLinesWrapped.push(wrappedLines[wrappedI]);
var line1 = substrWithAttrCodes(msgHdrInfoLines[i], 0, maxLen);
var line2 = substrWithAttrCodes(msgHdrInfoLines[i], maxLen, maxLen);
msgHdrInfoLines[i] = line1;
msgHdrInfoLines.splice(i+1, 0, line2);
++i;
} }
} }
return hdrInfoLinesWrapped;
return msgHdrInfoLines;
} }
   
// For the DigDistMsgReader class: Gets & prepares message information for // For the DigDistMsgReader class: Gets & prepares message information for
...@@ -21344,7 +21338,6 @@ function quickValidateLocalUser(pUsername, pUseANSI, pQuickValSetIdx) ...@@ -21344,7 +21338,6 @@ function quickValidateLocalUser(pUsername, pUseANSI, pQuickValSetIdx)
return retObj; return retObj;
   
var useANSI = typeof(pUseANSI) === "boolean" ? pUseANSI : console.term_supports(USER_ANSI); var useANSI = typeof(pUseANSI) === "boolean" ? pUseANSI : console.term_supports(USER_ANSI);
//useANSI = false; // Temporary
   
var userNum = system.matchuser(pUsername); var userNum = system.matchuser(pUsername);
if (userNum == 0) if (userNum == 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment