Skip to content

Commit

Permalink
Fix tab handling for text area
Browse files Browse the repository at this point in the history
  • Loading branch information
DJMcNab committed Nov 21, 2024
1 parent 1f3bb1f commit f4765ac
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions masonry/src/widget/text_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,16 +668,28 @@ impl<const EDITABLE: bool> Widget for TextArea<EDITABLE> {
.transact(fctx, lctx, |txn| txn.insert_or_replace_selection(" "));
edited = true;
}
Key::Named(NamedKey::Tab) => {
// Intentionally do nothing so that tabbing from a textbox/Prose works.
// Note that this doesn't allow input of the tab character; we need to be more clever here at some point
return;
}
_ if EDITABLE => match &key_event.text {
Some(text) => {
self.editor
.transact(fctx, lctx, |txn| txn.insert_or_replace_selection(text));
edited = true;
}
None => {}
None => {
// Do nothing, don't set as handled.
return;
}
},
_ => {}
_ => {
// Do nothing, don't set as handled.
return;
}
}
ctx.set_handled();
let new_generation = self.editor.generation();
if new_generation != self.rendered_generation {
if edited {
Expand Down

0 comments on commit f4765ac

Please sign in to comment.