Problem when trying to delete Chinese character

Hello,

For a simple console application in water,

Changed:

writeLn(“The magic happens here.”);

To something like:

writeLn(“你好.”);

Then If you try to delete “你” or “好” using the keyboard, you will see the problem, very difficult and water can not display the Chinese correctly. I can only use Notepad++ to edit the Chinese.

Regards,
Xiaoguang

Xiaoguang,

thanx for bringing this up!

I’m aware of a couple of issues with unicode characters in the code editor.

One is that the editor assumes the font to me mono-spaced, but even though it is, some characters draw at different widths, including Chinese ones. This causes the cursor to be drawn visually at a wrong offset not corresponding to the underlying test (ie if the cursor is at column 10, it will be drawn at 10x{character width}, and this appear too far to the left.

This isn’t as easy to solve as it might seem because, again, the editor code assumes it can rely on theca ebbing unicode.

I’m making some fixes now that will adjust the drawing to better reflect this, for the next build. The far tricker part will be to auto take this into account for cursor navigation and mouse clicks (eg preying custom down on column 10 of latin characters to a line with Chinese characters will, for now, still brung you to column 10 of the Chinese text (though visually that will mean your cursor did not move straight down, but a few characters to the right. Similar, clicking into a Chinese text will (for now) place the cursor on the column as determined by the latin character width, so again, the cursor will end up too far right.

But, at least, where you see the cursor will correspond to where it locally is, relative to the text, so you won’t get bad surprises when typing. I hope that’s a reasonable partial solution for now, until I find a full solution.

A somewhat related problem, this is even worse when using Unicode characters that are using surrogate pairs (eg emoji) or, worse, combined emoji. Again these will render correctly, but they throw off the cursor position even worse. This is not woo fixed (for single-part emojis), but what problem remains is that you can still place the cursor "in the middle’ of one, because it’s represented by two chars. This will need more work solving.

I’d like to send you new Water build later today to get your feedback on the changes I have made so far. What’s your remobjects.com account name?

thanx,
marc

Hi marc,

Thanks for the information you provided.

My remobject account name is: xiaoguang

I can test and provide the feedback.

Regards,
Xiaoguang

Thanx! I had to wait for some other fixes before I could merge and get you a build, but I’m doing creating one for you, now.

yours,
marc

No problem, it is not urgent.

We have nearly 12 hours time lag, I will test and provide feedback as early as possible.

1 Like

New build is up at https://www.remobjects.com/portal/downloads/personal now.

yours,
marc

My apologies; the built i sent you is missing once crucial commit from my fix; I’m doing a new one for you now, I’ll be called “2386B”.

Up now.

Just test the 2386B, it’s better, but there are still problems

  1. For example, currenly I have this line: Console.WriteLine(""); I try to add Chinese words 你好 inside “”,after typing 你好 together,the cursor is in the middle of 你好, I think it should after the word 好

  2. Difficult to use the mouse to set the cursor, I mean, for example:
    Console.WriteLine(“今天的天气不错”); //If you use the mouse to click at the space between 今 and 天 ,you will find it actually move to location between 天 and 的。So it is still difficult to delete word, but it is easier than the previous version

  3. The console output still does not show Chinese correctly

3 will never work, that’s not a Water but. the Windows console just does not handle Unicode. 2 is expected, as mentioned. mouse clicks don’t get remapped with the new logic yet.

i’m not sure i understand re 1, as that’s exactly what should have been fixed. is the cursor actually between the two chars, or does it just appear there (as before)? if the former, how do you type these, how can i reproduce this locally w/o having a chinese keyboard?

thanx

For 3, so it means I will always have to use VS for debugging in order to see the output?

For one, I mean:

Example 1:
%E5%9B%BE%E7%89%87
You can see the | is in the middle of 你

Then, I can only use the mouse to move | infront of ; or in the next line
%E5%9B%BE%E7%89%87

%E5%9B%BE%E7%89%87

So if I want to writer comment in the same line after Console.WriteLine(“你”); //My comments

It is impossible

Example2:
After typing “天空是蓝色的”, which means “The sky is blue” in English,


You see the | is in the middle, I think after typing, it should shows after the word “的”
%E5%9B%BE%E7%89%87

I am not sure if the problem is related to 2, but hope the above information is easy to understand.
No, don’t need a Chinese keyboad, actually in China, we all use US keyboad with our typing method.

ok, this doesn’t look like you have my fixes. sure you’re not still on 2385?

I am sure I am using 2386B, because I only download the B version, I do not download 2386

Both water and the control panel showing I am on 2386

%E5%9B%BE%E7%89%87

Here the installer:

Ok, then I need more testing, as it seems my fix just doesn’t work in Water (I only tested n Fire, as the Mac is my main work environment, but it’s the same code base & API).

No. this iOS not about VS vs Water. Windows, the operating system does not support Unicode in stdout. You’ll see the same when yo run your app in a console window. You just cannot use writeLn() or Console.WriteLn with non-ANSI characters.

Ok. I understand the issue iOS not related tp typing per se though, right? I can reproduce the same by just cop/pasting your test text from above?

“my fix just doesn’t work in Water” OK, understood.

" operating system does not support Unicode in stdout."
I don’t understand, as they both call the same Console.WriteLine API. In Visual C#/VB.Net, the Chinese are always showing correctly, even in VS 2013, 2015, 2017.

Do you mean Water and VS use different technique to show the output? So one knows Unicode, another does not?

“I can reproduce the same by just cop/pasting your test text from above?”

Yes, I think so, just cop/pasting.

Hmm. I’ll need to pass this on. I’m not the WIndows guy, but the debugger team, told me this isn’t supposed to work. I’ll log an issue.

Hmm. seems to be working fine here for me:

the only scenario that fails (as expected, as mentioned; very end of the above video) is the mouse click/drag, as that still uses the wrong offset. cursoring between the chars is fine, and editing between then and deleting individual ones is too…

what am i missing?

does the video above not represent what you are seeing, or am i using the wring steps?

Thanks, logged as bugs://82172 (for Unicode in the debug console)

I saw you are using WPF, but I am using a .Net core console project

I did’t change any code, just
From:

Console.WriteLine(“The magic happens here.”);

I use backspace to remove The magic happens here. Then paste the text 今天的天气不错 inside “”

It reproduced.

Then I delete 今天的天气不错, and paste 今天的天气不错 inside the “” again, does not reproduce, very strange.

So I suggest, you can try remove the text inside “” , move up and down the Console.WriteLine line, and paste English/Chinese inside “” serveral time, it should happen