Skip to content

Commit

Permalink
Fix text input deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Shadle committed Sep 15, 2021
1 parent 7d266d4 commit 97d6242
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions imgui/src/input_widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -386,8 +387,9 @@ impl<'ui, 'p, T: InputTextCallbackHandler, L: AsRef<str>> 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();
}

Expand Down

0 comments on commit 97d6242

Please sign in to comment.