Repository navigation
Fix: Hidden links survive a window clear from any buffer - #1
Conversation
The main console's model outlives the view built on it and keeps taking lines meanwhile, so gating the tracked-link adjustment on mpConsole stops maintaining it while the buffer is still being written to. Reach the manager through the model instead, and cover the announcement reset and the detached path that had no test. Assisted-by: Claude:claude-opus-5
A scratch buffer built with a console back-pointer clears itself in its constructor, which reached through to the live console's manager and dropped every tracked link on it. Assisted-by: Claude:claude-opus-5
6dad86a
into
jaypatrickhoward:fix/clearwindow-drops-tracked-osc8-links
|
Merged, thanks - this is on Mudlet#10179 now, along with development merged in. Both fixes check out. I reverted each in turn and confirmed the tests bite: You were also right about the comment on One leftover: Assisted-by: Claude:claude-opus-5 |
…t#10807) #### Brief overview of PR changes/additions - The bad-argument errors from `feedTelnet()` and `feedTriggers()` are one line again. Each was built from two adjacent string literals where the first ended in `\n`, so the message arrived split in two. #### Motivation for adding to Mudlet `TLuaInterpreter::logError()` wraps an error as ` <message>`, so the embedded newline ended the line early: the tail landed at column 0 with no closing `>`, and anything reading the log a line at a time saw only the first half. #### Other info (issues closed, discussion etc) Fixes Mudlet#10776. Honest about the scope: this is presentation only. The message exists in exactly those two places, nothing in `src/mudlet-lua/` or `test/` matches on it, and the existing `assertArgError` calls match `"bad argument #1 type"` — text before the break — so no spec was quietly failing and no consumer changes behaviour. One spec per feeder rather than one covering both, so a regression in each is reported separately; sharing one `it` meant the first failure aborted before the second was checked. Confirmed to bite by mutating the expected string to the pre-fix split form, which turns the suite red at exactly that assertion. The same split-literal pattern survives in nine other places — `deleteArea`, `getRoomAreaName`, `setAreaName`, `setRoomArea` (both arguments), `raiseEvent`, `raiseGlobalEvent` and `getMudletVersion` (twice). All nine were demonstrated from ordinary Lua and filed as Mudlet#10806 rather than swept in here. Two of them are a wording decision rather than a one-character change, since their break falls at the end of a sentence before an indented list; the issue says so. **Test case:** 1. In any profile run `feedTriggers()` with no argument. 2. The error appears on a single line, inside its `< >`. Before this change it broke after `as string` and the rest appeared unindented on the next line with no closing bracket. ---⚠️ **DCO sign-off still owed.** `docs/CONTRIBUTING.md` requires a human to build and manually test AI-assisted work before signing off, and asks that Mudlet developers not be the first to test AI-generated code. This branch was produced in an unattended session, so no `Signed-off-by` trailer has been added — please build and test it, then add yours before merging. Assisted-by: Claude:claude-opus-5 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016ndCZh8idD5CroHvBzqA8R --- _Generated by [Claude Code](https://claude.ai/code/session_016ndCZh8idD5CroHvBzqA8R)_ Co-authored-by: Claude <noreply@anthropic.com>
Brief overview of PR changes/additions
TConsolebuilt on it and keeps taking lines meanwhile, so stopping atmpConsolegave up adjusting line numbers while the buffer was still being trimmed - concealed links then pointed at the wrong lines and overwrote text on reveal, the very symptom clearWindow() leaves OSC 8 links pointing at lines that no longer exist Mudlet/Mudlet#10122 reports.TBuffer(host, console)is a legal way to build a scratch buffer, and its constructor callsclear()- which reached through the back-pointer and dropped every tracked link on the live console. Every model also builds its buffer before a view attaches, so the model path needs the same identity check.test_aWholelineConcealmentMovesTheLinksBelowItOnlyOnceclaiming a click is the only thing that conceals without a delay.concealLink()conceals unconditionally and the same test calls it four lines below.>=lower bound had nothing covering it), the queued screen-reader announcement being cancelled by a clear, a delete with no view attached, another buffer's construction and deletion leaving the tracked links alone, and a miniconsole maintaining its own links off its own buffer.friend class TrackedLinkTrimTestreads the line numbers and the pending announcement count, which are otherwise only observable through a screen reader.Motivation for adding to Mudlet
The fix in this PR is right, but it addresses the manager through the view. Two states break that: a model with no view yet or no longer, and a second buffer that happens to hold a console pointer. Each was reproduced with a failing test before the change.
Other info (issues closed, discussion etc)
TBuffer::shrinkBuffer()carries the identicalif (mpConsole)gate, but it predates this PR (it came in with fix: hidden links still reveal once older text has scrolled away Mudlet/Mudlet#10119), so it is deliberately left alone here rather than growing the scope. Filed as A buffer trim corrupts tracked OSC 8 links when no view is attached Mudlet/Mudlet#10315 with a reproduction: a concealed link's commands get swept and its line number never moves.test_aWholelineConcealmentMovesTheLinksBelowItOnlyOncepasses against pre-PR code, so it is a double-adjustment guard rather than proof of this PR's fix - worth knowing given the commit message describes the manual loop's removal as covered by it.mpAnnouncementTimerinclear()and callingstopTimerIfNotNeeded()inadjustLineNumbers()are both timer hygiene with no observable behaviour to assert on.Test case:
cmake --build --preset linux-debug-nosan && QT_QPA_PLATFORM=offscreen ctest --preset linux-debug-nosan -R TrackedLinkTrimTest. Manually: open a game with OSC 8 links, conceal one, then have the game clear the window or push enough lines to trim the buffer - the concealed link must not reappear over unrelated text.Assisted-by: Claude:claude-opus-5