mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
41c22d5e60
This is essentially the inverse of `string pad`. Where that adds characters to get up to the specified width, this adds an ellipsis to a string if it goes over a specific maximum width. The char can be given, but defaults to our ellipsis string. ("…" if the locale can handle it and "..." otherwise) If the ellipsis string is empty, it just truncates. For arguments given via argv, it goes line-by-line, because otherwise length makes no sense. If "--no-newline" is given, it adds an ellipsis instead and removes all subsequent lines. Like pad and `length --visible`, it goes by visible width, skipping recognized escape sequences, as those have no influence on width. The default target width is the shortest of the given widths that is non-zero. If the ellipsis is already wider than the target width, we truncate instead. This is safer overall, so we don't e.g. move into a new line. This is especially important given our default ellipsis might be width 3. |
||
---|---|---|
.. | ||
completions | ||
functions | ||
groff | ||
tools | ||
__fish_build_paths.fish.in | ||
config.fish | ||
lynx.lss |