Skip to content
Snippets Groups Projects
Commit d61cc103 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Merge branch 'dd_file_area_chooser_dir_collapsing_lightbar_loop_fix' into 'master'

DD File Area Chooser fix for directory collapsing mode when using the lightbar interface.

See merge request !301
parents 5662bedf 4d5eac44
No related branches found
No related tags found
2 merge requests!463MRC mods by Codefenix (2024-10-20),!301DD File Area Chooser fix for directory collapsing mode when using the lightbar interface.
......@@ -52,6 +52,10 @@
* 2023-05-14 Eric Oulashin Version 1.35
* Refactored the configuration reading code.
* Fix: Displays correct file counts in directories when using directory name collapsing
* 2023-07-21 Eric Oulashin Version 1.36
* Fix for directory collapsing mode with the lightbar interface: It now exits
* when the user chooses their same file directory instead of continuing the
* menu input loop.
*/
// TODO: Failing silently when 1st argument is true
......@@ -92,8 +96,8 @@ if (system.version_num < 31400)
}
// Version & date variables
var DD_FILE_AREA_CHOOSER_VERSION = "1.35";
var DD_FILE_AREA_CHOOSER_VER_DATE = "2023-05-14";
var DD_FILE_AREA_CHOOSER_VERSION = "1.36";
var DD_FILE_AREA_CHOOSER_VER_DATE = "2023-07-21";
// Keyboard input key codes
var CTRL_H = "\x08";
......@@ -1059,8 +1063,8 @@ function DDFileAreaChooser_SelectFileArea_Lightbar(pLevel, pLibIdx, pDirIdx, pCa
// 3: Choose a subdirectory within a directory, for directory name collapsing
else if ((level == 2) || (level == 3))
{
if (typeof(pLibIdx) != "number")
return;
// If there are no directories in the given library index, then see if there's a next library with
// directories (and wrap around)
if (file_area.lib_list[pLibIdx].dir_list.length == 0)
{
console.clear("\x01n");
......@@ -1386,6 +1390,14 @@ function DDFileAreaChooser_SelectFileArea_Lightbar(pLevel, pLibIdx, pDirIdx, pCa
// enabled)
var dirCodeBackup = bbs.curdir_code;
var chosenFileDirIdx = this.SelectFileArea_Lightbar(level+1, chosenIdx, null, true);
// chosenFileDirIdx could actually be a boolean and could be false (returned
// when pLevel is 3 and the user chose a directory), so check its type and
// act accordingly.
var retValType = typeof(chosenFileDirIdx);
if (retValType === "boolean")
continueOn = chosenFileDirIdx;
else if (retValType === "number")
{
if (chosenFileDirIdx > -1)
{
// Set the current file directory
......@@ -1410,6 +1422,7 @@ function DDFileAreaChooser_SelectFileArea_Lightbar(pLevel, pLibIdx, pDirIdx, pCa
}
}
}
}
else if (level == 2)
{
if (this.useDirCollapsing)
......@@ -1427,10 +1440,12 @@ function DDFileAreaChooser_SelectFileArea_Lightbar(pLevel, pLibIdx, pDirIdx, pCa
if (chosenSubdirIdx > -1)
{
// Set the current file directory
// TODO: This doesn't seem to be exiting, it's just
// going back to the library menu
bbs.curdir_code = this.lib_list[pLibIdx].dir_list[chosenIdx].subdir_list[chosenSubdirIdx].code;
continueOn = false;
// Return a false here so that after this function is called by itself when
// pLevel is 2, it will know that a sub-board has been chosen and will set
// continueOn to false so that the loop won't continue from there.
return false;
}
else
{
......@@ -2826,3 +2841,35 @@ function attrCodeStr(pAttrCodeCharStr)
return str;
}
// Finds the index of a file library AFTER the given library index which contains
// directories. If there are none, this will return -1.
//
// Parameters:
// pLibIdx: An index of a file library; this function will start searching AFTER this one
//
// Return value: An index of a file library after the given group index that contains directories,
// or -1 if there are none
function findNextLibIdxWithDirs(pLibIdx)
{
if (typeof(pLibIdx) !== "number")
return -1;
var nextLibIdx = -1;
//file_area.lib_list[pLibIdx].dir_list
if (pLibIdx < file_area.lib_list.length - 1)
{
for (var i = pLibIdx + 1; i < file_area.lib_list.length && nextLibIdx == -1; ++i)
{
if (file_area.lib_list[i].dir_list.length > 0)
nextLibIdx = i;
}
}
if (nextLibIdx == -1 && pLibIdx > 0)
{
for (var i = 0; i < pLibIdx && nextLibIdx == -1; ++i)
{
if (file_area.lib_list[i].dir_list.length > 0)
nextLibIdx = i;
}
}
return nextLibIdx;
}
Digital Distortion Area Choosers
Version 1.35
Release date: 2023-05-14
Version 1.36
Release date: 2023-07-21
by
......
......@@ -5,6 +5,11 @@ Revision History (change log)
=============================
Version Date Description
------- ---- -----------
1.36 2023-07-21 Message area chooser fix for not allowing to change sub-
board if the first group is empty. File area chooser fix:
When using directory collapsing mode with the lightbar
interface, it now exits when the user chooses their same
file directory instead of continuing the menu input loop.
1.35 2023-05-14 File area chooser fix: Displays correct file counts in
directories when using directory name collapsing.
Both: Internal refactor for the code that reads the
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment