-
Notifications
You must be signed in to change notification settings - Fork 67
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 hard tab display #33
Conversation
Tbc,I will fix the tab_len ==0 in prperae_line. I was asking 'should I allow tabs in the case of hard tabs and tab len==0' I think the answer is yes. If the user wants to insert a hard tab, they should be allowed to |
@pm100 Do you mean removing this Lines 699 to 701 in f4cd38e
Anyway, I feel this is an off-topic for this PR. |
@joshka these tests are in fact incorrect. They are verifying the incorrect behavior that this PR is fixing. But thank you for them. I will fix them I was thinking 'system test' rather than 'unit test' when I said it was very hard to do. Question: how did you create these? copilot, I have heard of it but not used it. |
Some kind of system test is easy to implement for this crate because we can use the test backend (or create our own dummy backend). The problem is that I have no time to implement the test cases. |
Thank you for the changes. I merged. |
Having done this on another project I think 'easy' is a little optimistic, certainly doable tho :) |
In general, for testing ratatui widget rendering, I'd recommend avoiding using the TestBackend and prefer to save a few steps for every test and hit the buffer directly. The You might want just one TestBackend test though to ensure that everything works as expected, but the majority of the tests could easily use the following approach. Many of the newer tests written in Ratatui use this approach:
Combined with an LLM it's pretty quick to crank these out fast. |
* fix hard tab display * fix clippy complaint * fix tab_len == 0 case. Add tests * oops commited wrong file.
Yeah, maybe. It would be hard to maintain the tests as Rust code. I would prepare 3 files per each test case:
|
hard tabs always insert 4 spaces
heres is minimal example switched to hard tab mode by adding
textarea.set_hard_tab_indent(true);
this is the result of typing
a,tab,b,return
aa,tab,b,return
aaa,tab,b,return
the bs should be aligned, they are not