From b0439943816c65323dd6452c3a1b403c114bdb8c Mon Sep 17 00:00:00 2001 From: serr Date: Tue, 4 Feb 2025 21:26:55 +0300 Subject: [PATCH] =?UTF-8?q?gg=20->=20=D0=BF=D0=B5=D1=80=D0=B5=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=20=D0=B2=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20=D1=84?= =?UTF-8?q?=D0=B0=D0=B9=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mvc/models.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mvc/models.py b/mvc/models.py index ce79495..227ceb5 100644 --- a/mvc/models.py +++ b/mvc/models.py @@ -51,10 +51,8 @@ class VimModel: match cmd: case "$": # Перемещение в конец строки self.currentCol = len(self.displayBuffer[self.currentLine]) - return ReturnCode.GOOD case "^" | "0": # Перемещение в начало строки self.currentCol = 0 - return ReturnCode.GOOD case "q": # Выход из программы return ReturnCode.EXIT_CODE case "i": # Вход в режим редактирования @@ -65,23 +63,19 @@ class VimModel: return ReturnCode.SET_EDIT_MODE case "RIGHT": # Перемещение курсора на 1 позицию вправо self.currentCol += 1 - return ReturnCode.GOOD case "LEFT": # Перемещение курсора на 1 позицию влево if self.currentCol > 0: self.currentCol -= 1 - return ReturnCode.GOOD case "UP": # Перемещение курсора на 1 пизицию вверх if self.currentLine > 0: self.currentLine -= 1 if self.currentCol > len(self.displayBuffer[self.currentLine]): self.currentCol = len(self.displayBuffer[self.currentLine]) - return ReturnCode.GOOD case "DOWN": # Перемещение курсора на 1 пизицию вниз if self.currentLine < len(self.displayBuffer) - 1: self.currentLine += 1 if self.currentCol > len(self.displayBuffer[self.currentLine]): self.currentCol = len(self.displayBuffer[self.currentLine]) - return ReturnCode.GOOD case "w": # Перемещение курсора в конец слова справа от курсора line = ''.join(self.displayBuffer[self.currentLine]) # Находим ближайший непробельный символ @@ -102,7 +96,10 @@ class VimModel: self.currentCol = left_space_index + 1 else: self.currentCol = 0 - + case "gg": # Переход в начало файла + self.currentLine = 0 + self.currentCol = 0 + return ReturnCode.GOOD def Enter(self) -> None: # Разделяем текущую строку на две части