diff --git a/files.img b/files.img index 7de7ea8..7f5cc48 100644 --- a/files.img +++ b/files.img @@ -241,6 +241,7 @@ class Tooltip: class TxtField: def __init__(self, x, y, w, h): + self.isVis = False self.x, self.y = x, y self.w, self.h = w, h self.pwd = '/' @@ -309,7 +310,7 @@ class TxtField: lines = self.txtBuffer.count('\r') + self.txtBuffer.count('\n') if lines > 39: lines = 39 - self.cursor.rect.center = (self.x + (self.loc + len(self.pwd) + 1) * 9 + 8, + self.cursor.rect.center = (self.x + (self.loc + (len(self.pwd) if not self.isVis else -2) + 1) * 9 + 8, self.y + lines * 16 + 8) screen.blit(self.cursor.image, self.cursor.rect) def cd(self, dir_name): @@ -343,6 +344,7 @@ class TxtField: dir_name = dir_name[1:] process_dir(dir_name) def vis(self, args): + self.isVis = True if not args: print("vis: missing argument.\rUsage: vis ", end='\r') if type(args) == type([]): @@ -368,7 +370,7 @@ class TxtField: files.write(self.cLineStr) framework.launch() elif event.type == pygame.KEYUP: - if event.key == pygame.K_LSHIFT or event.key == pygame.K_RSHIFT: + if event.key in (pygame.K_LSHIFT, pygame.K_RSHIFT): self.shift = False elif event.key == pygame.K_CAPSLOCK: self.capsLock = 1 - self.capsLock @@ -376,7 +378,9 @@ class TxtField: pygame.quit() sys.exit() framework.launch() + self.frame += 1 files.close() + self.isVis = False def exec_cmd(self, on_scr): cmd = on_scr.split() @@ -438,7 +442,7 @@ class TxtField: self.txtBuffer.append('\n') framework.launch() elif key == pygame.K_TAB: - for i in range(4): + for _ in range(4): self.txtBuffer.append(' ') self.loc += 1 elif key == pygame.K_LSHIFT or key == pygame.K_RSHIFT: @@ -455,7 +459,7 @@ class TxtField: if 32 <= key <= 126: if (key == 39 or 44 <= key <= 57 or key == 59 or key == 61 or key == 96 or 91 <= key <= 93) and self.shift: self.txtBuffer.insert(self.loc + self.currentLine, self.caps[chr(key)]) - elif 97 <= event.key <= 122 and (self.shift or self.capsLock): + elif 97 <= key <= 122 and (self.shift or self.capsLock): self.txtBuffer.insert(self.loc + self.currentLine, self.caps[chr(key)]) else: self.txtBuffer.insert(self.loc + self.currentLine, chr(key)) @@ -605,4 +609,4 @@ If you're seeing this, then the `cat` command is working! !FNAME=sys/ !LOC=/ -!FNAME=home/ \ No newline at end of file +!FNAME=home/ diff --git a/wiki/FAQ.md b/wiki/FAQ.md index d18d416..d67312b 100644 --- a/wiki/FAQ.md +++ b/wiki/FAQ.md @@ -8,7 +8,13 @@ Run `stub.py` either by double-clicking on it (in Windows) or using the command ## FAQ for `vis` ### How do I use `vis`? -When you open it up through the virtual terminal, you will be put in *input mode*, which means whatever you type will be written into the file. `vis` is a *line-based* editor, meaning you can only edit the line you're on. +When you open it up through the virtual terminal, you will be put in *input mode*, which means whatever you type will be written into the file. `vis` is a *line-based* editor, meaning you can only edit the line you're on.
+Enter `vis ` to start editing a file. Press Enter whenever you have finished editing a line. The line will be immediately saved and cannot be altered again in this editing session. Press Esc to exit `vis`. ### Where do the files go? -Everything you created in Winnux 58 will go into the `files.img` *virtual disk*. You can view them using the `cat` command in the virtual terminal. Note that `files.img` is NOT a traditional disk image, so don't try to mount that! \ No newline at end of file +Everything you created in Winnux 58 will go into the `files.img` *virtual disk*. You can view them using the `cat` command in the virtual terminal. Note that `files.img` is NOT a traditional disk image, so don't try to mount that! + +## Known issues +