Jump to content

luebbe

Members
  • Content Count

    120
  • Joined

  • Last visited

Community Reputation

26 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.4 Sydney

Recent Profile Visitors

3430 profile views
  1. First of all my apologies for not replying sooner. That will teach me (not) to ask a question on a Friday before going on vacation... We have no control over the font that is used to display the text file. It may be any standard console font or a font selected in the editor of the user's choice. So probably the best thing we can come up with is to count how many full width/half width CJK characters are in the string to be written and pad this with a matching number of half width spaces. I tried using tabs, but this only works if the "jiggle" is less than a tab's width, which cannot be guaranteed. I'll check if I can come up with something based on the table I linked above. But since it's only a cosmetic problem, it's not worth that much effort.
  2. I was thinking along the lines of TCanvas.TextWidth as well, but since I'm "just" dealing with text file output I thought this may be too much. Delphi characters.inc seems to contain all unicode characters and the TCharHelper derives a lot of info from it. There is also an official unicode property "east asian width" (https://www.unicode.org/reports/tr11/tr11-8.html) and the corresponding lookup table (https://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt), but this doesn't seem to be used in TCharHelper. I'd probably import this table and do something similar to TCharHelper.
  3. Hi everybody, The task at hand is to write column aligned text to an output file. The good old reliable format function can handle this fine unless CJK characters are involved. Generally these occupy two latin character columns, but I cannot blindly assume that a string which has to be formatted only contains CJK characters and multiply by two. Example: en : "Coding:" - seven characters occupy seven columns zh_CN: "编码:" - three characters occupy five columns I have found different solutions for different programming languages on SO, GitHub and other places, for example a wcwidth function in C, but nothing in Pascal (yet). Maybe I haven't uttered the proper incantations. System.Character.TCharHelper doesn't have a property like UnicodeWidth (Full/Half). Does the RTL offer any helper for this problem or do I have to roll my own? Hints are greatly appreciated.
  4. Only about 500 for me. After I knew what was going on, I replaced them all. A systematic search & destroy did the job for me.
  5. In fact that's what I did. I concatenated the tabs with "+ #9 +" since they separate the string anyway. Thanks for the hint.
  6. Hi Folks, I've come across a strange bug with string literals in Delphi. I am in the process of moving from Delphi 11.3 to 12.1 and suddenly one of our tests fails. I could narrow it down to a combination of the less equal or greater equal unicode characters in combination with a tab in the string. Here's the definition: const cExpected: array [0 .. 4] of string = ( '1 Line with <= and no tab', '2 Line with ≤ and no tab', #9'3 Line with ≤ and a', #9'4 Line with ≥ and a tab', #9'5 Line with >= and a tab'); On the left side of the screenshot is the result of the misinterpretation. You see that somehow the first characters of the last line that didn't contain a tab *and* a greater equal/less equal character overwrite the first characters of the lines that contain both. I've never seen this before. Does anyone have an idea what is going on here? Delphi 11 handled it correctly. Originally it was one const separated by sLineBreak instead of a const array of string. This combination also damages TestCase() Attributes in DUnitX. They also get misinterpreted.
  7. luebbe

    New Grep Expert in GExperts - need a name

    Definitely need a community vote on this. 🙂
  8. luebbe

    VCL Styles and WM_SETCURSOR problem with scrollbars

    Exactly, so I will move on. At least this topic is conserved for posterity, so maybe it'll help someone else as well.
  9. luebbe

    VCL Styles and WM_SETCURSOR problem with scrollbars

    We know the following: An exe produced by someone else with 10.2 is ok An exe produced by me with 10.4.2 is not ok An exe produced by someone else with 11.3 is ok An exe produced by me with 11.3 is ok (tested it in the mean time) Open question: An exe produced by someone else with 10.4.2 is ???
  10. luebbe

    VCL Styles and WM_SETCURSOR problem with scrollbars

    So it looks like a regression in 10.4 (or 10.3) to me. Thanks a lot again! In German we got the nice word "Verschlimmbesserung" for this. A mashup of Verbesserung = improvement and Verschlimmerung = aggravation. 🙂
  11. luebbe

    VCL Styles and WM_SETCURSOR problem with scrollbars

    Thanks for testing. Interesting. I wonder if this bug only happens with 10.4? I guess that my 10.4.2 exe shows the described behaviour on your PC?
  12. Hi Folks, I've come across a problem with VCL styled applications. Some controls (not all) continuously fire WM_SETCURSOR messages, when the mouse cursor is stationary over a scrollbar and VCL styles are active. When the standard Windows style is used, everything works as expected. There are a few WM_SETCURSOR messages and they stop coming, when the mouse stops moving. This may not sound like a big deal, but on my PC the CPU load goes up from 1% to 15%..20% (one core almost at 100%) when this happens. We have a timing critical application, where the timing goes haywire, when the mouse is over a scrollbar of a TListView or a TScrollBox. At least ListView and ScrollBox exhibit this behaviour. EasyListView and VirtualStringTree don't. I haven't found the source of the problem yet, so help is greatly appreciated. Attached you will find an example with a TListView that exhibits the behaviour. Included is an .exe, compiled with Delphi 10.4.2. So if this doesn't happen with a newer compiler, we have a big incentive to upgrade 🙂 StyledWMSetCursor.zip Cheers & thanks Lübbe
  13. luebbe

    The Delphi 11.2 release thread

    I deleted the Parnassus registry keys from "SOFTWARE\Embarcadero\BDS\21.0\Experts" and now the 10.4.2 IDE starts again. Getit still thinks the parnassus plugins are installed, but uninstalled them via getit and it seems ok now. I then let the 11.2 installer delete all 11.x registry keys and it looks like it will now proceed successfully. So it looks like I could solve the problem.
  14. luebbe

    The Delphi 11.2 release thread

    Not a good experience for me so far. I had installed 11.1 alongside 10.4.2 without any problems. I always install from ISO with local admin privileges. Getit packages are installed later, normally without admin privileges. I let the 11.2 installer uninstall the previous version keeping the registry keys. It removes getit packages, finishes installing the core and then crashes with the following error: Running the 11.2 installer again yields the same result. Worst of all, when I now start Delphi 10.4.2 it also crashes with almost the same exception: So the 11.2 installer managed to destroy two installations in one go. But the parnassus dlls seem to be in place: How can I recover from this situation? Probably there are some registry keys which I should delete and then reinstall again, but which registry keys?
×