-
Notifications
You must be signed in to change notification settings - Fork 2
Conversation
I can confirm the same behavior when I try to replicate the "raw" mode flags from here. impl RawModeCommand {
pub fn new() -> Self {
RawModeCommand {
mask: ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT,
}
}
}
impl RawModeCommand {
/// Enables raw mode.
pub fn enable(&mut self) -> Result<()> {
let console_mode = ConsoleMode::from(Handle::input_handle()?);
let mut dw_mode = console_mode.mode()?;
// enabling these three
let ENABLE_EXTENDED_FLAGS = 0x0080;
let ENABLE_INSERT_MODE = 0x0020;
let ENABLE_QUICK_EDIT_MODE = 0x0040;
dw_mode |= ENABLE_EXTENDED_FLAGS;
dw_mode |= ENABLE_INSERT_MODE;
dw_mode |= ENABLE_QUICK_EDIT_MODE;
// disabling the mask
let new_mode = dw_mode & !self.mask;
console_mode.set_mode(new_mode)?;
Ok(())
} Looks like, to me at least, that the UNIX raw behavior cannot be duplicated in windows console only with the use of flags. |
Any progress on this PR? This is the last problem which needs to be solved before we proceed with the merge. Would be nice to have it fixed somehow or if there's a problem we can't solve, we don't know how, there's also a possibility to withdraw this issue from the list of issues we have to solve before merge. I'm afraid I can't help here, Linux/macOS only, just asking. |
I am not how to go about mimicking the exact Linux behavior. The console modes are somewhat the same now however the new line behaves a bit different (as shown above). I know of the following libraries trying to do the same thing as we do here, maybe we can take a look over there: |
I also spoke about raw modes issue in discord with some people, it seems like it is impossible or very difficult to sync output to be the exact same on both Windows and Linux. The flags we are currently disabling are right. What we see now is that I propose to merge the PR, update the readme, or docstrings and add the notice that When using raw modes the user should only use |
I have moved your commits over to this PR, I fixed the build and changed documentation to make clear what can be expected by raw modes. |
As described in crossterm-rs/crossterm#250, this change aims to replicate UNIX "raw" screen in windows console.