summary refs log tree commit diff
path: root/ui.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ui.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ui.c b/ui.c
index b1e56c7..0e22fd8 100644
--- a/ui.c
+++ b/ui.c
@@ -193,6 +193,14 @@ static void addFormat(WINDOW *win, const struct Format *format) {
 	waddnwstr(win, format->str, format->len);
 }
 
+static int printWidth(const wchar_t *str, size_t len) {
+	int width = 0;
+	for (size_t i = 0; i < len; ++i) {
+		if (iswprint(str[i])) width += wcwidth(str[i]);
+	}
+	return width;
+}
+
 static int addWrap(WINDOW *win, const wchar_t *str) {
 	int lines = 0;
 
@@ -205,7 +213,7 @@ static int addWrap(WINDOW *win, const wchar_t *str) {
 		int _, x, xMax;
 		getyx(win, _, x);
 		getmaxyx(win, _, xMax);
-		if (xMax - x - 1 < wcswidth(format.str, format.len)) {
+		if (xMax - x - 1 < printWidth(format.str, word)) {
 			if (format.str[0] == L' ') {
 				format.str++;
 				format.len--;
hat.c?h=1.9&id=5522529e839e7e4a2c4b7379d277d464fcb07f2b&follow=1'>Word all status messages in presentJune McEnroe 2018-08-03Handle inputJune McEnroe This turned out a lot better than expected. Still a long way to go in terms of line-editing, but at least backspace works! 2018-08-03Track own usernameJune McEnroe So that we can colour our own messages correctly. 2018-08-03Use a wide pad for the topicJune McEnroe 2018-08-03Ignore NOTICEs not sent to the channelJune McEnroe 2018-08-03Handle KICK and NICKJune McEnroe 2018-08-03Continue on EINTR from pollJune McEnroe Resizing the terminal causes it. 2018-08-03Handle ACTIONsJune McEnroe 2018-08-03Use more octal char literalsJune McEnroe I might be coming around to octal. 2018-08-03Send a WHO in response to NAMES to get usernamesJune McEnroe Other than this slight hack, I think coloring by username rather than nick is a much better idea. 2018-08-03Colorize nicks and channelsJune McEnroe 2018-08-03Add support for mIRC colorsJune McEnroe 2018-08-03Handle bold, italic, underlineJune McEnroe 2018-08-03Add prift function for "prefix shift"June McEnroe Forgive me. 2018-08-03Link with -lcurseswJune McEnroe 2018-08-02Use libtls "compat" ciphersJune McEnroe irc.mozilla.org, using GnuTLS, doesn't support *any* of the "secure" ciphers! 2018-08-02Add UI and handle some kinds of server messagesJune McEnroe Seems like handling input is going to be the worst thing ever. 2018-08-02Add chroot.tar targetJune McEnroe