10 comments

  • Yannik_Sc 17 hours ago
    While I generally like Lua this code just looks .. not so Lua - like, it definitely is Lua, but it could look much better by utilizing language features like "Parenthesis-free calls":

      ui.Button "Button Text" {
        on_click = function()
          print("Hello world")
        end,
        disabled = true
      }
    
    or

      ui.VStack {
        padding = 31, -- Named key => option
        wrap = true,
      
        ui.Button "..." {}, -- Indexed by number => children
      }
    
    feels more Lua and slightly cleaner imo
    • otikik 16 hours ago
      I had a similar impression. It feels "not idiomatic". I disagree on the diagostic though - I think parenthesis-free calls are not what define what idiomatic lua is.

      To me it is more about expressiveness and usage of basic language features. For example here's how a text field is set up currently.

                 ito.TextField(draft)
                      :label("Name")
                      :focused()
                      :on_submit(function(value)
                          if value:match("%S") then
                              phase.value = "review"
                          end
                      end)
                      :on_cancel(function()
                          phase.value = "choose"
                      end),
      
      
      The field is created on the first line, and then altered further with subsequent method calls that alter it. This reads like someone very used to Rust (and its Builder pattern) and then translating it verbatim to Lua. A more native Lua interface for me would look like this:

                 ito.TextField(draft, {
                      label = "Name",
                      focused = true,
                      on_submit = function(value)
                          if value:match("%S") then
                              phase.value = "review"
                          end
                      end,
                      on_cancel = function()
                          phase.value = "choose"
                      end),
                 })
      
      As in: just pass a table to the builder. And if they ned to modify it later, they can just do:

                 some_textfield.on_cancel = <some other function>
      
      No need to "guard" the internal table with those extra methods.
    • cat-whisperer 16 hours ago
      it does, but I am a fan of the composability that ratatui has, and I wanted to copy it over…
  • jrop 11 hours ago
    Congrats on the release! This looks cool.

    Since you mentioned you're Neovim nerds: you may enjoy this: I build a declarative rendering engine on top of Neovim itself: morph.nvim [1]. Every Neovim install already has a grid, extmarks, floating windows, and a Lua runtime. On top of morph, I've dog-fooded 14+ interactive TUI applets -- docker, k8s, systemd, AWS, GitHub, HN reader [2].

    Aside from declarative rendering, morph does a lot of other stuff: region-specific keymaps, read-only regions, extmark creation/managment/etc.

    [1] https://github.com/jrop/morph.nvim

    [2] https://github.com/jrop/tuis.nvim

  • hollowturtle 17 hours ago
    Great job! The declarative API looks sick! I'll try it. Sometimes I love to think that if our universe is really infinite, then somewhere there's a universe where the browsers supports native luajit scripting instead of javascript(and in another universe all of this plus array indexes starting from 0 ;)
    • cat-whisperer 17 hours ago
      I trust you would make that happen! And I would be right there to use it in my next project
  • bluerooibos 10 hours ago
    I do find it funny how TUIs are trying to become increasingly ergonomic with more friendly UX.. to the point where they're basically just becoming GUIs.
    • hnlmorg 10 hours ago
      There have been GUI like TUIs for as long as TUIs have been a thing. Eg Borland Turbo Vision, Microsoft QBasic and pretty much anything written using ncurses.

      All TUI means is that it runs in character mode.

  • farmeroy 6 hours ago
    This is cool and I love how enthusiastic you are about it, super inspiring
  • satuke 18 hours ago
    this is amazing, i'll try it out!
    • cat-whisperer 18 hours ago
      feel free to raise issues if anything feels off. The plan is to make it the rice harness :)

      *oh! I meant the right harness for you

  • sagyn 9 hours ago
    [flagged]
  • luasertyui 11 hours ago
    [dead]
  • buffer_overlord 14 hours ago
    Hqtui