yy - копирует строку, p - вставка скопированного после курсора

master
serr 2025-02-04 22:05:12 +03:00
parent 026b192171
commit 17783481c5
1 changed files with 6 additions and 0 deletions

View File

@ -18,6 +18,7 @@ class VimModel:
self.file_path = "" # путь к файлу self.file_path = "" # путь к файлу
self.mode = "" self.mode = ""
self.commandBuffer = [] # буффер для команды self.commandBuffer = [] # буффер для команды
self.exchangeBuffer = [] # буффер обмена
def ModeBar(self) -> str: def ModeBar(self) -> str:
modeBar = f"MODE: {self.mode} | FILE: {self.file_path} | LINE: {self.currentLine+1}/{len(self.displayBuffer)}" modeBar = f"MODE: {self.mode} | FILE: {self.file_path} | LINE: {self.currentLine+1}/{len(self.displayBuffer)}"
@ -111,6 +112,11 @@ class VimModel:
case "x": # Удаляет символ после курсора case "x": # Удаляет символ после курсора
if self.currentCol + 1 < len(self.displayBuffer[self.currentLine]): if self.currentCol + 1 < len(self.displayBuffer[self.currentLine]):
del self.displayBuffer[self.currentLine][self.currentCol + 1] del self.displayBuffer[self.currentLine][self.currentCol + 1]
case "yy": # копирует текущую строку
self.exchangeBuffer = self.displayBuffer[self.currentLine].copy()
case "p": # вставить после курсора
self.displayBuffer[self.currentLine][self.currentCol+1:self.currentCol+1] = self.exchangeBuffer
return ReturnCode.GOOD return ReturnCode.GOOD
def Enter(self) -> None: def Enter(self) -> None: