fix CenteredAt in X.Prompt

This commit is contained in:
Bogdan Sinitsyn
2016-01-01 00:22:45 +03:00
parent 26309d1622
commit bce9c551ef

View File

@@ -972,8 +972,8 @@ getComplWinDim compl = do
Top -> (0,ht - bw)
Bottom -> (0, (0 + rem_height - actual_height + bw))
CenteredAt py w
| py <= 1/2 -> (floor $ fi (rect_width scr) * ((1 - w) / 2), ht + floor (py * fi (rect_height scr)) - bw)
| otherwise -> (floor $ fi (rect_width scr) * ((1 - w) / 2), floor (py * fi (rect_height scr)) - actual_height + bw)
| py <= 1/2 -> (floor $ fi (rect_width scr) * ((1 - w) / 2), floor (py * fi (rect_height scr) + (fi ht)/2) - bw)
| otherwise -> (floor $ fi (rect_width scr) * ((1 - w) / 2), floor (py * fi (rect_height scr) - (fi ht)/2) - actual_height + bw)
(asc,desc) <- io $ textExtentsXMF fs $ head compl
let yp = fi $ (ht + fi (asc - desc)) `div` 2
xp = (asc + desc) `div` 2