Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 23 additions & 0 deletions misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 1 addition & 24 deletions ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down