Skip to content

Commit

Permalink
Update text_buffer.rs
Browse files Browse the repository at this point in the history
emilk#3878

panic patch
  • Loading branch information
rustbasic authored Feb 6, 2024
1 parent 217e066 commit 30e5d55
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/egui/src/widgets/text_edit/text_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ pub trait TextBuffer {
fn decrease_indentation(&mut self, ccursor: &mut CCursor) {
let line_start = find_line_start(self.as_str(), *ccursor);

let remove_len = if self.as_str()[line_start.index..].starts_with('\t') {
let remove_len = if self.as_str().chars().nth(line_start.index) == Some('\t') {
Some(1)
} else if self.as_str()[line_start.index..]
} else if self
.as_str()
.chars()
.skip(line_start.index)
.take(TAB_SIZE)
.all(|c| c == ' ')
{
Expand Down

0 comments on commit 30e5d55

Please sign in to comment.