1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-15 01:57:40 -05:00

Add line-length limit feature in StripCtrlChars.

Now it can optionally check that output lines don't go beyond a
certain length (measured in terminal columns, via wcwidth, rather than
bytes or characters). In this mode, lines are prefixed with a
distinctive character (namely '|'), and if a line is too long, then it
is broken and the continuation line gets a different prefix ('>').

When StripCtrlChars is targeting a terminal, it asks the terminal to
call wcwidth on its behalf, so it can be sure to use the same idea as
the real terminal about which characters are wide (i.e. depending on
the configuration of ambiguous characters).

This mode isn't yet used anywhere.
This commit is contained in:
Simon Tatham
2019-03-09 16:45:12 +00:00
parent da1c8f15b1
commit 3936616feb
5 changed files with 61 additions and 5 deletions

View File

@ -344,6 +344,10 @@ static inline bool in_utf(Terminal *term)
unsigned long term_translate(
Terminal *term, term_utf8_decode *utf8, unsigned char c);
static inline int term_char_width(Terminal *term, unsigned int c)
{
return term->cjk_ambig_wide ? mk_wcwidth_cjk(c) : mk_wcwidth(c);
}
/*
* UCSINCOMPLETE is returned from term_translate if it's successfully