about summary refs log tree commit diff
path: root/input.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--input.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/input.c b/input.c
index 28349f4..a74335e 100644
--- a/input.c
+++ b/input.c
@@ -158,10 +158,15 @@ static char *inputStop(
 	return stop;
 }
 
+static size_t cap;
+static char *buf;
+
 void inputUpdate(void) {
 	uint id = windowID();
-	char *buf = editString(&edits[id]);
-	if (!buf) err(EX_OSERR, "editString");
+
+	size_t pos = 0;
+	const char *ptr = editString(&edits[id], &buf, &cap, &pos);
+	if (!ptr) err(EX_OSERR, "editString");
 
 	const char *prefix = "";
 	const char *prompt = self.nick;
@@ -192,7 +197,7 @@ void inputUpdate(void) {
 	} else {
 		prompt = "";
 	}
-	if (skip > &buf[edits[id].mbs.pos]) {
+	if (skip > &buf[pos]) {
 		prefix = prompt = suffix = "";
 		skip = buf;
 	}
@@ -209,14 +214,14 @@ void inputUpdate(void) {
 	waddstr(uiInput, suffix);
 	getyx(uiInput, y, x);
 
-	int pos;
+	int posx;
 	struct Style style = styleInput;
-	inputStop(styleInput, &style, skip, &buf[edits[id].mbs.pos]);
-	getyx(uiInput, y, pos);
+	inputStop(styleInput, &style, skip, &buf[pos]);
+	getyx(uiInput, y, posx);
 	wmove(uiInput, y, x);
 
+	ptr = skip;
 	style = styleInput;
-	const char *ptr = skip;
 	if (split) {
 		ptr = inputStop(styleInput, &style, ptr, &buf[split]);
 		style = styleInput;
@@ -224,7 +229,7 @@ void inputUpdate(void) {
 	}
 	inputAdd(styleInput, &style, ptr);
 	wclrtoeol(uiInput);
-	wmove(uiInput, y, pos);
+	wmove(uiInput, y, posx);
 }
 
 bool inputPending(uint id) {
@@ -381,7 +386,7 @@ fail:
 
 static void inputEnter(void) {
 	uint id = windowID();
-	char *cmd = editString(&edits[id]);
+	char *cmd = editString(&edits[id], &buf, &cap, NULL);
 	if (!cmd) err(EX_OSERR, "editString");
 
 	tabAccept();
@@ -459,8 +464,8 @@ static void keyCtrl(wchar_t ch) {
 		break; case L'L': clearok(curscr, true);
 		break; case L'N': windowShow(windowNum() + 1);
 		break; case L'P': windowShow(windowNum() - 1);
-		break; case L'R': windowSearch(editString(edit), -1);
-		break; case L'S': windowSearch(editString(edit), +1);
+		break; case L'R': windowSearch(editString(edit, &buf, &cap, NULL), -1);
+		break; case L'S': windowSearch(editString(edit, &buf, &cap, NULL), +1);
 		break; case L'T': error = editFn(edit, EditTranspose);
 		break; case L'U': error = editFn(edit, EditDeleteHead);
 		break; case L'V': windowScroll(ScrollPage, -1);
2018-09-13Return a format->split even at the end of the stringJune McEnroe 2018-09-13Fix weird tab-complete after commaJune McEnroe I have no idea why I did this. 2018-09-13Rewrite UI againJune McEnroe The persistent topic is gone and the status line is now at the top. The status formatting still needs to be reworked. I also want to try showing the nick in the input window so it really looks like your next message. 2018-09-12Add note about C-oJune McEnroe Why are there so few well usable ctrl key bindings? 2018-09-12Use formatParse split to position input cursorJune McEnroe 2018-09-12Factor out IRC formatting parsingJune McEnroe 2018-09-11Add /help equivalent to /manJune McEnroe 2018-09-11Don't render every PM as a pingJune McEnroe 2018-09-11Add urlOpenMatchJune McEnroe 2018-09-10Depend on man.sh for chroot.tar targetJune McEnroe 2018-09-10Set LESSSECURE=1 in man.shJune McEnroe Ridiculous. 2018-09-10Add /man commandJune McEnroe 2018-09-10Install man page in chrootJune McEnroe 2018-09-10Install man pageJune McEnroe 2018-09-10Split keys into subsections and document colorsJune McEnroe 2018-09-10Add "blank" lines to chatte.1June McEnroe 2018-09-10Document key bindings in chatte.1June McEnroe 2018-09-08Document slash commands in chatte.1June McEnroe