in reply to Re^3: [challenge] Nested autocompletion -- fixed win32 version
in thread [challenge] Nested autocompletion

No, No, No, that's horrible :(

Check your load average with that change - it hard loops waiting for a character. My reading of Term::ReadKey says

my $char = ReadKey 0;
should be used, as this properly sleeps waiting for a character, and will not return undef.

Of course, I have no idea what it does on Win32, since I can't test it.

Replies are listed 'Best First'.
Re^5: [challenge] Nested autocompletion -- fixed win32 version
by Discipulus (Canon) on Feb 23, 2023 at 09:33 UTC
    > No, No, No, that's horrible :(

    yes ReadKey -1 on linux consumed almost all my cpu while with 0 cpu usage is minimal. On win32 with -1 the task manager shows only a ~5% of cpu, but I suspect other cpu cycles, another ~5%', are consumend inside 'conhost.exe and somewhere else: infact the overall cpu usage raised around 35%

    Unfortunately I'm not in the postion to apply the win32 definitive fix :)

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re^5: [challenge] Nested autocompletion -- fixed win32 version
by roho (Bishop) on Feb 22, 2023 at 08:08 UTC
    Different issue for me. To display colored text (instead of raw escape codes) on Win32, the following module must also be included:
    use Win32::Console::ANSI;

    "It's not how hard you work, it's how much you get done."

      Hello roho,

      what perl -MWin32 -e "print Win32::GetOSDisplayName(),' ',(join '.',Win32::GetOSVersion())" prints for you?

      Infact I read on wikepedia that version 1511 of win10 unexpectedly implemented support for ANSI escape sequences

      L*

      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
        It displays:
        Windows 10 Business (64-bit) .10.0.19045.2.0.0.256.1

        "It's not how hard you work, it's how much you get done."