r S -> заменяет символ под курсором на символ S

master
serr 2025-02-05 21:19:08 +03:00
parent b6c9f087be
commit fbbb032be3
1 changed files with 5 additions and 9 deletions

View File

@ -172,22 +172,18 @@ class VimModel:
self.LoadFile("config/usage.txt") self.LoadFile("config/usage.txt")
return ReturnCode.SET_BASIC_MODE return ReturnCode.SET_BASIC_MODE
case _: case _:
# Открывает файл # Открывает файл filename
if len(cmd) > 2 and cmd[:2] == 'o ': if len(cmd) > 2 and cmd[:2] == 'o ':
filename = cmd[2:] filename = cmd[2:]
self.LoadFile(filename) self.LoadFile(filename)
return ReturnCode.SET_BASIC_MODE return ReturnCode.SET_BASIC_MODE
# Запись в файл # Запись в файл filename
elif len(cmd) > 2 and cmd[:2] == 'w ': elif len(cmd) > 2 and cmd[:2] == 'w ':
filename = cmd[2:] filename = cmd[2:]
self.WriteFile(filename) self.WriteFile(filename)
# Переход на строку по указанному номеру # Заменяет символ на указанный
elif len(cmd) > 1 and cmd[-1] == 'G': elif len(cmd) == 3 and cmd[:2] == 'r ':
if cmd[:-1].isdigit(): self.displayBuffer[self.currentLine][self.currentCol] = cmd[2]
numberLine = int(cmd[:-1])
if numberLine >= 0 and numberLine < len(self.displayBuffer):
self.currentLine = numberLine
self.currentCol = 0
return ReturnCode.GOOD return ReturnCode.GOOD