summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-08 00:55:45 -0400
committerJune McEnroe <june@causal.agency>2018-08-08 00:55:45 -0400
commitb66c8abf707e6574f6867b646dfb2549a5a7147f (patch)
tree438c3fc6eeea32b1764b97cbc94810bb5bf026c6
parentColor own messages 15 (diff)
downloadcatgirl-b66c8abf707e6574f6867b646dfb2549a5a7147f.tar.gz
catgirl-b66c8abf707e6574f6867b646dfb2549a5a7147f.zip
Set log marker on FocusOut event
All of this needs refactoring, probably separating the line editing out
from the actual input handling.
-rw-r--r--ui.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/ui.c b/ui.c
index cc7dcf8..937fa63 100644
--- a/ui.c
+++ b/ui.c
@@ -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();
-10Replace most uses of strncmp() with prefixcmp()Lukas Fleischer This is a preparation for replacing all prefix checks with either strip_prefix() or starts_with() when Git 1.8.6 is released. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2014-01-09README: Fix dependenciesLukas Fleischer * Remove the dependency on Git (which can be obtained automatically when building, using either the Git submodule or `make get-git`). * Use proper upstream names of dependencies. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2014-01-08README: Spelling and formatting fixesLukas Fleischer * Several small spelling and capitalization fixes. * Use consistent and better-looking formatting that is compatible with AsciiDoc (and partly compatible with RST). Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de> 2014-01-08Fix UTF-8 with syntax-highlighting.pyPřemysl Janouch Previously the script tried to encode output from Pygments with the ASCII codec, which failed. Signed-off-by: Přemysl Janouch <p.janouch@gmail.com> 2014-01-08Add a suggestion to the manpagePřemysl Janouch So that people wishing to use "enable-http-clone" don't have to find out the correct settings on their own. Signed-off-by: Přemysl Janouch <p.janouch@gmail.com> 2014-01-08Fix the example configurationPřemysl Janouch "enable-git-clone" doesn't exist, replaced with "enable-http-clone". Signed-off-by: Přemysl Janouch <p.janouch@gmail.com> 2014-01-08Fix about-formatting.shPřemysl Janouch dash failed to parse the script. Signed-off-by: Přemysl Janouch <p.janouch@gmail.com> 2014-01-08Fix some spelling errorsPřemysl Janouch Signed-off-by: Přemysl Janouch <p.janouch@gmail.com> 2014-01-08filters: highlight.sh: add css comments for highlight 2.6 and 3.8Ferry Huberts