MCPcopy Create free account
hub / github.com/ahmednooor/lino / decrease_current_line_indentation

Method decrease_current_line_indentation

src/lino/edit.rs:270–294  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

268 }
269
270 pub(crate) fn decrease_current_line_indentation(&mut self) {
271 if self.is_current_line_empty() {
272 return;
273 }
274
275 if self.lines[self.cursor.row][0].character != ' ' {
276 return;
277 }
278
279 let mut indent_width = self.settings.tab_width;
280 if self.lines[self.cursor.row].len() < self.settings.tab_width {
281 indent_width = self.lines[self.cursor.row].len();
282 }
283
284 for _ in 0..indent_width {
285 if self.lines[self.cursor.row][0].character == ' ' {
286 if !self.is_cursor_at_line_start() {
287 self.move_cursor_left();
288 }
289 self.lines[self.cursor.row].remove(0);
290 } else {
291 break;
292 }
293 }
294 }
295
296
297

Callers 2

decrease_indentationMethod · 0.80

Calls 3

is_current_line_emptyMethod · 0.80
move_cursor_leftMethod · 0.80

Tested by

no test coverage detected