fix: Prevent terminal-specific mouse handling crash for nsterm
This commit is contained in:
parent
96f7b80226
commit
7f34cd86eb
8
gtm2.py
8
gtm2.py
|
|
@ -649,9 +649,11 @@ def main(stdscr, filename, show_diff, show_add, show_del, mouse):
|
|||
if state.enable_mouse:
|
||||
curses.mousemask(curses.ALL_MOUSE_EVENTS | curses.REPORT_MOUSE_POSITION)
|
||||
# Enable mouse motion events for better drag tracking
|
||||
# This escape code is not supported by all terminals (e.g., nsterm)
|
||||
if os.environ.get("TERM") != "nsterm":
|
||||
try:
|
||||
print("\033[?1003h", end="", flush=True)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
state.load_commit_content()
|
||||
|
|
@ -686,9 +688,11 @@ def main(stdscr, filename, show_diff, show_add, show_del, mouse):
|
|||
|
||||
# Disable mouse motion events when exiting
|
||||
if state.enable_mouse:
|
||||
# This escape code is not supported by all terminals (e.g., nsterm)
|
||||
if os.environ.get("TERM") != "nsterm":
|
||||
try:
|
||||
print("\033[?1003l", end="", flush=True)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Reference in New Issue