Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Requestty view doens't addapt when terminal size is changed + Panics if smaller than current view height #17

Closed
NovaliX-Dev opened this issue Aug 16, 2022 · 1 comment

Comments

@NovaliX-Dev
Copy link
Contributor

NovaliX-Dev commented Aug 16, 2022

When we resize the terminal, the view height doesn't change.

When i change to a greather height, the size stays the same and requestty works fine.
But when i change to a small height, enough to hide a part of the requestty view, it panics and show this error :

thread 'main' panicked at 'attempt to subtract with overflow', C:\Users\noval\rust\requestty\requestty-ui\src\input.rs:150:28
stack backtrace:
   0: rust_begin_unwind
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\std\src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\core\src/panicking.rs:142:14
   2: core::panicking::panic
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library\core\src/panicking.rs:48:5
   3: requestty_ui::input::Input<P,B>::adjust_scrollback
             at C:\Users\noval\rust\requestty\requestty-ui\src\input.rs:150:28
   4: requestty_ui::input::Input<P,B>::render
             at C:\Users\noval\rust\requestty\src\question\mod.rs:567:45
   9: requestty::prompt_one_with
             at C:\Users\noval\rust\requestty\src\lib.rs:283:15
  10: requestty::prompt_one
             at C:\Users\noval\rust\requestty\src\lib.rs:259:5
  11: requestty_test::main
             at .\src\main.rs:9:23
  12: core::ops::function::FnOnce::call_once
             at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f\library\core\src\ops/function.rs:248:5

The error occurs with OrderSelect (not yet implemented, see [#16]) and MultiSelect.
It doesn't seems to occur with one-line questions, like confirm or float.

Tested with PowerShell in VSCode.

@NovaliX-Dev NovaliX-Dev changed the title Requestty view downs't addapt when terminal size is changed + Panics if smaller than current view height [Bug] Requestty view downs't addapt when terminal size is changed + Panics if smaller than current view height Aug 16, 2022
@NovaliX-Dev NovaliX-Dev changed the title [Bug] Requestty view downs't addapt when terminal size is changed + Panics if smaller than current view height [Bug] Requestty view doens't addapt when terminal size is changed + Panics if smaller than current view height Aug 22, 2022
@Lutetium-Vanadium
Copy link
Owner

Hmm, this is pretty deep rooted issue as the widgets don't actually consider the height remaining and assume there is enough space which is obviously incorrect. Thanks for bringing this issue to light!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants