• Stock List Files module: built-in lister look, plus lightbar, nav keys

    From Rob Swindell@1:103/705 to GitLab issue in main/sbbs on Sun Nov 15 17:21:07 2026
    open https://gitlab.synchro.net/main/sbbs/-/work_items/1353

    ## Summary

    Add a stock JavaScript "List Files" loadable module that reproduces the built-in (C++) file lister's output and behavior, and adds lightbar selection, navigation keys, and real pagination.

    Synchronet already has the hook: when a List Files module is configured in SCFG, the Terminal Server runs it in place of the built-in lister, passing the directory's internal code, the listing mode flags, and the file specification. No stock module currently fills that slot.

    ## Motivation

    The built-in lister prints files as a scrolling stream. With batch flagging enabled, it stops each screenful at a prompt and asks the user to type the letters (A-Z) of the files to act on. That has limits:

    - There is no way to move a highlight to a file and act on it; every action is "type a letter, then answer a prompt".
    - Paging is forward-biased. "Previous" re-lists from an earlier point rather than redrawing a stable page.
    - Extended descriptions make the number of files per screen unpredictable, so the letter assigned to a file changes as the user pages.
    - Screen housekeeping between directories and around the prompt is done with hard-coded line breaks, which is where cosmetic bugs such as doubled or missing blank lines come from.

    ## Proposed behavior

    - **Same look by default.** Directory headers (the short header in scans, the boxed header or the directory's `.hdr` file otherwise), the file line layout, extended descriptions, colors, and the configurable text strings should match the built-in lister, so a sysop who enables the module sees a familiar listing.
    - **Lightbar.** A highlight bar on the current file, moved with the Up/Down arrow keys.
    - **Navigation keys.** Page Up/Page Down, Home/End, and the existing letter and command keys (Download, Batch, View, Extended info, Previous, Quit, and the operator Remove/Move commands).
    - **Pagination.** Fixed pages that redraw in place, a visible "page n of m" or "files x-y of z" indicator, and backward paging that returns to exactly the previous page.
    - **Tagging.** Space bar (or similar) to tag multiple files on a page for batch download, in addition to typing letters.
    - **Mouse.** Clickable file entries and command keys on terminals that support it, as the built-in lister offers today.
    - **All listing modes.** Plain listing, new-file scans, filename/description searches, and extended-info/view listings, driven by the same mode flags the built-in lister receives, and returning the same result (number of files listed, or aborted) so multi-directory scans keep working.

    ## Open questions

    - **When should the interactive mode apply?** One option is to use lightbar and pagination only for users with batch flagging enabled, and emulate the plain scrolling listing for everyone else, since batch flagging is already the "stop and interact at each screen" setting. The alternative is a separate user or sysop setting.
    - **Non-ANSI terminals.** Lightbar needs cursor positioning; the module should fall back to the scrolling, letter-prompt behavior on terminals without it.
    - **Multi-directory scans.** How the transition between directories is presented (one continuous paged list, or a page break per directory).
    - **Shared code.** Whether to build on the existing stock `select_item.js` / `menubar.js` libraries, as the Scan Config module (`scancfg.js`) does.

    — *Authored by Claude (Claude Code), on behalf of @rswindell*
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Tue Nov 17 18:34:06 2026
    https://gitlab.synchro.net/main/sbbs/-/work_items/1353#note_11054

    ## Design note: sysop customization

    Goal: good customization options for sysops (custom headers per directory, per library, or globally) and as few hard-coded UI elements as possible.

    ### What the built-in lister hard-codes today (listfile.cpp)

    - Header: only one override, the per-directory `data/dirs/<code>.hdr`. No library-level or global header file.
    - Box header: the CP437 box characters and width math are in the code; only the three inner lines come from text.dat (`BoxHdrLib`, `BoxHdrDir`, `BoxHdrFiles`).
    - Short header: the underline is a fixed `\xC4` run.
    - File line: fixed column order and widths (name 12, size 6 or 7), the `+` extended-description marker, the `-` missing-file marker, the batch letter attribute, and the FREE blink.
    - Colors: the global SCFG `clr_file*` entries only.

    ### Headers and footers: the bbs.menu() lookup chain

    Use `bbs.menu()` / `bbs.menu_exists()` as `xtrn_sec.js` does, so every header file gets terminal-type variants (.ans/.asc/.utf8/.rip...), width variants, language overlays, `mods/` shadowing and @-codes for free. Most specific wins:

    1. `data/dirs/<code>.hdr` (existing; kept for compatibility)
    2. `text/menu/filelist_<dircode>_head` (one directory)
    3. `filelist_lib<N>_head` or a library-name form (one library; libraries have no internal code)
    4. `filelist_head` (global)
    5. Otherwise, the built-in box header, drawn from configurable strings

    A matching `_tail` chain, plus an optional `filelist_page` file for the area above each page. Header files can use the existing `@LIB@`, `@LIBL@`, `@DIR@`, `@DIRL@` and `@FILES@` codes.

    ### File line: an @-code template

    The file line is a template of @-codes with the standard format modifiers, e.g.:

    @FILE_NAME-L12@@FLAGS@@LETTER@@FILE_SIZE-R7@ @FILE_DESC->@

    - The `@FILE_*@` codes already exist (`FILE_NAME`, `FILE_DESC`, `FILE_SIZE`, `FILE_BYTES`, `FILE_CREDITS`, `FILE_DATE`, `FILE_UPLOADER`, `FILE_TIMES_DLED`, `FILE_TAGS`, ...), and `formatted_atcode()` already applies the width/alignment modifiers (`-L`/`-R`/`-C`, `-Z`, `-T`, `-U`/`-D`, `->`, and the `|` form). Columns can be reordered, resized, added or dropped without code changes, and any `@FILE_*@` code added later is usable in the lister for free.
    - Default template reproduces today's layout.
    - Lister-specific codes, substituted by the module before expansion (same modifier syntax): `@LETTER@` (batch letter), `@TAG@` (tagged/untagged marker), `@FLAGS@` (extended-description and missing-file markers), and a FREE-aware size code.
    - Extended descriptions print below the line as today, not through the template.
    - Search-term highlighting is applied by the module to the expanded description.

    Prerequisite (C++): those codes resolve only while `sbbs_t::current_file` is set, which today happens only in `showfileinfo()`. Extend `bbs.expand_atcodes(string [,obj])` to accept a FileBase file object (in addition to a message header object) and make it the current file for the duration of the call, as is already done for messages.

    ### Everything else: [filelist] in modopts.ini

    - Markers: extended-description, missing-file, FREE, tagged/untagged, batch-letter attributes.
    - Lightbar: `selected_item_prefix` / `unselected_item_prefix` / `selected_item_attr` / `lightbar`, the same keys as `[xtrn_sec]`, `[text_sec]` and `[scancfg]`.
    - Box header characters (top/side/corner strings), so plain-ASCII or UTF-8 boxes need no code change.
    - Short-header underline character.
    - Page indicator (`more_fmt`), command prompt, and the spacing between directories (replacing the hard-coded line breaks behind the doubled/missing blank-line bugs).
    - Colors: default to the SCFG `clr_file*` values, each overridable.
    - Existing text.dat strings remain the defaults, so `text.ini` overrides and translations keep working.

    Per-library and per-directory option overrides: `[filelist:<dircode>]` and `[filelist:lib<N>]` sections (mirroring `[uselect:<title>]`). ARS sections in `ctrl/modopts/filelist.ini` are not enough on their own: ARS `LIB`/`DIR` test the user's *current* area, while a multi-directory scan lists areas the user is not in.

    - *Authored by Claude (Claude Code), on behalf of @rswindell*
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Tue Nov 17 18:42:50 2026
    https://gitlab.synchro.net/main/sbbs/-/work_items/1353#note_11055

    ## Decisions on the open questions

    1. **Interactive mode** (lightbar, pagination, tagging) applies when the user has batch flagging enabled. Without batch flagging, the module emulates the plain scrolling listing.
    2. **Fallback** to the scrolling letter-prompt behavior is only for dumb terminals (no cursor positioning). PETSCII terminals can position the cursor and get the lightbar UI.
    3. **Multi-directory scans** start a new page for each directory that has files to list. A directory with no matching files displays nothing.
    4. **Shared code:** reuse parts of `select_item.js` / `menubar.js` where they fit (e.g. the move-destination lists, per #1351), but that's not a requirement.

    Naming: `exec/filelist.js` already exists (a file-list export utility), so the module will be `exec/listfiles.js`, its options section `[listfiles]` in `modopts.ini`, and its menu files `listfiles_*` (in place of the `filelist` names used in the design note above).

    - *Authored by Claude (Claude Code), on behalf of @rswindell*
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell@1:103/705 to GitLab note in main/sbbs on Tue Nov 17 18:51:19 2026
    https://gitlab.synchro.net/main/sbbs/-/work_items/1353#note_11055

    ## Decisions on the open questions

    1. **Interactive mode** (lightbar, pagination, tagging) applies when the user has batch flagging enabled. Without batch flagging, the module emulates the plain scrolling listing.
    2. **Fallback** to the scrolling letter-prompt behavior is only for dumb terminals (no cursor positioning). PETSCII terminals can position the cursor and get the lightbar UI.
    3. **Multi-directory scans:** with batch flagging enabled (interactive mode), each directory that has files to list starts a new page. Without batch flagging, a new directory does not start a new page; the listing continues as the built-in lister's does. In either case, a directory with no matching files displays nothing.
    4. **Shared code:** reuse parts of `select_item.js` / `menubar.js` where they fit (e.g. the move-destination lists, per #1351), but that's not a requirement.

    Naming: `exec/filelist.js` already exists (a file-list export utility), so the module will be `exec/listfiles.js`, its options section `[listfiles]` in `modopts.ini`, and its menu files `listfiles_*` (in place of the `filelist` names used in the design note above).

    - *Authored by Claude (Claude Code), on behalf of @rswindell*
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)