summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
authorC. McEnroe2020-02-02 23:20:19 -0500
committerC. McEnroe2020-02-02 23:20:19 -0500
commitc9470b59a151f639e7985ca545bd67182e7a88d8 (patch)
tree41634ef9323e19992fd8d23e3fd1d129f1baa37b /ui.c
parent81ac0c59f3ce68053d83462577bae7e57c21cc36 (diff)
Add sequences for toggling focus/paste modes
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ui.c b/ui.c
index b9aadec..072ee84 100644
--- a/ui.c
+++ b/ui.c
@@ -136,6 +136,24 @@ enum {
 	KeyPasteOff,
 };
 
+// XXX: Assuming terminals will be fine with these even if they're unsupported,
+// since they're "private" modes.
+static const char *EnterFocusMode = "\33[?1004h";
+static const char *ExitFocusMode  = "\33[?1004l";
+static const char *EnterPasteMode = "\33[?2004h";
+static const char *ExitPasteMode  = "\33[?2004l";
+
+void uiShow(void) {
+	putp(EnterFocusMode);
+	putp(EnterPasteMode);
+}
+
+void uiHide(void) {
+	putp(ExitFocusMode);
+	putp(ExitPasteMode);
+	endwin();
+}
+
 static void disableFlowControl(void) {
 	struct termios term;
 	int error = tcgetattr(STDOUT_FILENO, &term);
@@ -174,6 +192,7 @@ void uiInit(void) {
 	keypad(input, true);
 	nodelay(input, true);
 	windows.active = windowFor(Network);
+	//uiShow();
 }
 
 void uiDraw(void) {