Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions files.img
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '/'
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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 <filename>", end='\r')
if type(args) == type([]):
Expand All @@ -368,15 +370,17 @@ 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
elif event.type == pygame.QUIT:
pygame.quit()
sys.exit()
framework.launch()
self.frame += 1
files.close()
self.isVis = False

def exec_cmd(self, on_scr):
cmd = on_scr.split()
Expand Down Expand Up @@ -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:
Expand All @@ -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))
Expand Down Expand Up @@ -605,4 +609,4 @@ If you're seeing this, then the `cat` command is working!
!FNAME=sys/

!LOC=/
!FNAME=home/
!FNAME=home/
10 changes: 8 additions & 2 deletions wiki/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br>
Enter `vis <filename>` 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!
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
<ul>
<li>The cursor behaves strangely in vis. It does not update regularly anymore, but rather updates at every event.</li>
</ul>