diff --git a/xtrn/ddfilelister/ddfilelister.js b/xtrn/ddfilelister/ddfilelister.js index edf9dc69ed6ceee73a5f2255a309c6c8547e3fe3..600f61fd3b76de6354bade0bf3f800fec6cd1033 100644 --- a/xtrn/ddfilelister/ddfilelister.js +++ b/xtrn/ddfilelister/ddfilelister.js @@ -43,6 +43,10 @@ * Fix for "fileDesc is not defined" error when displaying * the file description on the main screen. Also made a * 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") @@ -98,8 +102,8 @@ if (system.version_num < 31900) } // Lister version information -var LISTER_VERSION = "2.05a"; -var LISTER_DATE = "2022-03-13"; +var LISTER_VERSION = "2.06"; +var LISTER_DATE = "2022-04-13"; /////////////////////////////////////////////////////////////////////////////// @@ -2128,9 +2132,14 @@ function createFileListMenu(pQuitKeys) return Object.keys(this.selectedItemIndexes).length; }; - // OnItemNav function for when the user navigates to a new item - fileListMenu.OnItemNav = function(pOldItemIdx, pNewItemIdx) { - displayFileExtDescOnMainScreen(pNewItemIdx); + // 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) { + displayFileExtDescOnMainScreen(pNewItemIdx); + }; } return fileListMenu; @@ -3656,22 +3665,34 @@ function displayFileExtDescOnMainScreen(pFileIdx, pStartScreenRow, pEndScreenRow { if (screenRowForPrinting > screenRowNum++) continue; - console.gotoxy(startX, screenRowForPrinting++); // Note: substrWithAttrCodes() is defined in dd_lightbar_menu.js // Normally it would be handy to use printf() to print the text line: //printf(formatStr, substrWithAttrCodes(fileDescArray[i], 0, maxDescLen)); // However, printf() doesn't account for attribute codes and thus may not // fill the rest of the width. So, we do that manually. var descLine = substrWithAttrCodes(fileDescArray[i], 0, maxDescLen); - console.print(descLine); - var remainingLen = maxDescLen - console.strlen(descLine); - if (remainingLen > 0) - printf("%" + remainingLen + "s", ""); + var lineTextLength = console.strlen(descLine); + if (lineTextLength > 0) + { + console.gotoxy(startX, screenRowForPrinting++); + console.print(descLine); + var remainingLen = maxDescLen - lineTextLength; + if (remainingLen > 0) + printf("%" + remainingLen + "s", ""); + } // Stop printing the description lines when we reach the last line on // the screen where we want to print. if (screenRowForPrinting > lastScreenRow) 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 console.print("\1n"); while (screenRowForPrinting <= lastScreenRow) diff --git a/xtrn/ddfilelister/readme.txt b/xtrn/ddfilelister/readme.txt index 1842252b213e0a461e7cc1e942754d5df6bcc2b4..94eebff6b4923e30d824f8031b654cfd39b20081 100644 --- a/xtrn/ddfilelister/readme.txt +++ b/xtrn/ddfilelister/readme.txt @@ -1,6 +1,6 @@ Digital Distortion File Lister - Version 2.05a - Release date: 2022-03-13 + Version 2.06 + Release date: 2022-04-13 by diff --git a/xtrn/ddfilelister/revision_history.txt b/xtrn/ddfilelister/revision_history.txt index 99fc0c0b7e6c47ad902cfc46157ca933b76587a8..262568367956a6df06cc109d04c4bff74a099b9a 100644 --- a/xtrn/ddfilelister/revision_history.txt +++ b/xtrn/ddfilelister/revision_history.txt @@ -5,6 +5,8 @@ Revision History (change log) ============================= 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 the file description on the main screen. 2.05 2022-03-12 Now makes use of the user's extended file description