ansi-terminal 0.10.1 → 0.10.2
raw patch · 4 files changed
+19/−5 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−0
- ansi-terminal.cabal +1/−1
- src/System/Console/ANSI/Windows/Emulator.hs +8/−2
- src/includes/Common-Include.hs +2/−2
CHANGELOG.md view
@@ -1,6 +1,14 @@ Changes ======= +Version 0.10.2 +-------------- + +* `hGetTerminalSize` now assumes a terminal is no bigger than 9,999 by 9,999 + (previously, no bigger than 999 by 999). +* On Windows, fix a bug where emulated cursor movement functions differed from + Windows 10 (movement bounded by the current viewport). + Version 0.10.1 --------------
ansi-terminal.cabal view
@@ -1,5 +1,5 @@ Name: ansi-terminal -Version: 0.10.1 +Version: 0.10.2 Cabal-Version: >= 1.8 Category: User Interfaces Synopsis: Simple ANSI terminal support, with Windows compatibility
src/System/Console/ANSI/Windows/Emulator.hs view
@@ -77,9 +77,15 @@ adjustCursorPosition handle change_x change_y = do screen_buffer_info <- getConsoleScreenBufferInfo handle let window = csbi_window screen_buffer_info + l = rect_left window + t = rect_top window + r = rect_right window + b = rect_bottom window (COORD x y) = csbi_cursor_position screen_buffer_info - cursor_pos'= COORD (change_x (rect_left window) x) - (change_y (rect_top window) y) + clamp mn mx = max mn . min mx + x' = clamp l r (change_x l x) + y' = clamp t b (change_y t y) + cursor_pos' = COORD x' y' setConsoleCursorPosition handle cursor_pos' hCursorUp h n
src/includes/Common-Include.hs view
@@ -287,8 +287,8 @@ hGetTerminalSize :: Handle -> IO (Maybe (Int, Int)) hGetTerminalSize h = do hSaveCursor h - hSetCursorPosition h 999 999 -- Attempt to set the cursor position beyond the - -- bottom right corner of the terminal. + hSetCursorPosition h 9999 9999 -- Attempt to set the cursor position beyond + -- the bottom right corner of the terminal. mPos <- hGetCursorPosition h hRestoreCursor h hFlush h -- ensure the restore cursor position code is sent to the