• SlyEdit: More robust handling of console.getxy(). For issue #1371

    From Rob Swindell@VERT to GitLab note in main/sbbs on Tue Nov 24 19:42:09 2026
    https://gitlab.synchro.net/main/sbbs/-/merge_requests/751#note_11460

    Compared with the feedback on !749: the retries are gone, so an unresponsive terminal costs 5 s instead of 20, and there is no new trailing whitespace. Most callers now handle `false`, but two of the new guards are broken and a few call sites still aren't covered.

    **1. Uploading a message now always throws.** In `letUserUploadMessageFile()` (SlyEdit.js ~6759), the `originalCurpos = console.getxy();` line was removed rather than guarded. The else branch now tests `originalCurpos === false` on a variable that is still `undefined`. The only caller passes no argument (`if (letUserUploadMessageFile())`, line 2757). So the `console.gotoxy(originalCurpos)` at the end of the function gets `undefined` and throws the #1371 error ("invalid argument type") on every upload, whether or not the terminal answers.

    **2. The cross-post "can't post" message never shows.** In `createCrossPostSubBoardMenu()` (~5731), this line is unfinished:
    ```js
    if (origCurPos === false)
    origCurPos =
    writeCantPostErrMsg(..., origCurPos);
    ```
    JavaScript parses that as `if (origCurPos === false) origCurPos = writeCantPostErrMsg(...)`. When `getxy()` succeeds, the error message isn't displayed at all. When `getxy()` fails, `writeCantPostErrMsg()` receives `false`, and its own `console.gotoxy(pCurpos)` throws.

    **3. Still unhandled:**
    - `getUserInputWithSetOfInputStrs()` (slyedit_misc.js:3533) reads `curPos.x` right away. The caller at SlyEdit.js:5115 passes no position, so a failed `getxy()` throws a TypeError there.
    - `doUserSettings()` (6089) uses `originalCurpos.x` and `.y` without checking them. Today's callers pass a position, but the function's own `getxy()` fallback has the same gap.

    **4. Fallback position.** `{x: gEditLeft, y: gEditTop}` puts the cursor at the top-left of the edit area, while SlyEdit's line and column state still point somewhere else. The next keypress then appears in the wrong place on screen. Most of these functions are called from the edit loop, which already tracks `curpos` (it passes `curpos` to `doUserSettings` at line 1849). Passing that position in, or computing it from `gEditLinesIndex`, works better than calling `getxy()` at all.

    **5. Weak fallbacks in the DCT and ICE code:**
    - DCT `promptYesNo`: when `getxy()` fails, the yes/no box is no longer erased and the cursor stays inside it. A full redraw (`fpRedrawScreen`) would be a safer fallback.
    - ICE `redrawScreen_IceStyle`: the new early `return`s happen after `console.clear()`, so a failure leaves a half-drawn header and no message text. The padding only needs a space count computed from `console.strlen()` of the text already printed, which would remove all three `getxy()` calls.

    **6. Minor:**
    - slyedit_misc.js:1473: the new line is indented with tabs inside a block indented with 3 spaces.
    - SlyEdit.js:5328: `origStartingCurpos ={x:` is missing a space after the `=`. - `consoleGoLocation1ElseLocation2()` would read better as something like `gotoxyOrFallback(pos, fallback)`.

    -- *Authored by Claude (Claude Code), on behalf of @rswindell*

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab note in main/sbbs on Wed Nov 25 11:19:59 2026
    https://gitlab.synchro.net/main/sbbs/-/merge_requests/751#note_11475

    Re-reviewed 47e92600 (bb41fd33 is the master merge and doesn't touch SlyEdit).

    **Fixed (points 1-3 above):**
    - Upload: `letUserUploadMessageFile()` calls `console.getxy()` again and falls back when it fails. Uploading no longer throws.
    - Cross-post: the unfinished `origCurPos =` line now assigns the fallback, so the "can't post" message shows again.
    - `getUserInputWithSetOfInputStrs()` and `doUserSettings()` now check the position passed in and handle `false` from `getxy()`.

    **New nits:**
    - `originalCurpos = originalCurpos = {x: gEditLeft, y: gEditTop};` assigns twice (SlyEdit.js ~6097 and ~6774).
    - The old line is left in as a comment (`//const originalCurpos = ...`) in `doUserSettings()`. Git history keeps it, so it can go.

    **Not addressed (points 4-6):**
    - The fallback is still the top-left of the edit area, not the position the edit loop already tracks. After a failure, the cursor no longer matches SlyEdit's own position.
    - The DCT yes/no box still isn't erased when `getxy()` fails.
    - The ICE redraw still returns early after `console.clear()`, which leaves a half-drawn header and no message text.
    - The tab indentation at slyedit_misc.js:1473, the `={x:` spacing, and the helper name haven't changed.

    All the remaining issues only happen when the terminal doesn't answer the cursor-position query. The result is a misplaced cursor or a messy screen, not a script error. Merging as is would be reasonable, with 4 and 5 as a follow-up.

    -- *Authored by Claude (Claude Code), on behalf of @rswindell*

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab note in main/sbbs on Mon Nov 30 00:00:41 2026
    https://gitlab.synchro.net/main/sbbs/-/merge_requests/751#note_11524

    Re-reviewed 958a8299 and 070f41cc. Everything still open from the earlier reviews is resolved:

    - The fallback is now the edit loop's tracked position (`gCurPos`, shared with `doEditLoop()`'s `curpos`) instead of the top-left of the edit area, and `curpos` is passed to `doCrossPosting()`, `listTextReplacements()` and `letUserUploadMessageFile()`.
    - The DCT yes/no box is erased even when `getxy()` fails.
    - The ICE header redraw no longer calls `getxy()`; the padding computed from `console.strlen()` matches the old loop.
    - The new `xyPosValid()` / `consoleGetXY()` / `consoleGotoXY()` helpers replace the repeated checks, and the earlier nits (double assignment, commented-out line, tab indentation, `={x:` spacing, helper name) are fixed.

    The remaining `console.getxy()` calls all handle `false`. Looks good to merge.

    One trivial thing: `docs/slyedit_readme.txt` gives the release date as 2026-11-24, while `EDITOR_VER_DATE` is now 2026-11-27.

    *Authored by Claude (Claude Code), on behalf of @rswindell*

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net