Fix: insertText newline regression#9022
Merged
vadi2 merged 11 commits intoMudlet:developmentfrom Apr 8, 2026
Merged
Conversation
getWrapInfo discarded all wrap info when totalWidth <= mWrapAt, including newline-triggered splits. Track hasNewline and skip the early return when newlines are present. Add C++ functional tests for insertText with newlines and echo with newlines in trigger mode. Add Lua tests for the same. Fixes Mudlet#8945
|
Hey there! Thanks for helping Mudlet improve. 🌟 Test versionsYou can directly test the changes here:
No need to install anything - just unzip and run. |
Member
Author
|
@Harrison-Teeg could you test this one out? |
decho's trailing \n moves cursor to the next line, so selectSection was operating on an empty line.
This reverts commit 5af21e8.
Use insertInLine instead of appendLine in TConsole::echo() trigger mode so newlines are embedded in the line text rather than creating new buffer lines. This fixes cecho/creplaceLine regression from Mudlet#7714 where subsequent echo calls would append to wrong lines. Also adds regression tests for Mudlet#8945 and Mudlet#8824.
The getWrapInfo fix now properly splits on embedded newlines, so decho's trailing \n moves the cursor to the next line. selectSection operates on the current line, so we need to move back to line 0 first.
- Add moveCursor(0,0) to before_each for testformat and formattest consoles since clearWindow doesn't reset mUserCursor - Fix off-by-one in selectSection calls: positions are 0-indexed so last char of N-char line is at N-1, not N - Fix getFgColor/getBgColor assertions: these return r,g,b numbers, not tables - Remove redundant moveCursor from inside test 665 These tests were passing on development by accident - cursor state from prior tests caused if-guards to skip all assertions, making them pass vacuously.
Tests are already in UI_spec.lua.
Contributor
|
this does seem to fix the problem |
Member
Author
|
Good to merge? |
Contributor
|
There's an issue with this PR -- I'm still tracking it down but it looks like it's something regarding the length of the line not resetting for newlines in echoes. If I have a trigger that has long enough echos mudlet will wordwrap them even though the linebreaks make it so the lines shouldn't be wrapped. E.g. before: After |
xPos was not reset to 0 when processing embedded linefeeds, causing line width to accumulate across newline boundaries and triggering false word-wrapping on short lines.
Member
Author
|
Good one, fixed. |
Contributor
|
nice catch, we good then @Harrison-Teeg ? |
Contributor
|
That solves the issue! |
Member
Author
|
/refresh links |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brief overview of PR changes/additions
Fix insertText newline regression in 4.20 that came with #7714.
Motivation for adding to Mudlet
Fixes #8945
Fixes #8824
Other info (issues closed, discussion etc)
Added all test cases we found as test cases to our CI to ensure we don't regress.