Skip to content

Commit

Permalink
Make Windows resize event match terminal::size (crossterm-rs#714)
Browse files Browse the repository at this point in the history
  • Loading branch information
generic-user1 authored and eminence committed Jan 18, 2023
1 parent 5d02ed8 commit 9e418b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/event/source/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ impl EventSource for WindowsEventSource {
mouse_event
}
InputRecord::WindowBufferSizeEvent(record) => {
Some(Event::Resize(record.size.x as u16, record.size.y as u16))
// windows starts counting at 0, unix at 1, add one to replicate unix behaviour.
Some(Event::Resize(
record.size.x as u16 + 1,
record.size.y as u16 + 1,
))
}
InputRecord::FocusEvent(record) => {
let event = if record.set_focus {
Expand Down

0 comments on commit 9e418b1

Please sign in to comment.