'r', 100, HELPCTX(translation_codepage),
codepage_handler, P(NULL), P(NULL));
+ s = ctrl_getset(b, "Window/Translation", "tweaks", NULL);
+ ctrl_checkbox(s, "Treat CJK ambiguous characters as wide", 'w',
+ HELPCTX(translation_cjk_ambig_wide),
+ dlg_stdcheckbox_handler, I(offsetof(Config,cjk_ambig_wide)));
+
str = dupprintf("Adjust how %s handles line drawing characters", appname);
s = ctrl_getset(b, "Window/Translation", "linedraw", str);
sfree(str);
underlying version of Windows has the appropriate translation table
installed, PuTTY will use it.
+\S{config-cjk-ambig-wide} \q{Treat CJK ambiguous characters as wide}
+
+\cfg{winhelp-topic}{translation.cjkambigwide}
+
+There are \I{East Asian Ambiguous characters}some Unicode characters
+whose width is not well-defined. In most contexts, such characters
+should be treated as single-width for the purposes of wrapping and so
+on; however, in some CJK contexts, they are better treated as
+double-width for historical reasons, and some server-side applications
+may expect them to be displayed as such. Setting this option will
+cause PuTTY to take the double-width interpretation.
+
+If you use legacy CJK applications, and you find your lines are
+wrapping in the wrong places, or you are having other display
+problems, you might want to play with this setting.
+
+This option only has any effect in UTF-8 mode (see \k{config-charset}).
+
\S{config-cyr} \q{Caps Lock acts as Cyrillic switch}
\cfg{winhelp-topic}{translation.cyrillic}
/* translations */
int vtmode;
char line_codepage[128];
+ int cjk_ambig_wide;
int utf8_override;
int xlat_capslockcyr;
/* X11 forwarding */
*/
int wcwidth(wchar_t ucs);
int wcswidth(const wchar_t *pwcs, size_t n);
+int wcwidth_cjk(wchar_t ucs);
+int wcswidth_cjk(const wchar_t *pwcs, size_t n);
/*
* Exports from mscrypto.c
write_setting_s(sesskey, buf, buf2);
}
write_setting_s(sesskey, "LineCodePage", cfg->line_codepage);
+ write_setting_i(sesskey, "CJKAmbigWide", cfg->cjk_ambig_wide);
write_setting_i(sesskey, "UTF8Override", cfg->utf8_override);
write_setting_s(sesskey, "Printer", cfg->printer);
write_setting_i(sesskey, "CapsLockCyr", cfg->xlat_capslockcyr);
*/
gpps(sesskey, "LineCodePage", "", cfg->line_codepage,
sizeof(cfg->line_codepage));
+ gppi(sesskey, "CJKAmbigWide", 0, &cfg->cjk_ambig_wide);
gppi(sesskey, "UTF8Override", 1, &cfg->utf8_override);
gpps(sesskey, "Printer", "", cfg->printer, sizeof(cfg->printer));
gppi (sesskey, "CapsLockCyr", 0, &cfg->xlat_capslockcyr);
if (DIRECT_CHAR(c))
width = 1;
if (!width)
- width = wcwidth((wchar_t) c);
+ width = (term->cfg.cjk_ambig_wide ?
+ wcwidth_cjk((wchar_t) c) :
+ wcwidth((wchar_t) c));
if (term->wrapnext && term->wrap && width > 0) {
cline->lattr |= LATTR_WRAPPED;
عن \e[44mجرير\e[m \e[41mرضي\e[m الله عنه قال قال رسول الله صلى الله عليه
وسلم: بني الاسلام على خمس شهادة ان لا اله الا الله واقام
Mixed LTR and RTL text: \e[44mجرير\e[m \e[41mرضي\e[m back to LTR.
+
+East Asian Ambiguous characters: ¼½¾¼½¾¼½¾¼½¾¼½¾¼½¾¼½¾¼½¾¼½¾¼½¾
return width;
}
-#if 0 /* RDB: we don't need the cjk version */
/*
* The following function is the same as wcwidth(), except that
* spacing characters in the East Asian Ambiguous (A) category as
* encodings who want to migrate to UCS. It is not otherwise
* recommended for general use.
*/
-static int wcwidth_cjk(wchar_t ucs)
+int wcwidth_cjk(wchar_t ucs)
{
/* sorted list of non-overlapping intervals of East Asian Ambiguous
* characters */
return width;
}
-#endif
* the least we can do is ensure it never makes it to any other
* platform (at least unless someone fixes it!).
*/
- s = ctrl_getset(b, "Window/Translation", "input",
- "Enable character set translation on input data");
+ s = ctrl_getset(b, "Window/Translation", "tweaks", NULL);
ctrl_checkbox(s, "Caps Lock acts as Cyrillic switch", 's',
HELPCTX(translation_cyrillic),
dlg_stdcheckbox_handler,
#define WINHELP_CTX_colours_logpal "colours.logpal"
#define WINHELP_CTX_colours_config "colours.config"
#define WINHELP_CTX_translation_codepage "translation.codepage"
+#define WINHELP_CTX_translation_cjk_ambig_wide "translation.cjkambigwide"
#define WINHELP_CTX_translation_cyrillic "translation.cyrillic"
#define WINHELP_CTX_translation_linedraw "translation.linedraw"
#define WINHELP_CTX_ssh_tunnels_x11 "ssh.tunnels.x11"