diff --git a/src/views/edit_view.rs b/src/views/edit_view.rs index b8331b1..513c5b6 100644 --- a/src/views/edit_view.rs +++ b/src/views/edit_view.rs @@ -83,6 +83,9 @@ pub struct EditView { /// When `true`, only print `*` instead of the true content. secret: bool, + /// Character to fill empty space + filler: String, + enabled: bool, style: ColorStyle, @@ -101,6 +104,7 @@ impl EditView { on_edit: None, on_submit: None, secret: false, + filler: "_".to_string(), enabled: true, style: ColorStyle::Secondary, } @@ -120,6 +124,13 @@ impl EditView { self.with(|s| s.set_secret(true)) } + /// Sets the character to fill in blank space + /// + /// Defaults to "_" + pub fn set_filler(&mut self, filler: String) { + self.filler = filler; + } + /// Disables this view. /// /// A disabled view cannot be selected. @@ -405,7 +416,7 @@ impl View for EditView { } printer.print_hline((width, 0), printer.size.x - width, - "_"); + self.filler.as_str()); } else { let content = &self.content[self.offset..]; let display_bytes = content.graphemes(true) @@ -428,7 +439,7 @@ impl View for EditView { if width < self.last_length { printer.print_hline((width, 0), self.last_length - width, - "_"); + self.filler.as_str()); } } });