• fseditor.js: don't dereference line[l+1] after splice in unwrap_line

    From Steven Philley@1:103/705 to GitLab note in main/sbbs on Thu Sep 10 13:34:01 2026
    https://gitlab.synchro.net/main/sbbs/-/merge_requests/731#note_10298

    ```suggestion:-2+3
    if(line[l+1]==undefined)
    line.push(new Line);
    else {
    ```
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Fri Sep 11 04:43:21 2026
    https://gitlab.synchro.net/main/sbbs/-/merge_requests/731#note_10307

    Is there a set of steps to reproduce this issue so it can be confirmed as fixed?
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Steven Philley@1:103/705 to GitLab note in main/sbbs on Fri Sep 11 09:43:34 2026
    https://gitlab.synchro.net/main/sbbs/-/merge_requests/731#note_10312

    Deuce: yes — here's a focused repro for #1183 / this MR.

    **Original crash (production):** full-screen editor (`fseditor.js`) threw `TypeError: line[l + 1] is undefined` in `unwrap_line()` (reported on cvs.synchro.net, Node 12, user Cru Jones). Root cause in the issue: the unkludge path can `splice()` out `line[l+1]` mid-loop, then the "get first word(s) of next line" step still reads `line[l+1].text` with no re-check. Worst case is when that next line was the **last** line.

    **Interactive repro (terminal):**
    1. Enter message editor that uses `exec/fseditor.js` (full-screen editor).
    2. 2. Type enough text that word-wrap creates a **kludged** wrap near the end (a long unbroken token/word that forces a mid-word wrap works well).
    3. 3. Continue until the **final** wrapped fragment is short enough that an unwrap can pull all of it up into the previous line.
    4. 4. Edit so unwrap runs on that kludged line (backspace/delete near the wrap boundary, or any edit that triggers `rewrap`/`unwrap_line`).
    5. 5. Pre-fix: TypeError / node error referencing `unwrap_line` / `line[l + 1] is undefined`.
    6. 6. Post-fix: editor stays up; last line is joined; no TypeError.

    **Why this MR fixes it:** after the unkludge block we restore the loop invariant:
    ```
    if(line[l+1]==undefined)
    break;
    ```
    before the second dereference. The obsolete TODO at the splice is removed.

    Happy to adjust wording or add a tiny jsexec harness case if you want something more automated than the interactive path.
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to GitLab note in main/sbbs on Fri Sep 11 16:31:47 2026
    https://gitlab.synchro.net/main/sbbs/-/merge_requests/731#note_10337

    So, in an 80-column window, I typed a single "word" of 90 characters.

    I deleted various bits to get it down to 79 chars, but fseditor never threw an error.
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)