diff --git a/imgui/src/input_widget.rs b/imgui/src/input_widget.rs index 9c99169..5143683 100644 --- a/imgui/src/input_widget.rs +++ b/imgui/src/input_widget.rs @@ -288,8 +288,9 @@ where } }; - // it should always end with this \0. - if self.buf.ends_with('\0') { + // it should always end with one (or more if characters were deleted) + // null terminators + while self.buf.ends_with('\0') { self.buf.pop(); } @@ -386,8 +387,9 @@ impl<'ui, 'p, T: InputTextCallbackHandler, L: AsRef> InputTextMultiline<'ui ) }; - // it should always end with this \0. - if self.buf.ends_with('\0') { + // it should always end with one (or more if characters were deleted) + // null terminators + while self.buf.ends_with('\0') { self.buf.pop(); }