LineEditor
Bases: ActionsHandler
Source code in pzp/line_editor.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
__init__(line=None, keys_handler=None)
Line editor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line |
Optional[str]
|
Initial value |
None
|
keys_handler |
Optional[KeysHandler]
|
Keys handler |
None
|
Source code in pzp/line_editor.py
15 16 17 18 19 20 21 22 23 24 25 |
|
__len__()
Return line length
Source code in pzp/line_editor.py
87 88 89 |
|
__str__()
Return the line
Source code in pzp/line_editor.py
91 92 93 |
|
adj_cursor_pos(characters)
Set cursor position (relative to current position)
Source code in pzp/line_editor.py
31 32 33 |
|
backward_char()
Move the cursor back one character
Source code in pzp/line_editor.py
41 42 43 44 |
|
beginning_of_line()
Move the cursor to the line start
Source code in pzp/line_editor.py
51 52 53 54 |
|
delete_backward_char()
Delete the previous character
Source code in pzp/line_editor.py
61 62 63 64 65 66 |
|
delete_char()
Delete the current character
Source code in pzp/line_editor.py
68 69 70 71 72 |
|
end_of_line()
Move the cursor to the line end
Source code in pzp/line_editor.py
56 57 58 59 |
|
forward_char()
Move the cursor forward one character
Source code in pzp/line_editor.py
46 47 48 49 |
|
insert(ch)
Insert characters at the current cursor position
Source code in pzp/line_editor.py
35 36 37 38 39 |
|
print(screen)
Print the line and set the cursor position
Parameters:
Name | Type | Description | Default |
---|---|---|---|
screen |
Screen
|
Screen instance |
required |
Source code in pzp/line_editor.py
78 79 80 81 82 83 84 85 |
|
set_cursor_pos(cursor_pos)
Set cursor position (absolute)
Source code in pzp/line_editor.py
27 28 29 |
|