Markus,
To erase a character in a line in canonical mode input processing in kernel,
you need to know byte length and screen width so that the character will be
erase correctly in the line buffer. There is no absolute relationship
between the byte length and the screen column width in case of UTF-8
characters unlike EUC and or many other PC codepage based multibyte coded
character sets. I.e., a two byte UTF-8 character can have 0, 1, or 2 as
it's screen column width.
Furthemore, there are word and line erases in addition to a simple backspace
that also require to know exact screen column widths.
For non-canonical mode, yes, you don't need to have this processing since
user space client will take care of it but that's just half of the story.
With regards,
Ienup
] X-URL: http://www.cl.cam.ac.uk/~mgk25/
] Date: Thu, 25 Jan 2001 11:18:40 +0000
] From: Markus Kuhn <[EMAIL PROTECTED]>
] Subject: Re: kernel tty patches
] To: [EMAIL PROTECTED]
] MIME-version: 1.0
]
] Robert Brady wrote on 2001-01-24 16:55 UTC:
] > > My opinion is slightly different: it must, but this is a very
] > > low-priority item. It will, eventually, I think.
] >
] > Even if this entails having a wcwidth() table in-kernel?
]
] Please think again everybody:
]
] Even though the tty cooked mode editor has to know how long a multi-byte
] character is (i.e., it has to be aware of UTF-8), it does *NOT* have to
] be aware in any way of character width or line length. It doesn't do
] absolute cursor position control, it only uses backspace and line feed.
]
] There is *NO* need to have a wcwidth table in the kernel!
]
] If you press backspace after a multi-byte charcater, the kernel will
] remove all bytes representing the previous character from the edit
] buffer and echo the backspace to the terminal. Only the terminal has to
] know, how wide the previous character was, in order to execute the
] backspace correctly. The terminal can look up what the previous
] character was in the charcell buffer and it has access to wcwidth.
]
] The fact that the tty editor is an order of magnitude more trivial than
] readline and unaware of cursor position simplifies things tremendously
] here.
]
] Markus
]
] --
] Markus G. Kuhn, Computer Laboratory, University of Cambridge, UK
] Email: mkuhn at acm.org, WWW: <http://www.cl.cam.ac.uk/~mgk25/>
]
] -
] Linux-UTF8: i18n of Linux on all levels
] Archive: http://mail.nl.linux.org/lists/
-
Linux-UTF8: i18n of Linux on all levels
Archive: http://mail.nl.linux.org/lists/