diff --git a/mvc/models.py b/mvc/models.py index 4d18887..ce79495 100644 --- a/mvc/models.py +++ b/mvc/models.py @@ -93,6 +93,16 @@ class VimModel: self.currentCol = right_space_index else: self.currentCol = len(self.displayBuffer[self.currentLine]) + case "b": # Перемещает курсор в конец в начало слова слева от курсора + line = ''.join(self.displayBuffer[self.currentLine]) + non_space_index = next((i for i in range(self.currentCol - 1, -1, -1) if line[i] != ' '), None) + if non_space_index is not None: + left_space_index = line.rfind(' ', 0, non_space_index) + if left_space_index != -1: + self.currentCol = left_space_index + 1 + else: + self.currentCol = 0 + def Enter(self) -> None: # Разделяем текущую строку на две части