добавил usage.txt, возможность запуска программы с argv[1] именем файла или без него

master
serr 2025-02-05 02:17:02 +03:00
parent 1943b194e4
commit b420a4e667
1 changed files with 10 additions and 3 deletions

View File

@ -80,12 +80,12 @@ class VimModel:
case "LEFT": # Перемещение курсора на 1 позицию влево
if self.currentCol > 0:
self.currentCol -= 1
case "UP": # Перемещение курсора на 1 пизицию вверх
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])
case "DOWN": # Перемещение курсора на 1 пизицию вниз
case "DOWN": # Перемещение курсора на 1 позицию вниз
if self.currentLine < len(self.displayBuffer) - 1:
self.currentLine += 1
if self.currentCol > len(self.displayBuffer[self.currentLine]):
@ -153,10 +153,17 @@ class VimModel:
filename = cmd[2:]
self.LoadFile(filename)
return ReturnCode.SET_BASIC_MODE
# Запись в файл
elif len(cmd) > 2 and cmd[:2] == 'w ':
filename = cmd[2:]
self.WriteFile(filename)
# Переход на строку по указанному номеру
elif len(cmd) > 1 and cmd[-1] == 'G':
if cmd[:-1].isdigit():
numberLine = int(cmd[:-1])
if numberLine >= 0 and numberLine < len(self.displayBuffer):
self.currentLine = numberLine
self.currentCol = 0
return ReturnCode.GOOD