Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
c422f6b0
Commit
c422f6b0
authored
1 year ago
by
Eric Oulashin
Committed by
Rob Swindell
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
DDMsgReader: Check console.aborted instead of ctrl-C keypress for aborting searching and scanning
parent
ab0a9995
No related branches found
No related tags found
2 merge requests
!463
MRC mods by Codefenix (2024-10-20)
,
!282
DDMsgReader: Check console.aborted instead of ctrl-C keypress for aborting searching and scanning
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xtrn/DDMsgReader/DDMsgReader.js
+18
-33
18 additions, 33 deletions
xtrn/DDMsgReader/DDMsgReader.js
with
18 additions
and
33 deletions
xtrn/DDMsgReader/DDMsgReader.js
+
18
−
33
View file @
c422f6b0
...
...
@@ -592,7 +592,7 @@ if (gDoDDMR)
js.on_exit("console.ctrlkey_passthru = " + console.ctrlkey_passthru);
// Set a control key pass-thru so we can capture certain control keys that we normally wouldn't be able to
var gOldCtrlKeyPassthru = console.ctrlkey_passthru; // Backup to be restored later
console.ctrlkey_passthru = "+A
C
GKLOPQRTUVWXYZ_";
console.ctrlkey_passthru = "+AGKLOPQRTUVWXYZ_";
// Create an instance of the DigDistMsgReader class and use it to read/list the
// messages in the user's current sub-board. Pass the parsed command-line
...
...
@@ -1927,7 +1927,6 @@ function DigDistMsgReader_SearchMessages(pSearchModeStr, pSubBoardCode, pScanSco
var subBoardsToScan = getSubBoardsToScanArray(pScanScopeChar);
this.doingMsgScan = true;
var continueScan = true;
var userAborted = false;
this.doingMultiSubBoardScan = (subBoardsToScan.length > 1);
// If the sub-board's access requirements allows the user to read it
// and it's enabled in the user's message scan configuration, then go
...
...
@@ -1936,17 +1935,11 @@ function DigDistMsgReader_SearchMessages(pSearchModeStr, pSubBoardCode, pScanSco
// sub-board:
//user.compare_ars(msg_area.grp_list[grpIndex].sub_list[subIndex].ars)
// Now using the can_read property.
for (var subCodeIdx = 0; (subCodeIdx < subBoardsToScan.length) && continueScan; ++subCodeIdx)
for (var subCodeIdx = 0; (subCodeIdx < subBoardsToScan.length) && continueScan
&& !console.aborted
; ++subCodeIdx)
{
// Briefly see if there's any input from the console to be received, and
// allow the user to use Ctrl-C to cancel the scan. Also, waiting momentarily
// here should help avoid causing CPU usage going to 99%
var userKeyInput = console.inkey(K_NOSPIN|K_NOCRLF|K_NOECHO, 20);
if (userKeyInput == CTRL_C)
{
userAborted = true;
break;
}
// Pause for a short moment to avoid causing CPU usage goign to 99%
mswait(10);
subCode = subBoardsToScan[subCodeIdx];
if (skipSubBoardScanCfgCheck || (msg_area.sub[subCode].can_read && ((msg_area.sub[subCode].scan_cfg & SCAN_CFG_NEW) == SCAN_CFG_NEW)))
{
...
...
@@ -1969,10 +1962,11 @@ function DigDistMsgReader_SearchMessages(pSearchModeStr, pSubBoardCode, pScanSco
}
}
this.subBoardCode = subBoardCodeBackup;
if (
userA
borted)
if (
console.a
borted)
{
console.p
utmsg
("\x01n" + this.text.msgSearchAbortedText + "\x01n");
console.p
rint
("\x01n" +
replaceAtCodesInStr(
this.text.msgSearchAbortedText
)
+ "\x01n");
console.crlf();
console.aborted = false; // So that the console.pause() a couple lines down will indeed pause
}
console.pause();
}
...
...
@@ -2490,7 +2484,7 @@ function DigDistMsgReader_MessageAreaScan(pScanCfgOpt, pScanMode, pScanScopeChar
var continueNewScan = true;
var userAborted = false;
this.doingMultiSubBoardScan = (subBoardsToScan.length > 1);
for (var subCodeIdx = 0; (subCodeIdx < subBoardsToScan.length) && continueNewScan; ++subCodeIdx)
for (var subCodeIdx = 0; (subCodeIdx < subBoardsToScan.length) && continueNewScan
&& !console.aborted
; ++subCodeIdx)
{
// Force garbage collection to ensure enough memory is available to continue
js.gc(true);
...
...
@@ -2641,16 +2635,8 @@ function DigDistMsgReader_MessageAreaScan(pScanCfgOpt, pScanMode, pScanScopeChar
msgbase.close();
}
}
// Briefly see if there's any input from the console to be received, and
// allow the user to use Ctrl-C to cancel the scan. Also, waiting momentarily
// here should help avoid causing CPU usage going to 99%
var userKeyInput = console.inkey(K_NOSPIN|K_NOCRLF|K_NOECHO, 20);
if (userKeyInput == CTRL_C)
{
userAborted = true;
break;
}
// Briefly wait, to prevent the CPU from reaching 99% usage
mswait(10);
}
this.doingMultiSubBoardScan = false;
...
...
@@ -2669,16 +2655,14 @@ function DigDistMsgReader_MessageAreaScan(pScanCfgOpt, pScanMode, pScanScopeChar
if (this.pauseAfterNewMsgScan)
{
console.crlf();
if (userAborted)
if (userAborted
|| console.aborted
)
{
//console.print("\x01n" + replaceAtCodesInStr(this.text.msgScanAbortedText) + "\x01n");
console.putmsg("\x01n" + this.text.msgScanAbortedText + "\x01n");
console.print("\x01n" + replaceAtCodesInStr(this.text.msgScanAbortedText) + "\x01n");
if (console.aborted)
console.aborted = false; // So that the console.pause() several lines down will indeed pause
}
else
{
//console.print("\x01n" + replaceAtCodesInStr(this.text.msgScanCompleteText) + "\x01n");
console.putmsg("\x01n" + this.text.msgScanCompleteText + "\x01n");
}
console.print("\x01n" + replaceAtCodesInStr(this.text.msgScanCompleteText) + "\x01n");
console.crlf();
console.pause();
}
...
...
@@ -16939,6 +16923,7 @@ function scrollTextLines(pTxtLines, pTopLineIdx, pTxtAttrib, pWriteTxtLines, pTo
attrCodes = getAttrsBeforeStrIdx(pTxtLines[lineIdx], pTxtLines[lineIdx].length-1);
}
var pMode = (typeof(pmode) === "number" ? pmode|P_NOATCODES : P_NOATCODES);
var writeTxtLines = pWriteTxtLines;
var continueOn = true;
var mouseInputOnly_continue = false;
...
...
@@ -16963,7 +16948,7 @@ function scrollTextLines(pTxtLines, pTopLineIdx, pTxtAttrib, pWriteTxtLines, pTo
{
console.gotoxy(pTopLeftX, screenY++);
// Print the text line, then clear the rest of the line
console.print(pTxtAttrib + pTxtLines[lineIdx],
typeof(pmode) === "number" ? pmode|P_NOATCODES : P_NOATCODES
);
console.print(pTxtAttrib + pTxtLines[lineIdx],
pMode
);
printf("\x01n%*s", pWidth-console.strlen(pTxtLines[lineIdx]), "");
}
// If there are still some lines left in the message reading area, then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment