Flexible filename truncation (#1029)
* allow flexible truncation of filenames As of now, lf truncates always at the end. So for long filenames one can not see the end (especially not the file ending, like .jpeg or .pdf). [MidnightCommander](https://github.com/MidnightCommander/mc/) truncates too long filenames in the middle, so it's possible to see the beginning and the end of the too long filename. This commit allows to specify a flexible point for the truncation in percent of the available space. * The default value of 100 for the new `truncatepct` option means no change in lf behaviour. * More adhering to naming convention. * Improve error message for invalid `truncatepct` values. * Remove redundant test cases. * FIXUP Add dummy empty line to make `go fmt` happy. * Avoid explicit "cast" to rune array. * fix(doc.go): remove line with single dot This was there to avoid that `go fmt` touches the next item with `waitmsg`. However, removing the spaces before the example list items has the same effect.
This commit is contained in:
1 parent
e885abe1a3
commit
b1a851953b
9 files changed
+120
-1
No files matched your search
@@ -191,6 +191,7 @@ The following options can be used to customize the behavior of lf:
|
||||
tempmarks string (default '')
|
||||
timefmt string (default 'Mon Jan _2 15:04:05 2006')
|
||||
truncatechar string (default '~')
|
||||
truncatepct int (default 100)
|
||||
waitmsg string (default 'Press any key to continue')
|
||||
wrapscan bool (default true)
|
||||
wrapscroll bool (default false)
|
||||
@@ -1119,6 +1120,18 @@ Format string of the file modification time shown in the bottom line.
|
||||
.PP
|
||||
Truncate character shown at the end when the file name does not fit to the pane.
|
||||
.PP
|
||||
.EX
|
||||
truncatepct int (default 100)
|
||||
.EE
|
||||
.PP
|
||||
When a filename is too long to be shown completely, the available space is partitioned in two pieces. truncatepct defines a fraction (in percent between 0 and 100) for the size of the first piece, which will show the beginning of the filename. The second piece will show the end of the filename and will use the rest of the available space. Both pieces are separated by the truncation character (truncatechar). A value of 100 will only show the beginning of the filename, while a value of 0 will only show the end of the filename, e.g.:
|
||||
.PP
|
||||
- `set truncatepct 100` -> "very-long-filename-tr~" (default)
|
||||
.PP
|
||||
- `set truncatepct 50` -> "very-long-f~-truncated"
|
||||
.PP
|
||||
- `set truncatepct 0` -> "~ng-filename-truncated"
|
||||
.PP
|
||||
.EX
|
||||
waitmsg string (default 'Press any key to continue')
|
||||
.EE
|
||||
|
||||
Reference in new issue
Block a user