From f76504249b2fd7aa597290b1c7337be2e865bf5d Mon Sep 17 00:00:00 2001 From: serr Date: Tue, 4 Feb 2025 21:08:48 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=BC=D0=B0=D0=BD=D0=B4?= =?UTF-8?q?=D0=B0=20b=20->=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89?= =?UTF-8?q?=D0=B0=D0=B5=D1=82=20=D0=BA=D1=83=D1=80=D1=81=D0=BE=D1=80=D0=B0?= =?UTF-8?q?=20=D0=B2=20=D0=BD=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20=D1=81=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=20=D1=81=D0=BB=D0=B5=D0=B2=D0=B0=20=D0=BE?= =?UTF-8?q?=D1=82=20=D0=BA=D1=83=D1=80=D1=81=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mvc/models.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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: # Разделяем текущую строку на две части