added toggle current cell when pressing space

This commit is contained in:
Olli Graf
2024-05-06 07:11:27 +02:00
parent 2159173277
commit 17b2f725f9
2 changed files with 6 additions and 0 deletions

View File

@@ -19,6 +19,10 @@ class Field:
self.message = ''
def toggleCurrent(self):
curline = self.field[self.cursor[0]]
curline[self.cursor[1]] = 0 if curline[self.cursor[1]] == 1 else 1
def print_field(self,stdscr):
stdscr.clear()
for line in range(0,len(self.field)):

View File

@@ -32,6 +32,8 @@ def inputLoop(stdscr):
match key:
case 'q':
exitPrg = True
case ' ':
field.toggleCurrent()
case 'KEY_DOWN':
if field.cursor[0] < len(field.field)-1:
newcursor = (field.cursor[0] +1,field.cursor[1])