Skip to content

Commit

Permalink
add multiline option to textbox
Browse files Browse the repository at this point in the history
  • Loading branch information
msparkles committed Jul 3, 2024
1 parent a37a6c9 commit 2aac6d1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/yakui-widgets/src/widgets/textbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct TextBox {

/// Whether or not enter triggers a loss of focus and if shift would be needed to override that
pub inline_edit: bool,
pub multiline: bool,

pub selection_halo_color: Color,
pub selected_bg_color: Color,
Expand All @@ -52,6 +53,7 @@ impl TextBox {
fill: Some(colors::BACKGROUND_3),

inline_edit: true,
multiline: false,

selection_halo_color: Color::WHITE,
selected_bg_color: Color::CORNFLOWER_BLUE.adjust(0.4),
Expand Down Expand Up @@ -561,7 +563,7 @@ impl Widget for TextBoxWidget {
KeyCode::Enter | KeyCode::NumpadEnter => {
if *down {
if self.props.inline_edit {
if modifiers.shift() {
if self.props.multiline && modifiers.shift() {
editor.action(font_system, cosmic_text::Action::Enter);
} else {
self.activated = true;
Expand Down

0 comments on commit 2aac6d1

Please sign in to comment.