Hello Zhang Enwei,
> I'm studying and using PicoLisp, and trying to make it a regular dev tool in
> my daily development. It's some difficult but quite interesting for me.
Glad to hear that!
> I found a defect about Chinese language supporting, under Mac OS X 32bit, and
> Arm 64bit version(in Termux), but Java version is OK.
Yes, I know :( I've observed it with Japanese (Kanji and kana) input too.
> It is, for example, when I input (setq x "你好"), the REPL will display like
> : ((s(s(s(s(s(setq x "你好")
> -> "你好"
Right. It is the line editor in @lib/led.l, which cannot handle characters
taking up two places on the screen. To do it correctly, it would need to output
*two* backspaces, but the line editor doesn't know the width of these
ErsatzLisp, the Java version, does not have this problem, because it uses no
line editor ;)
In normal PicoLisp it is only in debug mode, because this loads the line editor.
Production mode PicoLisp (i.e. started without '+') should be clean in this
regard, but not very useful.
> The result is OK, but the display is messy.
> I'd like to try to solve this issue, would anyone like to tell me the code
It is in some places, most importantly in the places in @lib/led.l where
backspaces are output, of the form like
(do D (prin "^H"))
There is no easy fix. PicoLisp lacks the functionality to calculate the width of
unicode characters. I suppose it needs some extra character tables and lookup
mechanisms in the base system, or perhaps call an external C function via
'native'. Any suggestions?