aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2007-08-30 16:15:24 +0200
committerAndrea Rossato <andrea.rossato@unibz.it>2007-08-30 16:15:24 +0200
commitf91ce26c3c5c2c4ac71d1c531900c8c64f575993 (patch)
tree131be8d0d1e7f0a828bca12eccec0e1a6239fe65
parentd80db0d10ed50bd3eec170f1cc24aefde6e4ebde (diff)
downloadXMonadContrib-f91ce26c3c5c2c4ac71d1c531900c8c64f575993.tar.gz
XMonadContrib-f91ce26c3c5c2c4ac71d1c531900c8c64f575993.tar.xz
XMonadContrib-f91ce26c3c5c2c4ac71d1c531900c8c64f575993.zip
XPrompt: a very long string in the completion list can lead to a division by zero
darcs-hash:20070830141524-32816-beeaa150ea23704c1a92f1ac3d533777fcd331e8.gz
-rw-r--r--XPrompt.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/XPrompt.hs b/XPrompt.hs
index 47690ae..f98cf30 100644
--- a/XPrompt.hs
+++ b/XPrompt.hs
@@ -463,7 +463,7 @@ getComplWinDim compl = do
let compl_number = length compl
max_compl_len = (fi ht `div` 2) + (maximum . map (textWidth fontst) $ compl)
- columns = wh `div` (fi max_compl_len)
+ columns = max 1 $ wh `div` (fi max_compl_len)
rem_height = rect_height scr - ht
(rows,r) = compl_number `divMod` fi columns
needed_rows = max 1 (rows + if r == 0 then 0 else 1)