Fix panic when providing 0 to ilog10 in line number length logic (#26844)
Introduced in #24428 Release Notes: - N/A
This commit is contained in:
parent
adbde210fd
commit
c220fb387d
1 changed files with 3 additions and 3 deletions
|
@ -2151,17 +2151,17 @@ impl EditorElement {
|
|||
};
|
||||
|
||||
let editor = self.editor.clone();
|
||||
let max_row = self
|
||||
let max_line_number = self
|
||||
.editor
|
||||
.read(cx)
|
||||
.buffer()
|
||||
.read(cx)
|
||||
.snapshot(cx)
|
||||
.widest_line_number();
|
||||
let is_wide = max_row > 999
|
||||
let is_wide = max_line_number > 999
|
||||
&& row_info
|
||||
.buffer_row
|
||||
.is_some_and(|row| row.ilog10() == max_row.ilog10());
|
||||
.is_some_and(|row| (row + 1).ilog10() == max_line_number.ilog10());
|
||||
|
||||
let toggle = IconButton::new(("expand", ix), icon_name)
|
||||
.icon_color(Color::Custom(cx.theme().colors().editor_line_number))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue