diff --git a/CHANGELOG.md b/CHANGELOG.md index e62483ca..eb8f80fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), - A bug where sixel images fail to display when scrolling back and forth is now fixed (#2301). - Newline characters are now ignored when drawing the ruler with the `ruler` file configured (#2319). - A potential crash when using the `scroll-up`/`scroll-down` commands is now fixed (#2320). +- A bug where a trailing divider space appears after the last pane with `drawbox` disabled is now fixed (#2332). - Case-insensitive command-line completions no longer cause user input to be displayed in lowercase (#2336). ## [r40](https://github.com/gokcehan/lf/releases/tag/r40) diff --git a/misc.go b/misc.go index 93d0ae9e..68af7cb7 100644 --- a/misc.go +++ b/misc.go @@ -513,6 +513,29 @@ func readLines(reader io.ByteReader, maxLines int) (lines []string, binary bool, } } +func getWidths(wtot int, ratios []int, drawBox bool) []int { + rsum := 0 + for _, r := range ratios { + rsum += r + } + + wlen := len(ratios) + widths := make([]int, wlen) + + if drawBox { + wtot -= (wlen + 1) + } + + wsum := 0 + for i := range wlen - 1 { + widths[i] = ratios[i] * wtot / rsum + wsum += widths[i] + } + widths[wlen-1] = wtot - wsum + + return widths +} + // We don't need no generic code // We don't need no type control // No dark templates in compiler diff --git a/ui.go b/ui.go index f0561f91..59c1db71 100644 --- a/ui.go +++ b/ui.go @@ -598,33 +598,10 @@ func getCustomWidth(dir *dir, beg, end int) int { return maxw } -func getWidths(wtot int) []int { - rsum := 0 - for _, r := range gOpts.ratios { - rsum += r - } - - wlen := len(gOpts.ratios) - widths := make([]int, wlen) - - if gOpts.drawbox { - wtot -= (wlen + 1) - } - - wsum := 0 - for i := range wlen - 1 { - widths[i] = gOpts.ratios[i] * wtot / rsum - wsum += widths[i] - } - widths[wlen-1] = wtot - wsum - - return widths -} - func getWins(screen tcell.Screen) []*win { wtot, htot := screen.Size() - widths := getWidths(wtot) + widths := getWidths(wtot, gOpts.ratios, gOpts.drawbox) wacc := 0 wlen := len(widths)