ui: reg: fix width undercalculation
This commit is contained in:
parent
229715ef9e
commit
455c71c9ab
@ -107,18 +107,22 @@ drawRegisterScreen2 AppState{aopts=_opts, aScreen=RegisterScreen2{rs2State=l}} =
|
|||||||
-- they need, while reserving a minimum of space for other
|
-- they need, while reserving a minimum of space for other
|
||||||
-- columns and whitespace. If they don't get all they need,
|
-- columns and whitespace. If they don't get all they need,
|
||||||
-- allocate it to them proportionally to their maximum widths.
|
-- allocate it to them proportionally to their maximum widths.
|
||||||
whitespacewidth = 23
|
whitespacewidth = 9 -- inter-column whitespace, fixed width
|
||||||
maxamtswidth = max 0 (totalwidth - whitespacewidth)
|
minnonamtcolswidth = datewidth + 2 + 2 -- date column plus at least 2 for desc and accts
|
||||||
|
maxamtswidth = max 0 (totalwidth - minnonamtcolswidth - whitespacewidth)
|
||||||
maxchangewidthseen = maximum' $ map (length . fourth5) displayitems
|
maxchangewidthseen = maximum' $ map (length . fourth5) displayitems
|
||||||
maxbalwidthseen = maximum' $ map (length . fifth5) displayitems
|
maxbalwidthseen = maximum' $ map (length . fifth5) displayitems
|
||||||
changewidthproportion = fromIntegral (maxchangewidthseen + maxbalwidthseen) / fromIntegral maxchangewidthseen
|
changewidthproportion = fromIntegral maxchangewidthseen / fromIntegral (maxchangewidthseen + maxbalwidthseen)
|
||||||
maxchangewidth = round $ fromIntegral maxamtswidth / changewidthproportion
|
maxchangewidth = round $ changewidthproportion * fromIntegral maxamtswidth
|
||||||
maxbalwidth = maxamtswidth - maxchangewidth
|
maxbalwidth = maxamtswidth - maxchangewidth
|
||||||
changewidth = min maxchangewidth maxchangewidthseen
|
changewidth = min maxchangewidth maxchangewidthseen
|
||||||
balwidth = min maxbalwidth maxbalwidthseen
|
balwidth = min maxbalwidth maxbalwidthseen
|
||||||
|
|
||||||
-- assign the remaining space to the description and accounts columns
|
-- assign the remaining space to the description and accounts columns
|
||||||
maxdescacctswidth = max 0 (totalwidth - datewidth - changewidth - balwidth - (whitespacewidth - 2))
|
-- maxdescacctswidth = totalwidth - (whitespacewidth - 4) - changewidth - balwidth
|
||||||
|
maxdescacctswidth =
|
||||||
|
-- trace (show (totalwidth, datewidth, changewidth, balwidth, whitespacewidth)) $
|
||||||
|
max 0 (totalwidth - datewidth - changewidth - balwidth - whitespacewidth)
|
||||||
-- allocating proportionally.
|
-- allocating proportionally.
|
||||||
-- descwidth' = maximum' $ map (length . second5) displayitems
|
-- descwidth' = maximum' $ map (length . second5) displayitems
|
||||||
-- acctswidth' = maximum' $ map (length . third5) displayitems
|
-- acctswidth' = maximum' $ map (length . third5) displayitems
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user