public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: wcwidth and terminals [Re: Mg3a - a version of Mg2a developed on Cygwin]
Date: Fri, 25 Feb 2011 11:06:00 -0000	[thread overview]
Message-ID: <20110225110530.GX9392@calimero.vinschen.de> (raw)
In-Reply-To: <4D6762B5.3000204@towo.net>

On Feb 25 09:05, Thomas Wolff wrote:
> Am 24.02.2011 09:56, schrieb Corinna Vinschen:
> >When on Cygwin, you might better use Cygwin's(*) wcwidth function.  It's
> >based on the same code from Markus Kuhn, but it interacts with the
> >setlocale function to make sure that the width returned for the CJK
> >ambiguous width characters makes sense in the given locale.  Plus, it
> >supports a Cygwin-specific locale modifier '@cjknarrow' which allows the
> >user to modify this behaviour.  When using your own wcwidth, you're
> >giving up on this feature.
> On the other hand, not specific for cygwin, the wcwidth/wcswidht
> functions are in general based on installed locale data.
> But you can never know whether the terminal you are running in
> actually uses those data.
> On a Linux system, you may encounter a wide range of different
> environments, for example:
> rxvt based on system locale which is often based on an outdated
> locale data installation (e.g. Unicode 3)
> xterm with a hard-coded wcwidth
> mlterm with some tweaks
> remote operation (rlogin/ssh to/from other system) with inconsistent
> locale data base
> ...
> 
> For that reason, my editor mined implements an auto-detection of
> actual terminal width data (checking Unicode version and a number of
> terminal-specific odds).
> 
> For cygwin, it might be useful (although not standard) for wcwidth
> to consider whether it's running in a cygwin console or a terminal,
> so e.g. wcwidth (0x8080) should return 2 in mintty but 1 in a cygwin
> console.

Hmm, I don't think that's the right thing to do.  How's the OS version
of wcwidht supposed to know what the wcwidth function is used for?
After all, the application does *not* specify that it calls wcwidth
to get the size of a character for a specifc purpose.  How's the function
to know that the character is supposed to be printed to the current tty?
What if the application has open handles to more than one tty?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2011-02-25 11:06 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23  8:57 Mg3a - a version of Mg2a developed on Cygwin Bengt Larsson
2011-02-23  9:11 ` Bengt Larsson
2011-02-23  9:29   ` Corinna Vinschen
2011-02-23  9:33     ` Bengt Larsson
2011-02-23 18:25 ` Buchbinder, Barry (NIH/NIAID) [E]
2011-02-23 18:53   ` Andrew Schulman
2011-02-23 19:36     ` Bengt Larsson
2011-02-24  8:56       ` Corinna Vinschen
2011-02-24 10:56         ` Bengt Larsson
2011-02-24 11:15           ` Corinna Vinschen
2011-02-24 11:40             ` Bengt Larsson
2011-02-24 11:55               ` Corinna Vinschen
2011-02-24 12:16             ` Andy Koppe
2011-02-24 18:51               ` Bengt Larsson
2011-02-25  2:24                 ` Cyrille Lefevre
2011-02-25  2:25                   ` Cyrille Lefevre
2011-02-25  6:48                     ` Bengt Larsson
2011-02-25  6:47                   ` Bengt Larsson
2011-02-25  6:55                     ` Kenneth Wolcott
2011-02-25 14:09                       ` Bengt Larsson
2011-02-25 21:46                         ` Bengt Larsson
2011-02-26  2:48                           ` Kenneth Wolcott
2011-02-24 11:19           ` Bengt Larsson
2011-02-24 11:51             ` Corinna Vinschen
2011-02-24 14:48               ` Eric Blake
2011-02-25  8:05         ` wcwidth and terminals [Re: Mg3a - a version of Mg2a developed on Cygwin] Thomas Wolff
2011-02-25 11:06           ` Corinna Vinschen [this message]
2011-02-26  9:52             ` Andy Koppe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110225110530.GX9392@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).