@@ -77,7 +77,7 @@ failure".
77 ( \ (_ :: SomeException) -> return (env_name, "") )
77 ( \ (_ :: SomeException) -> return (env_name, "") )
79 [ "TERM", "COLORTERM", "LANG", "TERM_PROGRAM", "XTERM_VERSION" ]
79 [ "TERM", "COLORTERM", "LANG", "TERM_PROGRAM", "XTERM_VERSION" ]
80− t <- current_terminal
80+ t <- output_for_current_terminal
81 let results_txt = show env_attributes ++ "\n"
81 let results_txt = show env_attributes ++ "\n"
82 ++ terminal_ID t ++ "\n"
82 ++ terminal_ID t ++ "\n"
83 ++ show results ++ "\n"
83 ++ show results ++ "\n"
@@ -188,7 +188,7 @@ reserve_output_test = Test
188 { test_name = "Initialize and reserve terminal output then restore previous state."
188 { test_name = "Initialize and reserve terminal output then restore previous state."
189 , test_ID = "reserve_output_test"
189 , test_ID = "reserve_output_test"
190 , test_action = do
190 , test_action = do
191− t <- current_terminal
191+ t <- output_for_current_terminal
192 reserve_display t
192 reserve_display t
193 putStrLn "Line 1"
193 putStrLn "Line 1"
194 putStrLn "Line 2"
194 putStrLn "Line 2"
@@ -221,7 +221,7 @@ display_bounds_test_0 = Test
221 { test_name = "Verify display bounds are correct test 0: Using spaces."
221 { test_name = "Verify display bounds are correct test 0: Using spaces."
222 , test_ID = "display_bounds_test_0"
222 , test_ID = "display_bounds_test_0"
223 , test_action = do
223 , test_action = do
224− t <- current_terminal
224+ t <- output_for_current_terminal
225 reserve_display t
225 reserve_display t
226 (w,h) <- display_bounds t
226 (w,h) <- display_bounds t
227 let row_0 = replicate (fromEnum w) 'X' ++ "\n"
227 let row_0 = replicate (fromEnum w) 'X' ++ "\n"
@@ -242,7 +242,7 @@ display_bounds_test_1 = Test
242 { test_name = "Verify display bounds are correct test 0: Using cursor movement."
242 { test_name = "Verify display bounds are correct test 0: Using cursor movement."
243 , test_ID = "display_bounds_test_1"
243 , test_ID = "display_bounds_test_1"
244 , test_action = do
244 , test_action = do
245− t <- current_terminal
245+ t <- output_for_current_terminal
246 reserve_display t
246 reserve_display t
247 (w,h) <- display_bounds t
247 (w,h) <- display_bounds t
248 set_cursor_pos t 0 0
248 set_cursor_pos t 0 0
@@ -271,7 +271,7 @@ display_bounds_test_2 = Test
271 { test_name = "Verify display bounds are correct test 0: Using Image ops."
271 { test_name = "Verify display bounds are correct test 0: Using Image ops."
272 , test_ID = "display_bounds_test_2"
272 , test_ID = "display_bounds_test_2"
273 , test_action = do
273 , test_action = do
274− t <- current_terminal
274+ t <- output_for_current_terminal
275 reserve_display t
275 reserve_display t
276 bounds@(w,h) <- display_bounds t
276 bounds@(w,h) <- display_bounds t
277 let first_row = horiz_cat $ replicate (fromEnum w) (char def_attr 'X')
277 let first_row = horiz_cat $ replicate (fromEnum w) (char def_attr 'X')
@@ -294,7 +294,7 @@ display_bounds_test_3 = Test
294 { test_name = "Verify display bounds are correct test 0: Hide cursor; Set cursor pos."
294 { test_name = "Verify display bounds are correct test 0: Hide cursor; Set cursor pos."
295 , test_ID = "display_bounds_test_3"
295 , test_ID = "display_bounds_test_3"
296 , test_action = do
296 , test_action = do
297− t <- current_terminal
297+ t <- output_for_current_terminal
298 reserve_display t
298 reserve_display t
299 (w,h) <- display_bounds t
299 (w,h) <- display_bounds t
300 hide_cursor t
300 hide_cursor t
@@ -406,7 +406,7 @@ unicode_single_width_0 = Test
406 { test_name = "Verify terminal can display unicode single-width characters. (Direct UTF-8)"
406 { test_name = "Verify terminal can display unicode single-width characters. (Direct UTF-8)"
407 , test_ID = "unicode_single_width_0"
407 , test_ID = "unicode_single_width_0"
408 , test_action = do
408 , test_action = do
409− t <- current_terminal
409+ t <- output_for_current_terminal
410 reserve_display t
410 reserve_display t
411 hide_cursor t
411 hide_cursor t
412 withArrayLen (concat utf8_txt_0) (flip $ hPutBuf stdout)
412 withArrayLen (concat utf8_txt_0) (flip $ hPutBuf stdout)
@@ -425,7 +425,7 @@ unicode_single_width_1 = Test
425 { test_name = "Verify terminal can display unicode single-width characters. (Image ops)"
425 { test_name = "Verify terminal can display unicode single-width characters. (Image ops)"
426 , test_ID = "unicode_single_width_1"
426 , test_ID = "unicode_single_width_1"
427 , test_action = do
427 , test_action = do
428− t <- current_terminal
428+ t <- output_for_current_terminal
429 reserve_display t
429 reserve_display t
430 let pic = pic_for_image image
430 let pic = pic_for_image image
431 image = line_0 <-> line_1
431 image = line_0 <-> line_1
@@ -488,7 +488,7 @@ unicode_double_width_0 = Test
488 { test_name = "Verify terminal can display unicode double-width characters. (Direct UTF-8)"
488 { test_name = "Verify terminal can display unicode double-width characters. (Direct UTF-8)"
489 , test_ID = "unicode_double_width_0"
489 , test_ID = "unicode_double_width_0"
490 , test_action = do
490 , test_action = do
491− t <- current_terminal
491+ t <- output_for_current_terminal
492 reserve_display t
492 reserve_display t
493 hide_cursor t
493 hide_cursor t
494 withArrayLen (concat utf8_txt_1) (flip $ hPutBuf stdout)
494 withArrayLen (concat utf8_txt_1) (flip $ hPutBuf stdout)
@@ -507,7 +507,7 @@ unicode_double_width_1 = Test
507 { test_name = "Verify terminal can display unicode double-width characters. (Image ops)"
507 { test_name = "Verify terminal can display unicode double-width characters. (Image ops)"
508 , test_ID = "unicode_double_width_1"
508 , test_ID = "unicode_double_width_1"
509 , test_action = do
509 , test_action = do
510− t <- current_terminal
510+ t <- output_for_current_terminal
511 reserve_display t
511 reserve_display t
512 let pic = pic_for_image image
512 let pic = pic_for_image image
513 image = line_0 <-> line_1
513 image = line_0 <-> line_1
@@ -561,7 +561,7 @@ attributes_test_0 = Test
561 { test_name = "Character attributes: foreground colors."
561 { test_name = "Character attributes: foreground colors."
562 , test_ID = "attributes_test_0"
562 , test_ID = "attributes_test_0"
563 , test_action = do
563 , test_action = do
564− t <- current_terminal
564+ t <- output_for_current_terminal
565 reserve_display t
565 reserve_display t
566 let pic = pic_for_image image
566 let pic = pic_for_image image
567 image = border <|> column_0 <|> border <|> column_1 <|> border
567 image = border <|> column_0 <|> border <|> column_1 <|> border
@@ -607,7 +607,7 @@ attributes_test_1 = Test
607 { test_name = "Character attributes: background colors."
607 { test_name = "Character attributes: background colors."
608 , test_ID = "attributes_test_1"
608 , test_ID = "attributes_test_1"
609 , test_action = do
609 , test_action = do
610− t <- current_terminal
610+ t <- output_for_current_terminal
611 reserve_display t
611 reserve_display t
612 let pic = pic_for_image image
612 let pic = pic_for_image image
613 image = border <|> column_0 <|> border <|> column_1 <|> border
613 image = border <|> column_0 <|> border <|> column_1 <|> border
@@ -662,7 +662,7 @@ attributes_test_2 = Test
662 { test_name = "Character attributes: Vivid foreground colors."
662 { test_name = "Character attributes: Vivid foreground colors."
663 , test_ID = "attributes_test_2"
663 , test_ID = "attributes_test_2"
664 , test_action = do
664 , test_action = do
665− t <- current_terminal
665+ t <- output_for_current_terminal
666 reserve_display t
666 reserve_display t
667 let pic = pic_for_image image
667 let pic = pic_for_image image
668 image = horiz_cat [border, column_0, border, column_1, border, column_2, border]
668 image = horiz_cat [border, column_0, border, column_1, border, column_2, border]
@@ -721,7 +721,7 @@ attributes_test_3 = Test
721 { test_name = "Character attributes: Vivid background colors."
721 { test_name = "Character attributes: Vivid background colors."
722 , test_ID = "attributes_test_3"
722 , test_ID = "attributes_test_3"
723 , test_action = do
723 , test_action = do
724− t <- current_terminal
724+ t <- output_for_current_terminal
725 reserve_display t
725 reserve_display t
726 let pic = pic_for_image image
726 let pic = pic_for_image image
727 image = horiz_cat [border, column_0, border, column_1, border, column_2, border]
727 image = horiz_cat [border, column_0, border, column_1, border, column_2, border]
@@ -799,7 +799,7 @@ attributes_test_4 = Test
799 { test_name = "Character attributes: Bold; Blink; Underline."
799 { test_name = "Character attributes: Bold; Blink; Underline."
800 , test_ID = "attributes_test_4"
800 , test_ID = "attributes_test_4"
801 , test_action = do
801 , test_action = do
802− t <- current_terminal
802+ t <- output_for_current_terminal
803 reserve_display t
803 reserve_display t
804 let pic = pic_for_image image
804 let pic = pic_for_image image
805 image = horiz_cat [border, column_0, border, column_1, border]
805 image = horiz_cat [border, column_0, border, column_1, border]
@@ -851,7 +851,7 @@ attributes_test_5 = Test
851 { test_name = "Character attributes: 240 color palette"
851 { test_name = "Character attributes: 240 color palette"
852 , test_ID = "attributes_test_5"
852 , test_ID = "attributes_test_5"
853 , test_action = do
853 , test_action = do
854− t <- current_terminal
854+ t <- output_for_current_terminal
855 reserve_display t
855 reserve_display t
856 let pic = pic_for_image image
856 let pic = pic_for_image image
857 image = vert_cat $ map horiz_cat $ split_color_images color_images
857 image = vert_cat $ map horiz_cat $ split_color_images color_images
@@ -938,10 +938,10 @@ cursor_hide_test_0 = Test
938 , test_ID = "cursor_hide_test_0"
938 , test_ID = "cursor_hide_test_0"
939 , test_action = do
939 , test_action = do
940 vty <- mkVty
940 vty <- mkVty
941− show_cursor $ terminal vty
941+ show_cursor $ output_iface vty
942− set_cursor_pos (terminal vty) 5 5
942+ set_cursor_pos (output_iface vty) 5 5
943 next_event vty
943 next_event vty
944− hide_cursor $ terminal vty
944+ hide_cursor $ output_iface vty
945 next_event vty
945 next_event vty
946 shutdown vty
946 shutdown vty
947 return ()
947 return ()
@@ -962,7 +962,7 @@ output_image_and_wait image = do
963output_pic_and_wait :: Picture -> IO ()
963output_pic_and_wait :: Picture -> IO ()
964output_pic_and_wait pic = do
964output_pic_and_wait pic = do
965− t <- current_terminal
965+ t <- output_for_current_terminal
966 reserve_display t
966 reserve_display t
967 d <- display_bounds t >>= display_context t
967 d <- display_bounds t >>= display_context t
968 output_picture d pic
968 output_picture d pic
@@ -1145,13 +1145,13 @@ layer_1 = Test
1146cheesy_anim_0 :: Image -> [Image] -> IO ()
1146cheesy_anim_0 :: Image -> [Image] -> IO ()
1147cheesy_anim_0 i background = do
1147cheesy_anim_0 i background = do
1148− t <- current_terminal
1148+ t <- output_for_current_terminal
1149 reserve_display t
1149 reserve_display t
1150 bounds <- display_bounds t
1150 bounds <- display_bounds t
1151 d <- display_context t bounds
1151 d <- display_context t bounds
1152 forM_ [0..100] $ \t -> do
1152 forM_ [0..100] $ \t -> do
1153− let i_offset = translate (t `mod` region_width bounds)
1153+ let i_offset = translate (t `mod` fst bounds)
1154− (t `div` 2 `mod` region_height bounds)
1154+ (t `div` 2 `mod` snd bounds)
1156 let pic = pic_for_layers $ i_offset : background
1156 let pic = pic_for_layers $ i_offset : background
1157 output_picture d pic
1157 output_picture d pic