Add sequences for toggling focus/paste modes

weechat-hashes
C. McEnroe 2020-02-02 23:20:19 -05:00
parent 81ac0c59f3
commit c9470b59a1
2 changed files with 21 additions and 0 deletions

2
chat.h
View File

@ -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
View File

@ -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) {