summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui.c')
-rw-r--r--ui.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/ui.c b/ui.c
index e2746f1..d69e706 100644
--- a/ui.c
+++ b/ui.c
@@ -14,6 +14,8 @@
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
 
+#define _XOPEN_SOURCE_EXTENDED
+
 #include <assert.h>
 #include <ctype.h>
 #include <curses.h>
@@ -192,7 +194,7 @@ void uiInit(void) {
 	keypad(input, true);
 	nodelay(input, true);
 	windows.active = windowFor(Network);
-	//uiShow();
+	uiShow();
 }
 
 void uiDraw(void) {
@@ -397,3 +399,44 @@ void uiFormat(
 	assert((size_t)len < sizeof(buf));
 	uiWrite(id, heat, time, buf);
 }
+
+static void keyCode(int code) {
+	switch (code) {
+		break; case KEY_RESIZE:; // TODO
+		break; case KeyFocusIn:; // TODO
+		break; case KeyFocusOut: windows.active->mark = true;
+		break; case KeyPasteOn:; // TODO
+		break; case KeyPasteOff:; // TODO
+	}
+}
+
+static void keyMeta(wchar_t ch) {
+	switch (ch) {
+		break; case L'm': uiWrite(windows.active->id, Cold, NULL, "");
+	}
+}
+
+static void keyChar(wchar_t ch) {
+	switch (ch) {
+		break; case CTRL(L'L'): clearok(curscr, true);
+	}
+}
+
+void uiRead(void) {
+	int ret;
+	wint_t ch;
+	static bool meta;
+	while (ERR != (ret = wget_wch(input, &ch))) {
+		if (ret == KEY_CODE_YES) {
+			keyCode(ch);
+		} else if (ch == '\33') {
+			meta = true;
+			continue;
+		} else if (meta) {
+			keyMeta(ch);
+		} else {
+			keyChar(ch);
+		}
+		meta = false;
+	}
+}
words in colorMentionsJune McEnroe This lets phrases like "hi june" get colored, but still doesn't get carried away. 2020-02-11Use time_t for save signatureJune McEnroe It's actually more likely to be 64-bit than size_t anyway, and it eliminates some helper functions. Also don't error when reading an empty save file. 2020-02-11Set self.nick to * initiallyJune McEnroe Allows removing a bunch of checks that self.nick is set, and it's what the server usually calls you before registration. Never highlight notices as mentions. 2020-02-11Define ColorCap instead of hardcoding 100June McEnroe 2020-02-11Move hash to top of chat.hJune McEnroe 2020-02-11Move base64 out of chat.hJune McEnroe 2020-02-11Move XDG_SUBDIR out of chat.hJune McEnroe 2020-02-11Fix whois idle unit calculationJune McEnroe Rookie mistake. 2020-02-11Cast towupper to wchar_tJune McEnroe For some reason it takes and returns wint_t... 2020-02-11Cast set but unused variables to voidJune McEnroe 2020-02-11Declare strlcatJune McEnroe 2020-02-11Check if VDSUSP existsJune McEnroe 2020-02-11Fix completeReplace iterationJune McEnroe 2020-02-11Use pkg(8) to configure on FreeBSDJune McEnroe 2020-02-11Remove legacy codeJune McEnroe 2020-02-11Add INSTALLING section to READMEJune McEnroe