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

adjust_page called before height or render #3

Closed
George-Miao opened this issue Oct 23, 2021 · 2 comments
Closed

adjust_page called before height or render #3

George-Miao opened this issue Oct 23, 2021 · 2 comments

Comments

@George-Miao
Copy link

George-Miao commented Oct 23, 2021

thread 'debug::test' panicked at 'adjust_page called before height or render'

stack backtrace:
   0: rust_begin_unwind
             at /rustc/97032a6dfacdd3548e4bff98c90a6b3875a14077/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/97032a6dfacdd3548e4bff98c90a6b3875a14077/library/core/src/panicking.rs:101:14
   2: core::option::expect_failed
             at /rustc/97032a6dfacdd3548e4bff98c90a6b3875a14077/library/core/src/option.rs:1615:5
   3: core::option::Option<T>::expect
             at /rustc/97032a6dfacdd3548e4bff98c90a6b3875a14077/library/core/src/option.rs:698:21
   4: requestty_ui::select::Select<L>::adjust_page
             at [:REDACTED:]/requestty-ui-0.2.0/src/select/mod.rs:279:24
   5: requestty_ui::select::Select<L>::maybe_adjust_page
             at [:REDACTED:]/requestty-ui-0.2.0/src/select/mod.rs:382:13
   6: requestty_ui::select::Select<L>::set_at
             at [:REDACTED:]/requestty-ui-0.2.0/src/select/mod.rs:144:17
   7: requestty::question::select::Select::into_prompt
             at [:REDACTED:]/requestty-0.1.2/src/question/select/mod.rs:113:13
   8: requestty::question::select::Select::ask
             at [:REDACTED:]/requestty-0.1.2/src/question/select/mod.rs:130:34
   9: requestty::question::Question::ask
             at [:REDACTED:]/requestty-0.1.2/src/question/mod.rs:520:40
  10: requestty::prompt_one_with
             at [:REDACTED:]/requestty-0.1.2/src/lib.rs:283:15
  11: requestty::prompt_one
             at [:REDACTED:]/requestty-0.1.2/src/lib.rs:259:5
  12: clashctl::debug::test
             at ./src/debug.rs:4:5

Minimum reproducable case:

#[test]
fn test() {
    use requestty::{prompt_one, Question};
    prompt_one(
        Question::select("Debug")
            .choices(&["1".to_owned(), "2".to_owned(), "3".to_owned()])
            .default(0)
            .build(),
    )
    .unwrap();
}

This is the exact code produced the above backtrace.
Only when default = 0 will make the program panic.

@George-Miao
Copy link
Author

Versions:

rustc 1.57.0-nightly (97032a6df 2021-09-08)
requestty = "0.1.2"

@Lutetium-Vanadium
Copy link
Owner

Thanks for opening the issue! I have published a fix in v0.1.3, please update and let me know if you have any issues

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