Add sequences for toggling focus/paste modes
parent
81ac0c59f3
commit
c9470b59a1
2
chat.h
2
chat.h
|
@ -111,6 +111,8 @@ void handle(struct Message msg);
|
||||||
|
|
||||||
enum Heat { Cold, Warm, Hot };
|
enum Heat { Cold, Warm, Hot };
|
||||||
void uiInit(void);
|
void uiInit(void);
|
||||||
|
void uiShow(void);
|
||||||
|
void uiHide(void);
|
||||||
void uiDraw(void);
|
void uiDraw(void);
|
||||||
void uiShowID(size_t id);
|
void uiShowID(size_t id);
|
||||||
void uiWrite(size_t id, enum Heat heat, const struct tm *time, const char *str);
|
void uiWrite(size_t id, enum Heat heat, const struct tm *time, const char *str);
|
||||||
|
|
19
ui.c
19
ui.c
|
@ -136,6 +136,24 @@ enum {
|
||||||
KeyPasteOff,
|
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) {
|
static void disableFlowControl(void) {
|
||||||
struct termios term;
|
struct termios term;
|
||||||
int error = tcgetattr(STDOUT_FILENO, &term);
|
int error = tcgetattr(STDOUT_FILENO, &term);
|
||||||
|
@ -174,6 +192,7 @@ void uiInit(void) {
|
||||||
keypad(input, true);
|
keypad(input, true);
|
||||||
nodelay(input, true);
|
nodelay(input, true);
|
||||||
windows.active = windowFor(Network);
|
windows.active = windowFor(Network);
|
||||||
|
//uiShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void uiDraw(void) {
|
void uiDraw(void) {
|
||||||
|
|
Loading…
Reference in New Issue