diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-01 22:07:04 +0200 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2024-08-01 22:07:04 +0200 |
| commit | 1e1eb95926f556e666bc20355327abd24d264858 (patch) | |
| tree | e40b68da80b984355baf68a36983d78bb2ec63dd /src/widgets/luaeditor/buffer.rs | |
| parent | 5d15bed762c4c699bebc9b5f5e302fa61785ed51 (diff) | |
minor cleanup
Diffstat (limited to 'src/widgets/luaeditor/buffer.rs')
| -rw-r--r-- | src/widgets/luaeditor/buffer.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/widgets/luaeditor/buffer.rs b/src/widgets/luaeditor/buffer.rs index 3f59b6c..1af0c08 100644 --- a/src/widgets/luaeditor/buffer.rs +++ b/src/widgets/luaeditor/buffer.rs @@ -18,7 +18,7 @@ impl Buffer { fn refresh_line_max(&mut self) { self.cursor - .set_x_max(self.lines[self.cursor.y() as usize].len()) + .set_x_max(self.lines[self.cursor.y()].len()) } fn refresh_buffer_max(&mut self) { @@ -39,7 +39,7 @@ impl Buffer { s.starts_with(&(str.clone() + "if ")) || s.starts_with(&(str.clone() + "for ")) || s.starts_with(&(str.clone() + "while ")) - || (s.starts_with(&str) && s.contains("function(") && s.ends_with(")")) + || (s.starts_with(&str) && s.contains("function(") && s.ends_with(')')) }) .count(); @@ -66,7 +66,7 @@ impl Buffer { let l = a.trim(); let insert_end = (l.starts_with("if ") && l.ends_with(" then")) || ((l.starts_with("for ") || l.starts_with("while ")) && l.ends_with(" do")) - || (l.contains("function(") && l.ends_with(")")); + || (l.contains("function(") && l.ends_with(')')); let extra_indent = if insert_end { 1 } else { 0 }; @@ -126,11 +126,11 @@ impl Buffer { } pub fn current_line(&self) -> &String { - self.line(self.cursor.y() as usize).unwrap() + self.line(self.cursor.y()).unwrap() } fn current_line_mut(&mut self) -> &mut String { - self.line_mut(self.cursor.y() as usize).unwrap() + self.line_mut(self.cursor.y()).unwrap() } pub fn cursor(&self) -> &Cursor { |