aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2013-02-21 13:20:50 +0100
committerPaul Fertser <fercerpav@gmail.com>2013-02-21 13:20:50 +0100
commite41c1f20671f5ffd5375d43b9ebdce0d5bad5d74 (patch)
treeb7434f24fe7c641243f808aca15ef5dab339da88 /XMonad
parent18fe050d7cafa6d25a9f3a63aee7d8aa9afe5012 (diff)
downloadXMonadContrib-e41c1f20671f5ffd5375d43b9ebdce0d5bad5d74.tar.gz
XMonadContrib-e41c1f20671f5ffd5375d43b9ebdce0d5bad5d74.tar.xz
XMonadContrib-e41c1f20671f5ffd5375d43b9ebdce0d5bad5d74.zip
Allow to limit maximum row count in X.Prompt completion window
Ignore-this: 923656f02996f2de2b1336275392c5f9 On a keyboard-less device (such as a smartphone), where one has to use an on-screen keyboard, the maximum completion window height must be limited to avoid overlapping the keyboard. darcs-hash:20130221122050-52607-7d086c3f11ba83887e11c26b4fd41dd1ab4c77aa.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Prompt.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs
index d6b44eb..e9613db 100644
--- a/XMonad/Prompt.hs
+++ b/XMonad/Prompt.hs
@@ -134,6 +134,8 @@ data XPConfig =
, position :: XPPosition -- ^ Position: 'Top' or 'Bottom'
, alwaysHighlight :: !Bool -- ^ Always highlight an item, overriden to True with multiple modes. This implies having *one* column of autocompletions only.
, height :: !Dimension -- ^ Window height
+ , maxComplRows :: Maybe Dimension
+ -- ^ Just x: maximum number of rows to show in completion window
, historySize :: !Int -- ^ The number of history entries to be saved
, historyFilter :: [String] -> [String]
-- ^ a filter to determine which
@@ -241,6 +243,7 @@ defaultXPConfig =
, changeModeKey = xK_grave
, position = Bottom
, height = 18
+ , maxComplRows = Nothing
, historySize = 256
, historyFilter = id
, defaultText = []
@@ -933,7 +936,10 @@ getComplWinDim compl = do
rem_height = rect_height scr - ht
(rows,r) = length compl `divMod` fi columns
needed_rows = max 1 (rows + if r == 0 then 0 else 1)
- actual_max_number_of_rows = rem_height `div` ht
+ limit_max_number = case maxComplRows c of
+ Nothing -> id
+ Just m -> min m
+ actual_max_number_of_rows = limit_max_number $ rem_height `div` ht
actual_rows = min actual_max_number_of_rows (fi needed_rows)
actual_height = actual_rows * ht
(x,y) = case position c of