Closed Xliff closed 1 year ago
Welcome to Rakudo™ v2023.10.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2023.10.
To exit type 'exit' or '^D'
[0] > [].words.raku
().Seq
[1] > ['a b', 'c d', ''].words.raku
("a", "b", "c", "d").Seq
Maybe an older version of Rakudo? What version are you using?
I'm always running the latest Rakudo as of every Sunday, and what was throwing the exception wasn't [].words, it was Any.words
Huh. That's exactly why I added ( ... // [])
, so that Any
(well, any undefined value really) would be handled correctly.
This is the result of running my menu example, on the original code.
No such method 'words' for invocant of type 'Any'
in submethod TWEAK at /home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/site/sources/AA6301CC3FFC5FC5DD790E82F47C218019F81482 (Terminal::Widgets::Input::Menu) line 19
in code at /home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/site/sources/26E6D836A1D4E494FCAC62834885EDBDE3BE308D (Terminal::Widgets::StandardWidgetBuilder) line 35
in method build-node at /home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/site/sources/26E6D836A1D4E494FCAC62834885EDBDE3BE308D (Terminal::Widgets::StandardWidgetBuilder) line 33
in method build-children at /home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/site/sources/3989AA48D290809D1D02FB42C0A4DEC17DEBBA24 (Terminal::Widgets::Layout) line 534
in method build-layout at /home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/site/sources/5631D3B8476BF4F76EA65D82B37E7E51FEF477C6 (Terminal::Widgets::Simple::TopLevel) line 52
in method relayout at /home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/site/sources/DD10492A185894E091F0748D6EB10432D2034DF2 (Terminal::Widgets::TopLevel) line 71
in method resize-toplevel at /home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/site/sources/84CCE306D0E570C7CAD4832A8A9074427971041C (Terminal::Widgets::Terminal) line 144
in method set-toplevel at /home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/site/sources/84CCE306D0E570C7CAD4832A8A9074427971041C (Terminal::Widgets::Terminal) line 154
in method default-init at /home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/site/sources/FBA0C4C41263A0304BB3992ED29FB0D14A17EB72 (Terminal::Widgets::Simple::App) line 118
in method boot-to-screen at /home/cbwood/.rakubrew/versions/moar-blead/install/share/perl6/site/sources/FBA0C4C41263A0304BB3992ED29FB0D14A17EB72 (Terminal::Widgets::Simple::App) line 61
in sub MAIN at examples/form-menu.raku line 60
in block
Ah, I think that's because you have an old version of the module installed into your brewed Rakudo, rather than the HEAD version of it. Take a look:
Terminal-Widgets-Xliff (main) $ raku examples/form-menu.raku # Uses my current (HEAD) installed version, works fine
Terminal-Widgets-Xliff (main) $ zef uninstall Terminal::Widgets # Removes installed version
===> Uninstalled from inst#/home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site
Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
Terminal-Widgets-Xliff (main) $ raku examples/form-menu.raku # Fails because no installed version
===SORRY!=== Error while compiling /home/geoff/foss/git/Terminal-Widgets-Xliff/examples/form-menu.raku
Could not find Terminal::Widgets::Simple in:
/home/geoff/.raku
/home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site
/home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/vendor
/home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/core
CompUnit::Repository::AbsolutePath<4677563341904>
CompUnit::Repository::NQP<4677516543008>
CompUnit::Repository::Perl5<4677516543048>
at /home/geoff/foss/git/Terminal-Widgets-Xliff/examples/form-menu.raku:3
Terminal-Widgets-Xliff (main) $ zef install Terminal::Widgets # Install version 0.0.8 (which is OLDER THAN HEAD)
===> Searching for: Terminal::Widgets
===> Updating fez mirror: https://360.zef.pm/
===> Updated fez mirror: https://360.zef.pm/
===> Staging Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
===> Staging [OK] for Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
===> Testing: Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
===> Testing [OK] for Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
===> Installing: Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
Terminal-Widgets-Xliff (main) $ raku examples/form-menu.raku # Runs against 0.0.8
No such method 'words' for invocant of type 'Any'
in submethod TWEAK at /home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site/sources/AA6301CC3FFC5FC5DD790E82F47C218019F81482 (Terminal::Widgets::Input::Menu) line 19
in code at /home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site/sources/26E6D836A1D4E494FCAC62834885EDBDE3BE308D (Terminal::Widgets::StandardWidgetBuilder) line 35
in method build-node at /home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site/sources/26E6D836A1D4E494FCAC62834885EDBDE3BE308D (Terminal::Widgets::StandardWidgetBuilder) line 33
in method build-children at /home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site/sources/3989AA48D290809D1D02FB42C0A4DEC17DEBBA24 (Terminal::Widgets::Layout) line 534
in method build-layout at /home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site/sources/5631D3B8476BF4F76EA65D82B37E7E51FEF477C6 (Terminal::Widgets::Simple::TopLevel) line 52
in method relayout at /home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site/sources/DD10492A185894E091F0748D6EB10432D2034DF2 (Terminal::Widgets::TopLevel) line 71
in method resize-toplevel at /home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site/sources/84CCE306D0E570C7CAD4832A8A9074427971041C (Terminal::Widgets::Terminal) line 144
in method set-toplevel at /home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site/sources/84CCE306D0E570C7CAD4832A8A9074427971041C (Terminal::Widgets::Terminal) line 154
in method default-init at /home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site/sources/FBA0C4C41263A0304BB3992ED29FB0D14A17EB72 (Terminal::Widgets::Simple::App) line 118
in method boot-to-screen at /home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site/sources/FBA0C4C41263A0304BB3992ED29FB0D14A17EB72 (Terminal::Widgets::Simple::App) line 61
in sub MAIN at examples/form-menu.raku line 60
in block <unit> at examples/form-menu.raku line 7
Terminal-Widgets-Xliff (main) $ pushd ../Terminal-Widgets # Go to current tree
~/foss/git/Terminal-Widgets ~/foss/git/Terminal-Widgets-Xliff
Terminal-Widgets (main) $ git describe --tags # Four commits past 0.0.8
0.0.8-4-g0d3527d
Terminal-Widgets (main) $ git status # Fully pushed
On branch main
Your branch is up to date with 'origin/main'.
Terminal-Widgets (main) $ zef install . # Can't just install, the short version string hasn't changed
All candidates are currently installed
No reason to proceed. Use --force-install to continue anyway
Terminal-Widgets (main) $ zef install . --force-install # We really do want HEAD installed
===> Staging Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
===> Staging [OK] for Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
===> Testing: Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
===> Testing [OK] for Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
===> Installing: Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
Terminal-Widgets (main) $ popd # Go back to your tree to try the example again
~/foss/git/Terminal-Widgets-Xliff
Terminal-Widgets-Xliff (main) $ raku examples/form-menu.raku # Works perfectly!
Since this appears to be a source of debugging confusion, I'll release the current code as 0.0.9, so that zef install
Just Works. Working on that next.
I've now released 0.0.9, so you should have less confusion now:
Terminal-Widgets-Xliff (main) $ zef update # Pull latest distro release updates
===> Updating fez mirror: https://360.zef.pm/
===> Updating rea mirror: https://raw.githubusercontent.com/Raku/REA/main/META.json
===> Updated fez mirror: https://360.zef.pm/
===> Updated rea mirror: https://raw.githubusercontent.com/Raku/REA/main/META.json
Terminal-Widgets-Xliff (main) $ zef search Terminal::Widgets | grep 0.0.9 # Check new version is actually visible
8 |Zef::Repository::Ecosystems<fez>|Terminal::Widgets:ver<0.0.9>:auth<zef:japhb>|Basic TUI Widgets
Terminal-Widgets-Xliff (main) $ zef uninstall Terminal::Widgets # Uninstall 0.0.8 just to be extra sure
===> Uninstalled from inst#/home/geoff/raku/rakudo-moar-2023.10-0-g139f0e97c/install/share/perl6/site
Terminal::Widgets:ver<0.0.8>:auth<zef:japhb>
Terminal-Widgets-Xliff (main) $ zef install Terminal::Widgets # Install NEW 0.0.9
===> Searching for: Terminal::Widgets
===> Staging Terminal::Widgets:ver<0.0.9>:auth<zef:japhb>
===> Staging [OK] for Terminal::Widgets:ver<0.0.9>:auth<zef:japhb>
===> Testing: Terminal::Widgets:ver<0.0.9>:auth<zef:japhb>
===> Testing [OK] for Terminal::Widgets:ver<0.0.9>:auth<zef:japhb>
===> Installing: Terminal::Widgets:ver<0.0.9>:auth<zef:japhb>
Terminal-Widgets-Xliff (main) $ raku examples/form-menu.raku # Works perfectly! :-D
Hopefully that helps! :smile:
Sure enough, that was the problem. This is odd, because I installed either from zef
or pakku
and the version with the bugs is the version I got. I updated from a forked repo and all is now well.
Thanks!
Now there is this issue with Terminal::Widgets::Input::Menu and it's lack of scrolling....
Version 0.0.10 released with scrolling, responsive, colored-item menu example, as well as the required bug fixes and functionality support.
Since I went a slightly different route in the code, I'm closing this PR. You may want to refork from upstream main
so that your fork doesn't drift to far away from mine, or create future PRs from branches in your fork, so that they are easier to discard or cherry-pick from if I decide to do this (accept the concept but not the code) again in the future.
Thank you for the PR, ideas, and feature requests! Terminal::Widgets is better for your requests. :-)
There was a crash with the original code.
.words is a method on Str, so that means if I don't have anything as a hotkey, it gets passed to .words which will then throw an Exception.
On Mon, Nov 6, 2023 at 4:25 PM Geoffrey Broadwell @.***> wrote: