Skip to content

Commit 7f26220

Browse files
author
Stadnik Andrii
committed
Updated
1 parent 681fd2b commit 7f26220

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Display.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ def __init__(self, scr, text: list):
1313

1414
self.scr = scr
1515
self.text = text
16-
self.maxlen = max([len(l) for l in text]) - 1
16+
self.maxlen = max([len(l) for l in text]) - 1 # The biggest possible value of num_char
1717
self.num_line = 0 # Number of line to start from
1818
self.num_char = 0 # Number of char to start from
19-
self.helpmsg = "Keys: h, j, k, l, u, d, U, D, g, G. Quit - q"
19+
self.helpmsg = "Keys: h, j, k, l, u, d, U, D, g, G, r. Quit - q"
2020
self.coords = str(self.num_line) + ":" + str(self.num_char)
21+
curses.curs_set(0)
2122
self.resize()
2223

2324

@@ -61,7 +62,6 @@ def __move(self, d: str, step: int):
6162
self.num_line = len(self.text) - (self.max_y - 2)
6263
if d == 'RIGHT':
6364
if self.num_char + step < self.maxlen:
64-
#TODO check if I should leave < there or I should use <=
6565
self.num_char += step
6666
else:
6767
self.num_char = self.maxlen
@@ -104,6 +104,9 @@ def key_hooks(self, c) -> bool:
104104
self.num_line = len(self.text) - (self.max_y - 2)
105105
elif c == ord('q'):
106106
quit()
107+
elif c == ord('r'):
108+
self.num_char = 0
109+
self.num_line = 0
107110
else:
108111
return False
109112
return True

0 commit comments

Comments
 (0)