fish-shell/doc_src
Fabian Boehm 41c22d5e60 Add string shorten
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.
2022-09-09 18:49:57 +02:00
..
cmds Add string shorten 2022-09-09 18:49:57 +02:00
python_docs_theme Warn the user when visiting old documentation 2022-06-20 17:56:14 -07:00
commands.rst Add documentation for prompt_hostname 2021-12-04 10:37:49 +01:00
completions.rst Search $__fish_user_data_dir for vendor additions 2022-05-12 20:29:05 +02:00
conf.py Warn the user when visiting old documentation 2022-06-20 17:56:14 -07:00
design.rst Docs: Posix -> POSIX 2022-02-14 16:18:16 -08:00
faq.rst faq.rst: fix typo 2022-08-31 07:49:49 +02:00
fish_for_bash_users.rst Document ctrl-r harder, add something on set -x 2022-08-12 21:28:11 +02:00
fish_indent_lexer.py docs: restore default highlighting keywords and options in HTML 2022-01-16 14:07:19 +01:00
fish_synopsis.py docs synopsis: add HTML highlighing and automate manpage markup 2022-01-19 22:56:41 +08:00
index.rst docs/index: reword default shell section 2022-03-29 13:33:06 +08:00
interactive.rst Document history pager 2022-09-08 22:50:00 +02:00
language.rst docs: Add more specific guidance on locale variables 2022-06-17 22:08:00 +02:00
license.rst Bump copyright year 2022-01-09 23:47:58 +08:00
relnotes.rst docs: call the CHANGELOG "release notes" 2021-02-25 22:46:24 +08:00
tutorial.rst docs: Remove prompt from multiline commands 2022-03-11 19:05:26 +01:00