prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.37k stars 716 forks source link

Handle decomposed unicode characters. #274

Open jonathanslenders opened 8 years ago

jonathanslenders commented 8 years ago

See: https://github.com/ipython/ipython/pull/9378

jonathanslenders commented 8 years ago

See also: https://github.com/ipython/ipython/issues/9376#issuecomment-206464016

jonathanslenders commented 8 years ago

The first part has been implemented in: https://github.com/jonathanslenders/python-prompt-toolkit/commit/f311c7524a318ba2bf264bc2024388706e0485e8

Cursor movement still needs to be done. Right now it's still possible to position the cursor in the middle of the decomposed character.

randy3k commented 6 years ago

See https://github.com/ipython/ipython/issues/9376#issuecomment-394802297

It seems that it doesn't work for double width chars.

screen shot 2018-06-05 at 1 53 02 pm
'你̂好̄嗎̃'
jonathanslenders commented 6 years ago

Hi @randy3k, thanks for noticing! This commit should fix that: https://github.com/jonathanslenders/python-prompt-toolkit/commit/c6ebc96aa3278a6136d76e4ba98308044293a8a2 Can you please try again?

Notice that it still requires multiple cursor movements (left/right arrow) to move across these characters.