editor: Input enter to get next indent level performance. (#1304)

Now we can handle about 1M lines.

https://github.com/user-attachments/assets/cb55cd18-6755-40cd-a5b0-3d0f865d12e1
This commit is contained in:
Jason Lee 2025-09-29 17:35:58 +08:00 committed by GitHub
parent aca03d47c0
commit 6028de3b5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1206,7 +1206,7 @@ impl InputState {
let mut next_indent = String::new();
let current_line_start_pos = self.start_of_line();
let next_line_start_pos = self.end_of_line();
for c in self.text.chars().skip(current_line_start_pos) {
for c in self.text.slice(current_line_start_pos..).chars() {
if !c.is_whitespace() {
break;
}
@ -1216,7 +1216,7 @@ impl InputState {
current_indent.push(c);
}
for c in self.text.chars().skip(next_line_start_pos) {
for c in self.text.slice(next_line_start_pos..).chars() {
if !c.is_whitespace() {
break;
}