-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpy_edit.py
More file actions
34 lines (28 loc) · 862 Bytes
/
py_edit.py
File metadata and controls
34 lines (28 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
"""
Terminal Text Editor - A complete vim-like text editor implementation
"""
import curses
import sys
from core.editor import Editor
def main(stdscr):
"""Main function for curses application"""
editor = Editor(stdscr)
# Load file if provided as argument
if len(sys.argv) > 1:
filename = sys.argv[1]
if editor.buffer.load_file(filename):
editor.status_bar.set_message(f"Loaded {filename}")
else:
editor.status_bar.set_message(f"New file: {filename}")
editor.buffer.filename = filename
editor.run()
if __name__ == "__main__":
try:
curses.wrapper(main)
except KeyboardInterrupt:
print("\nEditor closed.")
except Exception as e:
print(f"Error: {e}")
import traceback
traceback.print_exc()