-
Notifications
You must be signed in to change notification settings - Fork 243
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
[Help] Modify Tab key function in TextArea widget #646
Comments
Hi! The default behaviour of
let text_area = OnEventView::new(TextArea::new())
.on_event_inner('\t', |text_area, _event| {
// Right now, no convenient way to append text...
let text = text_area.get_content().to_string();
text_area.set_content(text + "\t");
// Mark the event as consumed.
Some(EventResult::consumed())
}); |
I was working on the solution all afternoon, I tried the same thing you mentioned, but in addition to it, I had also had to move the cursor to the correct position. Here is the commit, where I made the changes bauripalash/rxr-ui@bafba49 |
Ah right I totally forgot about the cursor. In that case you'll also want to insert the tab character at the cursor's location, and not just append it to the end. But yeaah tab characters are not easy to deal with; replacing it with a fixed numbers of spaces is probably a simpler solution at this point. Note that |
Well, I'm building a regex tester something like regex101 but more simpler, so I don't need much more complicated features just a simple string editor is sufficient. Thank you, for the help and this awesome library. 😁 |
I am working on a prototype regex tester project https://github.com/bauripalash/rxr-ui
I want to modify the Tab key behavior on the TextArea widget ( or whole window).
I want Tab key to input
\t
character instead of widget switching.on_event
function seems to handle these, but I can't find any documentation or example how to modify key behaviors on the widget, clearing global callbacks doesn't help. Any suggestions regarding this situation?The text was updated successfully, but these errors were encountered: