I am getting frequent panics from the second line of this current_position function when I bring up a project using noline:
|
fn current_position(&self) -> usize { |
|
let pos = self.terminal.current_offset() as usize; |
|
pos - self.prompt.len() |
|
} |
attempt to subtract with overflow
This has happened both in std contexts and in no_std but both with the async editor. I haven't fully chased it down but the root explanation seems to be that things go wrong with an unknown (zero) terminal size. Whether it gets into this state because my IO driver isn't quite as well behaved as it'd perhaps like (some of my adapters have returned 0-length "EOF" reads rather than always blocking) or because it's not getting any reply back from the terminal (I'm using a variety of emulators and/or non-emulators on the serial port…) idk.
One initial workaround just to keep plowing ahead is to simply only ever pass "" as the prompt and being zero-length the pos - self.prompt.len() subtraction never goes below zero.
I am getting frequent panics from the second line of this
current_positionfunction when I bring up a project usingnoline:noline/noline/src/core.rs
Lines 182 to 185 in 3bfe51d
This has happened both in
stdcontexts and inno_stdbut both with the async editor. I haven't fully chased it down but the root explanation seems to be that things go wrong with an unknown (zero) terminal size. Whether it gets into this state because my IO driver isn't quite as well behaved as it'd perhaps like (some of my adapters have returned 0-length "EOF" reads rather than always blocking) or because it's not getting any reply back from the terminal (I'm using a variety of emulators and/or non-emulators on the serial port…) idk.One initial workaround just to keep plowing ahead is to simply only ever pass
""as the prompt and being zero-length thepos - self.prompt.len()subtraction never goes below zero.