rhysd/tui-textarea

editor sample crashes on windows every other invokation

pm100 opened this issue · 4 comments

pm100 commented

it seems to be something to do with enabling and detecting raw mode

If i reset my terminal and run it, its fine, then if I close and run again the screen is not cleared, the edit windows open and can be used but is odd

image

on ^q it crashes

image

run again all is fine

I bet this is a windows issue, I will drill into it (I am ex MSFT guy, windows is my env) once I finish the select work

rhysd commented

Can you paste the entire backtrace as text in code block with RUST_BACKTRACE=1?

pm100 commented

here you go

thread 'main' panicked at examples\editor.rs:364:10:itch buffer
called `Result::unwrap()` on an `Err` value: Custom { kind: Other, error: "Initial console modes not set" }
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\std\src\panicking.rs:595
   1: core::panicking::panic_fmt
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\panicking.rs:67
   2: core::result::unwrap_failed
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library\core\src\result.rs:1652
   3: enum2$<core::result::Result<tuple$<>,std::io::error::Error> >::unwrap<tuple$<>,std::io::error::Error>
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\core\src\result.rs:1077
   4: editor::impl$4::drop
             at .\examples\editor.rs:359
   5: core::ptr::drop_in_place<editor::Editor>
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\core\src\ptr\mod.rs:497
   6: editor::main
             at .\examples\editor.rs:370
   7: core::ops::function::FnOnce::call_once<enum2$<core::result::Result<tuple$<>,std::io::error::Error> > (*)(),tuple$<> >
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33\library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\examples\editor.exe f1` (exit code: 101)
PS C:\work\origtta\tui-textarea>
rhysd commented

Thanks. I'll check it tomorrow.

rhysd commented

I could reproduce this. But I'm not sure this is an issue of the example implementation.