Create and display cursor
This commit is contained in:
parent
d7d97c9f6e
commit
bd1ea3742d
1 changed files with 8 additions and 0 deletions
|
|
@ -4,6 +4,12 @@ import sys
|
|||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class Cursor:
|
||||
line: int = 0
|
||||
col: int = 0
|
||||
|
||||
|
||||
@dataclass
|
||||
class Window:
|
||||
n_lines: int
|
||||
|
|
@ -27,11 +33,13 @@ def main(stdscr):
|
|||
buffer = f.readlines()
|
||||
|
||||
window = Window(curses.LINES - 1, curses.COLS - 1)
|
||||
cursor = Cursor()
|
||||
|
||||
while True:
|
||||
stdscr.erase()
|
||||
for line, string in enumerate(window.trim(buffer)):
|
||||
stdscr.addstr(line, 0, string)
|
||||
stdscr.move(cursor.line, cursor.col)
|
||||
|
||||
k = stdscr.getkey()
|
||||
if k == "q":
|
||||
|
|
|
|||
Loading…
Reference in a new issue