Skip to content

Commit

Permalink
Improved get out of tui mode
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmoreno committed Nov 26, 2024
1 parent 89d0d43 commit b8f6e58
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cli/rtpmidid-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from dataclasses import dataclass
import select
import termios
import tty
import shutil
import socket
Expand Down Expand Up @@ -163,6 +164,7 @@ class Tabs:
tab: Tabs = Tabs.ROUTES

def __init__(self, conn: Connection):
self.tty_settings = termios.tcgetattr(sys.stdin)
# terminal width and height from stty
self.conn = conn
width, height = shutil.get_terminal_size()
Expand Down Expand Up @@ -927,6 +929,7 @@ def top_loop(self):
finally:
self.print(self.ANSI_POP_SCREEN)
tty.setcbreak(sys.stdin)
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, self.tty_settings)
print("\033[?1049l", end="")
print("\n".join(str(x) for x in self.debug_lines if x))

Expand Down

0 comments on commit b8f6e58

Please sign in to comment.