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

Merge branch 'ddfilelister_exted_desc_file_dates' into 'master'

DDFileLister: Dates shown in file desriptions when extended descriptions are enabled.

See merge request !169
parents 414d34ec cfeb22f9
No related branches found
No related tags found
2 merge requests!463MRC mods by Codefenix (2024-10-20),!169DDFileLister: Dates shown in file desriptions when extended descriptions are enabled.
Pipeline #2983 passed
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
* Fix for "fileDesc is not defined" error when displaying * Fix for "fileDesc is not defined" error when displaying
* the file description on the main screen. Also made a * the file description on the main screen. Also made a
* small refactor to the main screen refresh function. * small refactor to the main screen refresh function.
* 2022-04-13 Eric Oulashin Version 2.06
* When extended file descriptions are enabled, the file
* date is now shown with the file description on the last
* line.
*/ */
if (typeof(require) === "function") if (typeof(require) === "function")
...@@ -98,8 +102,8 @@ if (system.version_num < 31900) ...@@ -98,8 +102,8 @@ if (system.version_num < 31900)
} }
// Lister version information // Lister version information
var LISTER_VERSION = "2.05a"; var LISTER_VERSION = "2.06";
var LISTER_DATE = "2022-03-13"; var LISTER_DATE = "2022-04-13";
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
...@@ -2128,9 +2132,14 @@ function createFileListMenu(pQuitKeys) ...@@ -2128,9 +2132,14 @@ function createFileListMenu(pQuitKeys)
return Object.keys(this.selectedItemIndexes).length; return Object.keys(this.selectedItemIndexes).length;
}; };
// OnItemNav function for when the user navigates to a new item // If extended file descriptions are enabled, set the OnItemNav function for
// when the user navigates to a new item, to display the file description
// next to the file menu.
if (extendedDescEnabled())
{
fileListMenu.OnItemNav = function(pOldItemIdx, pNewItemIdx) { fileListMenu.OnItemNav = function(pOldItemIdx, pNewItemIdx) {
displayFileExtDescOnMainScreen(pNewItemIdx); displayFileExtDescOnMainScreen(pNewItemIdx);
};
} }
return fileListMenu; return fileListMenu;
...@@ -3656,22 +3665,34 @@ function displayFileExtDescOnMainScreen(pFileIdx, pStartScreenRow, pEndScreenRow ...@@ -3656,22 +3665,34 @@ function displayFileExtDescOnMainScreen(pFileIdx, pStartScreenRow, pEndScreenRow
{ {
if (screenRowForPrinting > screenRowNum++) if (screenRowForPrinting > screenRowNum++)
continue; continue;
console.gotoxy(startX, screenRowForPrinting++);
// Note: substrWithAttrCodes() is defined in dd_lightbar_menu.js // Note: substrWithAttrCodes() is defined in dd_lightbar_menu.js
// Normally it would be handy to use printf() to print the text line: // Normally it would be handy to use printf() to print the text line:
//printf(formatStr, substrWithAttrCodes(fileDescArray[i], 0, maxDescLen)); //printf(formatStr, substrWithAttrCodes(fileDescArray[i], 0, maxDescLen));
// However, printf() doesn't account for attribute codes and thus may not // However, printf() doesn't account for attribute codes and thus may not
// fill the rest of the width. So, we do that manually. // fill the rest of the width. So, we do that manually.
var descLine = substrWithAttrCodes(fileDescArray[i], 0, maxDescLen); var descLine = substrWithAttrCodes(fileDescArray[i], 0, maxDescLen);
var lineTextLength = console.strlen(descLine);
if (lineTextLength > 0)
{
console.gotoxy(startX, screenRowForPrinting++);
console.print(descLine); console.print(descLine);
var remainingLen = maxDescLen - console.strlen(descLine); var remainingLen = maxDescLen - lineTextLength;
if (remainingLen > 0) if (remainingLen > 0)
printf("%" + remainingLen + "s", ""); printf("%" + remainingLen + "s", "");
}
// Stop printing the description lines when we reach the last line on // Stop printing the description lines when we reach the last line on
// the screen where we want to print. // the screen where we want to print.
if (screenRowForPrinting > lastScreenRow) if (screenRowForPrinting > lastScreenRow)
break; break;
} }
// If there is room, shoe the file date on the next line
if (screenRowForPrinting <= lastScreenRow && fileMetadata.hasOwnProperty("time"))
{
console.print("\1n");
console.gotoxy(startX, screenRowForPrinting++);
var dateStr = "Date: " + strftime("%Y-%m-%d", fileMetadata.time);
printf("%-" + maxDescLen + "s", dateStr.substr(0, maxDescLen));
}
// Clear the rest of the lines to the bottom of the list area // Clear the rest of the lines to the bottom of the list area
console.print("\1n"); console.print("\1n");
while (screenRowForPrinting <= lastScreenRow) while (screenRowForPrinting <= lastScreenRow)
......
Digital Distortion File Lister Digital Distortion File Lister
Version 2.05a Version 2.06
Release date: 2022-03-13 Release date: 2022-04-13
by by
......
...@@ -5,6 +5,8 @@ Revision History (change log) ...@@ -5,6 +5,8 @@ Revision History (change log)
============================= =============================
Version Date Description Version Date Description
------- ---- ----------- ------- ---- -----------
2.06 2022-04-13 When extended file descriptions are enabled, the file date
is now shown with the file description on the last line.
2.05a 2022-03-13 Fix for "fileDesc is not defined" error when displaying 2.05a 2022-03-13 Fix for "fileDesc is not defined" error when displaying
the file description on the main screen. the file description on the main screen.
2.05 2022-03-12 Now makes use of the user's extended file description 2.05 2022-03-12 Now makes use of the user's extended file description
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment