on master help sign in
Cursor: add PositionOnly constructor for cursor placement without visibility
fd90f7dJonathan Daugherty
src/Graphics/Vty/Output/Interface.hs+6
@@ -207,6 +207,12 @@ outputPicture dc pic = do
207 AbsoluteCursor x y ->
207 AbsoluteCursor x y ->
208 writeShowCursor dc `mappend`
208 writeShowCursor dc `mappend`
209 writeMoveCursor dc (clampX x) (clampY y)
209 writeMoveCursor dc (clampX x) (clampY y)
210+ PositionOnly isAbs x y ->
211+ if isAbs
212+ then writeMoveCursor dc (clampX x) (clampY y)
213+ else let (ox, oy) = charToOutputPos m (clampX x, clampY y)
214+ m = cursorOutputMap ops $ picCursor pic
215+ in writeMoveCursor dc (clampX ox) (clampY oy)
210 Cursor x y ->
216 Cursor x y ->
211 let m = cursorOutputMap ops $ picCursor pic
217 let m = cursorOutputMap ops $ picCursor pic
212 (ox, oy) = charToOutputPos m (clampX x, clampY y)
218 (ox, oy) = charToOutputPos m (clampX x, clampY y)
src/Graphics/Vty/Picture.hs+8
@@ -82,6 +82,14 @@ data Cursor =
82 NoCursor
82 NoCursor
83 -- | Show the cursor at the given logical column accounting for
83 -- | Show the cursor at the given logical column accounting for
84 -- character width in the presence of multi-column characters.
84 -- character width in the presence of multi-column characters.
85+ | PositionOnly !Bool !Int !Int
86+ -- | Set the terminal's cursor position without displaying a cursor
87+ -- character. This is important for accessibility with screen
88+ -- readers where a cursor position needs to be reported but we may
89+ -- not want to show a block cursor in that location for cosmetic
90+ -- reasons. The boolean argument indicates whether the positioning
91+ -- should be absolute as with 'AbsoluteCursor' ('True') or logical
92+ -- as with 'Cursor' ('False').
85 | Cursor !Int !Int
93 | Cursor !Int !Int
86 -- | Show the cursor at the given absolute terminal column and row
94 -- | Show the cursor at the given absolute terminal column and row
87 | AbsoluteCursor !Int !Int
95 | AbsoluteCursor !Int !Int