Re: Chinese input causes mess in the REPL

2018-01-25 Thread Alexander Burger
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 
> this:
> : ((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
characters.

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
> position?

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?

♪♫ Alex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Chinese input causes mess in the REPL

2018-01-25 Thread Enwei Zhang
Hello,

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.

I found a defect about Chinese language supporting, under Mac OS X 32bit, and 
Arm 64bit version(in Termux), but Java version is OK.

It is, for example, when I input (setq x "你好"), the REPL will display like this:
: ((s(s(s(s(s(setq x "你好")
-> "你好"
:
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 
position?

Thanks a lot!

Zhang Enwei