summaryrefslogtreecommitdiff
path: root/chinese/mutt/files/patch-pager.c
diff options
context:
space:
mode:
authorVanilla I. Shu <vanilla@FreeBSD.org>2016-12-02 03:41:46 +0000
committerVanilla I. Shu <vanilla@FreeBSD.org>2016-12-02 03:41:46 +0000
commit951bf73705e853855ae55c00c5a45b7f709a1b34 (patch)
treec2ad8af49564883b40496a039de06f0e79438ca9 /chinese/mutt/files/patch-pager.c
parenttextproc/codespell: Update to version 1.8. (diff)
Fix building with mutt-1.7.2.
MFH: 2016Q4
Notes
Notes: svn path=/head/; revision=427541
Diffstat (limited to 'chinese/mutt/files/patch-pager.c')
-rw-r--r--chinese/mutt/files/patch-pager.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/chinese/mutt/files/patch-pager.c b/chinese/mutt/files/patch-pager.c
new file mode 100644
index 000000000000..dd389965048a
--- /dev/null
+++ b/chinese/mutt/files/patch-pager.c
@@ -0,0 +1,41 @@
+--- pager.c.orig 2016-10-09 03:35:50.000000000 +0800
++++ pager.c 2016-12-02 11:21:36.940396000 +0800
+@@ -20,6 +20,10 @@
+ # include "config.h"
+ #endif
+
++/*
++ * Trad. Chinese support by Michael Hsin <mhsin@mhsin.org>
++ */
++
+ #include "mutt.h"
+ #include "mutt_curses.h"
+ #include "mutt_regex.h"
+@@ -1101,7 +1105,7 @@ static int format_line (struct line_t **
+ int space = -1; /* index of the last space or TAB */
+ int col = option (OPTMARKERS) ? (*lineInfo)[n].continuation : 0;
+ size_t k;
+- int ch, vch, last_special = -1, special = 0, t;
++ int ch, vch, last_special = -1, special = 0, t = 0, old_t = 0;
+ wchar_t wc;
+ mbstate_t mbstate;
+ int wrap_cols = mutt_window_wrap_cols (pager_window, (flags & MUTT_PAGER_NOWRAP) ? 0 : Wrap);
+@@ -1223,7 +1227,10 @@ static int format_line (struct line_t **
+ * attempt to wrap at this character. */
+ wc = ' ';
+ }
++ old_t = t;
+ t = wcwidth (wc);
++ if (t > 1 || old_t > 1)
++ space = ch;
+ if (col + t > wrap_cols)
+ break;
+ col += t;
+@@ -1447,6 +1454,7 @@ display_line (FILE *f, LOFF_T *last_pos,
+ {
+ buf_ptr = buf + ch;
+ /* skip trailing blanks */
++ ch--;
+ while (ch && (buf[ch] == ' ' || buf[ch] == '\t' || buf[ch] == '\r'))
+ ch--;
+ /* a very long word with leading spaces causes infinite wrapping */