-
-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(buffer): dont render control characters #1226
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1226 /- ##
=====================================
Coverage 94.4% 94.4%
=====================================
Files 62 62
Lines 15056 15084 28
=====================================
Hits 14225 14253 28
Misses 831 831 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems inherently reasonable to me. I don't see any obvious downsides. Are there any that would make you not want to merge this as-is?
Perhaps documenting the behavior somewhere user facing could be a good idea and marking it as a breaking change, but otherwise, seems like a good idea to do this.
I don't think this is a breaking change in its current form. It's a bug fix restoring old behavior. Before
I think I would like the last one the most. Rendering some fallback symbol instead. But this PR currently does something different. |
I read the spec and the two code paths and they are equivalent. 0x00..0x20 and 0x7F..0xA0 are treated as control characters and are length 1.
I think that's a good idea also, but I think it would be worth making an application configurable option. So just filtering seems like a good default.
👍
What about a one line mention in |
Let's go with restoring the old behavior for now: filtering them out completely and release a bug fix release In the long run… Configuring this would require a Buffer configuration which seems annoying? Maybe set_stringn should be moved out of the Buffer then? Anyway, that's a longer run question. Maybe create another issue for this to discuss this further…
It seems far away from actually drawing something to the terminal but maybe that's a technical view… Any good ideas for such a one line? |
My bad - I was thinking about the setting being needed on Terminal to control the buffer. Probably on set_string / set_stringn would be better for this. Just "This method filters out (does not output) control characters" or something similar. |
A lot is depending on set_stringn which doesn't document this either, but I think it's fine. And while at it… set_line and set_span should probably be deprecated (in their own pr) in favor of Line as a widget in order to simplify the Buffer API to its core functionality. |
Anything other needed for a 0.27.1 release? |
@orhun is away for a couple of weeks. He usually handles all the release activities (there's a bunch of stuff that's not automated), I think it'll be around the 26th or so. |
I'm not sure what the point of the labels accepted or review needed is, as that's something GitHub itself already displays? Also, why accepted and not just merged then? I think there should be automated quick released features and bug fixes… so versions like ratatui 0.27.7 could easily be the case… Similar to the weekly alpha release currently which seem a bit weird to me as the Cargo.toml could also just point to the main branch. The point of PR reviews is to ensure that it works correctly when merged, so it should also be releasable? Breaking PRs can be merged at the same time and released together. |
I'm using labels mostly as an aid to whether I need to look at an issue again at some point. I didn't merge this one in case there was anything you wanted to do before merge. Feel free to merge if there's nothing pressing. Agreed on the quick releases etc. we're not there right now, but are close. The alpha release was created to address the gap when there was a much longer period between releasing and to make it possible for downstream apps to easily publish crates that relied on unreleased functionality. However I'm a fan of releasing whenever there's a reasonable amount of stuff to go however. Every few days if needed. When Orhun is back let's discuss making that easier. (Perhaps cut an issue or discussion about it) |
This is selectable by queries (and the buttons at the top create them for you)
→ #1232 |
fixes #1211
As I have the stuff tested in a local branch, I can also push it for more discussions.
See https://doc.rust-lang.org/std/primitive.char.html#method.is_control