Set log marker on FocusOut event

All of this needs refactoring, probably separating the line editing out
from the actual input handling.
weechat-hashes
Curtis McEnroe 2018-08-08 00:55:45 -04:00
parent c0ee457ab1
commit b66c8abf70
No known key found for this signature in database
GPG Key ID: CEA2F97ADCFCD77C
1 changed files with 23 additions and 0 deletions

23
ui.c
View File

@ -20,6 +20,7 @@
#include <err.h>
#include <locale.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -39,6 +40,15 @@
#define A_ITALIC A_NORMAL
#endif
static void focusEnable(void) {
printf("\33[?1004h");
fflush(stdout);
}
static void focusDisable(void) {
printf("\33[?1004l");
fflush(stdout);
}
static void colorInit(void) {
start_color();
use_default_colors();
@ -98,6 +108,7 @@ void uiInit(void) {
cbreak();
noecho();
focusEnable();
colorInit();
ui.topic = newpad(2, TOPIC_COLS);
@ -123,6 +134,7 @@ static void uiResize(void) {
}
void uiHide(void) {
focusDisable();
endwin();
printf(
"This program is AGPLv3 free software!\n"
@ -427,6 +439,17 @@ static void complete(void) {
}
static void keyChar(wint_t ch) {
static bool esc, csi;
if (csi) {
csi = false;
if (ch == L'O') logMark();
return;
}
csi = (esc && ch == L'[');
esc = (ch == L'\33');
if (csi) return;
switch (ch) {
break; case CTRL('L'): uiRedraw();
break; case CTRL('B'): reject(); left();