K-IDE support forum
Find all information about Kawasaki's Integrated Development Environment

Texteditor test

#1 by cquante , Tue Sep 17, 2024 9:55 am

Please find attached a modified FastColoredTextBox text editor for CJK characters. The functional changes are very simple but it's a huge change in code.

In current release version and in BETA till v1.1.4.21, the CJK character handling is as follows:
Measure each character's width if it exceeds the predefined fixed character width of the current font. If the width of the character is bigger, scale down the character width and hight by a calculated factor. After that, the CJK character fits into the fixed grid and uses the place that other normal characters use. That leads to character representation with different character size. It also leads in very poor performance in Chinese and Japanese K-IDE versions.

The attached DLL changes that to the following strategy:
Instead of meassuring each character, CJK characters are identified by the character code. When a CJK character is identified, the character is expected to have a double width compared to normal characters. When drawing such characters, the space for that characters are doubled. This strategy must be kept in mind, when placing the caret with the cursor keys or the mouse and when selecting a number of characters.

If you like to test the new editor component, please replace your existing FastColoredTextBox.dll file with the attached one (after unpacking). Please keep the original dll file to revert it if the editor will do unexpected things! The changes are only relevant for people who are using CJK characters, but it effects all character sets and languages.

As always: feel free to download, install and test the new editor and leave your comments! - Thank you!


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany

Attachment:
FastColoredTextBox-1.1.4.22.zip FastColoredTextBox-old.zip

The following user say thank you: Zoirkae
 
cquante
Posts: 301
Date registered 12.20.2019


RE: Texteditor test

#2 by Zoirkae ( Guest ) , Wed Sep 18, 2024 3:10 am

Thanks for your job, it works fine. I'll keep giving the feedback.


Zoirkae

RE: Texteditor test

#3 by Zoirkae , Wed Sep 18, 2024 8:11 am

Hello, I'm back with 5 issues:

1. Can't identify full-width and half-width in Japanese(Full-width character takes up 2 bypes, half-width is 1 byte), so half-width takes more space.


2. Character is missing in Texteditor when enter Chinese comments.


(Before is K-IDE, another is Visual Studio Code)

3. #Future# Hope add options to change encoding.

4. Index out of range serveral times.

1
2
3
4
5
6
7
8
9
10
11
12
 
************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at FastColoredTextBoxNS.SelectionStyle.Draw(Graphics gr, Point position, Range range)
at FastColoredTextBoxNS.FastColoredTextBox.DrawLineChars(Graphics gr, Int32 firstChar, Int32 lastChar, Int32 iLine, Int32 iWordWrapLine, Int32 startX, Int32 y)
at FastColoredTextBoxNS.FastColoredTextBox.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at FastColoredTextBoxNS.FastColoredTextBox.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 



5. Print text doesn't work.

1
2
3
4
5
6
7
8
9
10
11
12
 
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at JgxP.RgxQ.pgRE(Object , EventArgs )
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 



Assembly Version

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
 
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9261.0 built by: NET481REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
KawasakiIDE
Assembly Version: 1.1.4.21
Win32 Version: 1.1.4.21
CodeBase: file:///C:/Program%20Files/KIDE/KawasakiIDE.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9251.0 built by: NET481REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9261.0 built by: NET481REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9037.0 built by: NET481REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9261.0 built by: NET481REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
FastColoredTextBox
Assembly Version: 2.16.26.0
Win32 Version: 2.16.26.0
CodeBase: file:///C:/Program%20Files/KIDE/FastColoredTextBox.DLL
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9037.0 built by: NET481REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
DataGridViewGrouper
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/KIDE/DataGridViewGrouper.DLL
----------------------------------------
KawasakiIDE.resources
Assembly Version: 1.1.4.21
Win32 Version: 1.1.4.21
CodeBase: file:///C:/Program%20Files/KIDE/zh/KawasakiIDE.resources.DLL
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9037.0 built by: NET481REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9037.0 built by: NET481REL1
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
KawasakiIDE.resources
Assembly Version: 1.1.4.21
Win32 Version: 1.1.4.21
CodeBase: file:///C:/Program%20Files/KIDE/ja/KawasakiIDE.resources.DLL
----------------------------------------
IPAddressControlLib
Assembly Version: 1.2.5863.41265
Win32 Version: 1.2.5863.41265
CodeBase: file:///C:/Program%20Files/KIDE/IPAddressControlLib.DLL
----------------------------------------
Microsoft.CSharp
Assembly Version: 4.0.0.0
Win32 Version: 4.8.9037.0
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
Assembly Version: 0.0.0.0
Win32 Version: 4.8.9261.0 built by: NET481REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
 



The following user say thank you: cquante
Zoirkae  
Zoirkae
Posts: 8
Date registered 09.18.2024

Last edited 09.30.2024 | Top

RE: Texteditor test

#4 by cquante , Wed Sep 18, 2024 8:49 am

Tnak you for your report!

1. I don't understand full-width and half-width character set and meaning. Can you please explain? What is wrong with the text you've shown as "half-width"?

2. Can you send me a sample text to copy&paste? There should be no missing character.

3. If it's necessary I will think about it.

4. I will check in the code. Can you tell me what you did before the exception?


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany


 
cquante
Posts: 301
Date registered 12.20.2019


Next try...

#5 by cquante , Wed Sep 18, 2024 9:25 am

Exception should be resolved now and printing is possible. For the other things I need some test data.


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany

Attachment:
FastColoredTextBox-2.16.27.0.zip

 
cquante
Posts: 301
Date registered 12.20.2019


RE: Texteditor test

#6 by Zoirkae , Wed Sep 18, 2024 9:31 am

1. I can't add external links because I'm new, but you can search "Half-width kana" on wiki. Half-width shows in Pic01 between each character has one-character-space, it's better to remove it.

2. What I said is not clearly enough, in other texteditors (Pic03) when I type English characters they have candidature rather than real inputting. You can consider that Chinese character is made up of one or multi English characters, this help us make sure the text we enter is right.

3. Yep, it's necessary.

4. Keep K-IDE background sometime and return to interface, then select codes



The following user say thank you: cquante
Zoirkae  
Zoirkae
Posts: 8
Date registered 09.18.2024

Last edited 09.18.2024 | Top

RE: Texteditor test

#7 by cquante , Wed Sep 18, 2024 9:45 am

-> 1.) So half-width kana characters should not be expanded to double size but should kept in a normal character size?


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany


 
cquante
Posts: 301
Date registered 12.20.2019


RE: Texteditor test

#8 by Zoirkae , Wed Sep 18, 2024 9:52 am

Yep, if it does what you see is "w o r d"


The following user say thank you: cquante
Zoirkae  
Zoirkae
Posts: 8
Date registered 09.18.2024


Next-next try

#9 by cquante , Wed Sep 18, 2024 9:58 am

This (should) prevent half-size Katakana from beeing resized.


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany

Attachment:
FastColoredTextBox-2.16.28.0.zip

The following user say thank you: Zoirkae
 
cquante
Posts: 301
Date registered 12.20.2019


RE: Next-next try

#10 by Zoirkae , Wed Sep 18, 2024 10:02 am

Can't open project

1
2
3
4
5
6
7
8
9
 
System.IO.FileLoadException: Could not load file or assembly 'FastColoredTextBox, Version=2.16.26.0, Culture=neutral, PublicKeyToken=fb8aa12b994ef61b' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'FastColoredTextBox, Version=2.16.26.0, Culture=neutral, PublicKeyToken=fb8aa12b994ef61b'
at PXq.RXF..ctor()
at JgxP.RgxQ..ctor(vNQ , HgZe )
at tgZo.HgZe.pgOI(TreeNode )
at tgZo.HgZe.fgOY(Object , TreeNodeMouseClickEventArgs )
at System.Windows.Forms.TreeView.OnNodeMouseDoubleClick(TreeNodeMouseClickEventArgs e)
at System.Windows.Forms.TreeView.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 


Zoirkae  
Zoirkae
Posts: 8
Date registered 09.18.2024


RE: Next-next try

#11 by cquante , Wed Sep 18, 2024 10:17 am

Zitat von Zoirkae im Beitrag #10
Can't open project


Ah - sorry! I should not change the version number without recompiling K-IDE.


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany

Attachment:
FastColoredTextBox-2.16.26.0-3.zip

The following user say thank you: Zoirkae
 
cquante
Posts: 301
Date registered 12.20.2019


RE: Next-next try

#12 by Zoirkae , Wed Sep 18, 2024 10:27 am

The latest version Chinese and Japanese look perfect, thanks a lot , BTW can you understand issue 2 now?


Zoirkae  
Zoirkae
Posts: 8
Date registered 09.18.2024


RE: Next-next try

#13 by Zoirkae , Wed Sep 18, 2024 10:51 am

New error !
After you seaching somthing, you will get warning if you search new text without closing search box.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
************** Exception Text **************
System.InvalidOperationException: Form that is already visible cannot be displayed as a modal dialog box. Set the form's visible property to false before calling Show.
at System.Windows.Forms.Form.Show(IWin32Window owner)
at JgxP.RgxQ.Kgtk(Object , EventArgs )
at JgxP.RgxQ.MgtR(Object , CustomActionEventArgs )
at FastColoredTextBoxNS.FastColoredTextBox.OnCustomAction(CustomActionEventArgs e)
at FastColoredTextBoxNS.FastColoredTextBox.DoAction(FCTBAction action)
at FastColoredTextBoxNS.FastColoredTextBox.ProcessKey(Keys keyData)
at FastColoredTextBoxNS.FastColoredTextBox.OnKeyDown(KeyEventArgs e)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
at FastColoredTextBoxNS.FastColoredTextBox.ProcessKeyMessage(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at FastColoredTextBoxNS.FastColoredTextBox.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 


The following user say thank you: cquante
Zoirkae  
Zoirkae
Posts: 8
Date registered 09.18.2024


RE: Next-next try

#14 by cquante , Wed Sep 18, 2024 12:00 pm

Zitat von Zoirkae im Beitrag #13
New error !
After you seaching somthing, you will get warning if you search new text without closing search box.



Thank you for the report!

Please: if not related to CJK characters and the editor changes for that, post bug reports in the bug section (-> here <-)! Thank you!

I solved the issue, but at the moment I cannot update because of 'work in progress'.


Christian Quante
Technical Sales
Sales Department

Kawasaki Robotics GmbH
Rheiner Landstrasse 195A • 49078 Osnabrück
Germany


 
cquante
Posts: 301
Date registered 12.20.2019


RE: Next-next try

#15 by Zoirkae , Wed Sep 18, 2024 12:39 pm

Got it! if you want more details about issue 2, I’m glad to help you.


Zoirkae  
Zoirkae
Posts: 8
Date registered 09.18.2024


   

BETA / Update 1.1.4.21



Xobor Xobor Community Software
Datenschutz