Commit Diff


commit - b66b4b89921398b7c7a69fa193c76b175ab940b3
commit + 421bca4a5cbe62b1a1e69c914a018f643dc71b4c
blob - f7ccfde138d0c9e480b86947d47b87e817f584d7
blob + 0ea606482b47905c55b84be2416315afe82a5f1a
--- utf8.c
+++ utf8.c
@@ -121,7 +121,7 @@ utf8_cplen(char *s)
 	return len;
 }
 
-/* returns only 0, 1 or 2.  assumes sizeof(wchar_t) is 4 */
+/* returns only 0, 1, 2 or 8.  assumes sizeof(wchar_t) is 4 */
 size_t
 utf8_chwidth(uint32_t cp)
 {
@@ -131,6 +131,14 @@ utf8_chwidth(uint32_t cp)
 	 * it must use UTF-16... right? */
 	assert(sizeof(wchar_t) == 4);
 
+	/*
+	 * quick and dirty fix for the tabs.  In the future we may
+	 * want to expand tabs into N spaces, but for the time being
+	 * this seems to be good enough (tm).
+	 */
+	if (cp == '\t')
+		return 8;
+
 	return wcwidth((wchar_t)cp);
 }