| ... | @@ -210,13 +210,15 @@ fn refreshWithHeldLock(self: *Progress) void { | ... | @@ -210,13 +210,15 @@ fn refreshWithHeldLock(self: *Progress) void { |
| 210 | | 210 | |
| 211 | saved_cursor_pos = info.dwCursorPosition; | 211 | saved_cursor_pos = info.dwCursorPosition; |
| 212 | | 212 | |
| 213 | const window_height = @intCast(windows.DWORD, info.srWindow.Bottom - info.srWindow.Top) + 1; | 213 | const window_height = @intCast(windows.DWORD, info.srWindow.Bottom - info.srWindow.Top + 1); |
| 214 | const window_width = @intCast(windows.DWORD, info.srWindow.Right - info.srWindow.Left) + 1; | 214 | const window_width = @intCast(windows.DWORD, info.srWindow.Right - info.srWindow.Left + 1); |
| 215 | // Number of terminal cells to clear, starting from the cursor position | 215 | // Number of terminal cells to clear, starting from the cursor position |
| 216 | // and ending at the window bottom right corner. | 216 | // and ending at the window bottom right corner. |
| 217 | const fill_chars = window_width * (window_height - | 217 | const fill_chars = if (window_width == 0 or window_height == 0) 0 else chars: { |
| 218 | @intCast(windows.DWORD, info.dwCursorPosition.Y - info.srWindow.Top)) - | 218 | break :chars window_width * (window_height - |
| 219 | @intCast(windows.DWORD, info.dwCursorPosition.X - info.srWindow.Left); | 219 | @intCast(windows.DWORD, info.dwCursorPosition.Y - info.srWindow.Top)) - |
| | 220 | @intCast(windows.DWORD, info.dwCursorPosition.X - info.srWindow.Left); |
| | 221 | }; |
| 220 | | 222 | |
| 221 | var written: windows.DWORD = undefined; | 223 | var written: windows.DWORD = undefined; |
| 222 | if (windows.kernel32.FillConsoleOutputAttribute( | 224 | if (windows.kernel32.FillConsoleOutputAttribute( |