Utf8 chars in Editor - sometimes strange behaviour lazarus / 9-Editor ---------------------------------------------------------------------- winni · 2019-09-29 22:17 Hi! The Editor has a strange behaviour with some Utf8 signs. It only happens wenn the char is 'too long' - if it doesn't fit into the space for one monotype letter. Example: try this in the IDE: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i constTabSign =  '⭾'; // after this utf8 sign the Editor get crazy for this line  The cursor is not at the right position, some letters are not visible and in the next cursor position again visible. You just can't edit it. As workaround I edit this line in a stable editor, look if every thing is correct and then copy it to the IDE. And never touch this line again. But that is no long time solution. Is this error known? Winni ---------------------------------------------------------------------- Martin_fr · 2019-09-29 22:43 Yes it is known. The issue  is that SynEdit expects a mono-spaced font. And it expects it to a full 100%. No exceptions. Actually, there are so called FullWidth chars in utf8, and SynEdit does honour them (happens with some Japanese script). If your char is FullWitdth, in the utf8 standard, then report it, so SynEdit can be updated for it. If it is not Fullwidth, then it violates mono-spacing. SynEdit does not measure the width of each char. It expects them to be all identical. So the 5th (4 chars before it) char must be at "Left + 4 * CharWidth". If a line is all the same color, no bold, no right-to-left, ..., then it is outputted in one single go. That mean your overwide char is painted correctly, and the OS moves the rest of the line. But SynEdit does not know. So the caret placement will not take that into account. If there are color/style changes (also if you make a selection, which changes color), then SynEdit must paint every color/style on its own. So it paints all the letters to the first change, and then paints the next bit of text from the position that SynEdit did expect. If the text was unexpectedly longer, the longer part is overpainted... Usually commenting the entire line, will make it one color all the way. Then (if there is no right to left) it would/should paint correct. But the caret will still indicate the wrong position, so editing will not be easy. To fix this will probably need fundamental changes to how the editor works. So no quick fix is to be expected. See https://bugs.freepascal.org/view.php?id=35564 Btw on my Win 10, the char from your example works fine (font: deja vu). But that can vary per Win install. Also that assumes that copy and paste got me the same char (same binary representation) that you have. If your issue does not match my description/explanation, then please give more details. This means, once color changes (eg comment or end of string) after that char, the remainder of the line should edit ok (because SynEdit forced the new color to the correct pos). If that is not the case, please attach a short source (does not need to compile, 3 or 4 dummy lines), with that line in it. So I can test with the same binary representation. Also mention your OS and Widgetset. ---------------------------------------------------------------------- winni · 2019-09-29 23:26 Hi Martin_fr Thanx for that long explanation! I work with Linux / gtk2 and Liberation Mono as font so the situation is different. I know a lot of utf8 chars that behave crazy: Numbers with circles around 'long' Math operators Some of the keyboard symbols like Tab and  BS For others I have to look in some of my projects. But there are. Another workaround is to use a new line: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i TabSign =  '⭾' +                ' some text in a string ';   But anyway - the second ' in the first line vanishes. And despite your explanations: Even if there is a color change due to a comment you even cannot edit the comment. Letters vanish and appear if the cursor moves. A desperate solution I did once is Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$I TabSign.inc} But it's a little bit too expensive to uses an include file for every strange letter But know I know the internals and the situation. Thanx again. Winni ---------------------------------------------------------------------- winni · 2019-09-29 23:46 @ Martin_fr Hey, the trick from the bugreport did it: Set Tools  --> Options --> Display --> Extra chracter spacing to +1 !! Now every trouble is gone. I will check tomorow some other projects. And Windows. Good night Winni ---------------------------------------------------------------------- Martin_fr · 2019-09-30 00:30 Next time I fire up my Linux system I will have another look. In any case, please attach a text file, containing this char. (with the line from your example). Thanks ---------------------------------------------------------------------- winni · 2019-09-30 15:09 @Martin_fr The textfile with the above example and some other examples just found in my sources is attached. The file contains this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i //Short list of Utf8 sign which confuse the Lazarus IDE TabSign =  '⭾'; // after this utf8 sign the Editor get crazy for this lineBsSign =   '⟸' ; //too long for the IDEReturnSign = '⮠'; // also double lengthOneTwoThree ='❶❷❸❹❺❻❼❽❾❿';  // DONT TOUCH!  Until 10, but SynEdit has      //display errors with some utf8 chars!!!VeryMuchGt =    '⋙'; // very much disturbed                                       Winni ---------------------------------------------------------------------- Martin_fr · 2019-10-01 15:13 I did a quick test (linux and windows / though whatever font my system used) The Symbols are all a few pixels to width. So it is the issue I described. On my setup the string, the ";" and the comment have all different colors. And therefore, if the comment has none of those chars (but only the string before), then the comment is stable, and can be edited. The long string of 1,2,3... gets cut of at 6 or 7. ---------------------------------------------------------------------- winni · 2019-10-01 16:15 Hi Martin_fr Before we get confused about before and after color: A picture tells more than 1000 words! A screeshot of the textfile in the IDE. Winni ---------------------------------------------------------------------- Martin_fr · 2019-10-01 17:59 Yes that approx what I get (diff font, 1 or 2 pixel off, but overall the same). Without the "extra char width" fix... The below is not to important. It will not likely change anything. But what happens if you place the caret in the comment (mouse click), and try to edit it? If that is causing issues (it will if you turn the highlight off, but you have it on in your image) then that would indicate a 2nd issue that I have not yet reproducetd. Btw, inside the string, if you want to know what char you are at: Select 1 to the right, and the selection should contain the actual current char (potentially cut off at the right) Also may you go through the line, you will sometimes notice changes. If your caret comes next to the opening quote, the IDE highlights the closing quote (might be hard to see, if it is bold or italics). So at that moment the closing quote would become visible, until you further move the caret. ---------------------------------------------------------------------- winni · 2019-10-01 18:15 Hi! Yes, even in my highlighted comment I have issues: The cursor is at the wrong position, display for letters near the cursor are switched on and off - you are not able to edit. Or you write "Dssiaplyy" instead of "Display". Workaround: Comment in the next line. But now I've got that "Extra Character Spacing" and everything is fine. Winni