Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Alexandre Bury
    @gyscos
    (The magic here is the AnyView trait, implemented for all View, which can give you a &Any, which can then be downcasted to the actual type if you know it.)
    Note that this will give you the number of direct children of the linear layout, not a recursive count of all child views.
    Alexandre Bury
    @gyscos
    On the latest master I just added a shortcut, so you can skip the .as_any() and directly use view.downcast_ref().unwrap()
    xliiv
    @xliiv
    @gyscos thanks, i managed to solve it somehow. actually i don't even remeber why i need that at first place, anyway thanks
    Thrump
    @Thrump
    where do i install ncurse?
    Paul
    @sajattack
    what OS are you on?
    Thrump
    @Thrump
    windows
    Paul
    @sajattack
    I think in that case you compile with pancurses-backend
    and maybe you need this https://github.com/ihalila/pdcurses-sys
    I've never done what you're trying to do
    Thrump
    @Thrump
    im confused
    Thrump
    @Thrump
    like do i add those stuff to my depenendicies?
    Alexandre Bury
    @gyscos
    On windows, the only currently supported backend is pancurses, as @sajattack mentionned. You'll need to specify it in your Cargo.toml:
    [dependencies.cursive]
    version = "0.11"
    default-features = false
    features = ["pancurses-backend"]
    It should only need you to have a valid compiler: https://github.com/ihalila/pdcurses-sys
    On Windows this means that you need the Visual C++ Build Tools.
    Chris Vest
    @chrisvest
    @gyscos do you plan on cutting a new release once the crossterm PR is merged?
    Alexandre Bury
    @gyscos
    Sure, I could release something
    Calem Bendell
    @calben
    hullooo everyone. i'm getting build errors after cloning the repositories on a 64 bit windows machine. is that expected?
    Alexandre Bury
    @gyscos
    I think the problem is with the termion backend; it's not working yet on windows
    How are you building?
    On windows you'll probably want to use either pancurses or crossterm (though the latter is still very fresh and may have a bit of paint left)
    Calem Bendell
    @calben
    ah, that would make sense! i was builing with the command shown in the readme. but i'll try one of the other guys.
    i'm happy for a life of growing pains. aren't we all, as rust users?
    Alexandre Bury
    @gyscos
    :D
    For example:
    cargo run --no-default-features --features pancurses-backend --example select
    Calem Bendell
    @calben
    what a beauty! i feel nerdier already
    thanks for the help @gyscos
    eaglgenes101
    @eaglgenes101
    What's the preferred way of working with file descriptors/handles/whatever in cursive? Poll them every so often?
    Or is there an option for incorporating file descriptors into the event loop?
    Alexandre Bury
    @gyscos
    @eaglgenes101 I think it would probably being in its own thread
    File io is not easily async anyway, and blocking calls in the UI thread should be avoided as usual
    Chris Vest
    @chrisvest
    It may depend on how much IO you plan to do. In XV I do file IO calls during the layout of the hex view. Those IOs are quite small and nearly always hit the OS page cache, so they are actually negligible compared to the cost of updating the screen. I was planning on making those IOs asynchronous, but it turned out to not be necessary in practice, and the code is simpler for it.
    eaglgenes101
    @eaglgenes101
    I was thinking reading on the receiving end of a constant stream of IPC data
    So nonblocking calls on the FD in question should be fine
    eaglgenes101
    @eaglgenes101
    But because of the nature of the IO I want to do, it has similar responsiveness requirements to keyboard and mouse events, which is why I had the question in the first place
    Alexandre Bury
    @gyscos
    So far there hasn't been a lot of work integrating other sources in the main loop (having a dedicated thread is often much simpler), but if we have some solid use cases we can start a design :)
    eaglgenes101
    @eaglgenes101
    Alternatively, can I tell Cursive that I want to poll standard input myself and then use Cursive's functionalities to make sense of the values I get from input?
    Alexandre Bury
    @gyscos
    That's possible; it would basically amount to creating your own Backend
    Possibly by wrapping another one
    Alexandre Bury
    @gyscos
    You could wrap the Backend::poll_event function to do your own polling
    eaglgenes101
    @eaglgenes101
    For my purposes, I decided to take the termion backend and rewrite the polling logic so that it does poll calls on a small suite of preselected file descriptors
    termion backend spawns a thread dedicated to input reading, so it's a rewrite rather than a wrapper
    eaglgenes101
    @eaglgenes101
    What should a cursive backend do if it encounters an IO error polling for input? Panic?
    Alexandre Bury
    @gyscos
    Error handling isn't really complete yet :^/ So far most backends do panic on IO error
    It's probably easier to catch_unwind the call to Cursive::run() than to insert error reporting in the full printing pipeline
    Henrik
    @hrkfdn
    hey! does cursive offer a way to change the terminal title using the escape sequences, e.g. like http://tldp.org/HOWTO/Xterm-Title-3.html
    Alexandre Bury
    @gyscos
    Not currently, but this might be added to the backends trait
    That's a great idea though!