diff --git a/gtm2.py b/gtm2.py index 150abf8..abeaba4 100755 --- a/gtm2.py +++ b/gtm2.py @@ -649,10 +649,12 @@ 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 - try: - print("\033[?1003h", end="", flush=True) - except: - pass + # 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 Exception: + pass state.load_commit_content() @@ -686,10 +688,12 @@ def main(stdscr, filename, show_diff, show_add, show_del, mouse): # Disable mouse motion events when exiting if state.enable_mouse: - try: - print("\033[?1003l", end="", flush=True) - except: - pass + # 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 Exception: + pass if __name__ == "__main__": parser = argparse.ArgumentParser(description="A \"Git Time Machine\" for viewing file history")