GNU bug report logs -
#22536
"transferredd" typo in GNU Guix
Previous Next
Reported by: <nicolasmaia <at> tutanota.com>
Date: Tue, 2 Feb 2016 20:12:01 UTC
Severity: normal
Merged with 22713
Done: Andreas Enge <andreas <at> enge.fr>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
A quick try to get a prefer-the-tail string concatenator to work - still has some limitations:
(define (abbreviate text len)
(string-take text (min len (string-length text))))
(define (abbreviate-texts-prefer-to-take-tail texts len)
"Given a list of strings TEXTS, returns a string, containing at most LEN codepoints.
If possible, prefers to still keep the last text. If this text is too long, takes as many heading codepoints as possible of it.
If there's still space, also keeps the second-to-last text. If this text is too long, takes as many heading codepoints as possible of it.
...
If there's still space, also keeps the first text. If this text is too long, takes as many heading codepoints as possible of it.
We have no idea how wide it will actually be when displayed, so:
- make sure to only use it with ASCII text, or
- at least only use it with half-width characters."
(if (null? texts)
""
(let* ((remainder (abbreviate-texts-prefer-to-take-tail (cdr texts) len))
(len (- len (string-length remainder)))
(text (abbreviate (car texts) len)))
(string-append text remainder))))
(display (abbreviate-texts-prefer-to-take-tail '("hello world" " " "this i") 10))
(newline)
This bug report was last modified 7 years and 94 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.