replace 3 dots with ellipsis (#3072)
Signed-off-by: charlie4284 <charlie4284@gmail.com> Signed-off-by: charlie4284 <charlie4284@gmail.com>
This commit is contained in:
parent
59476d4a1c
commit
3d624c0552
|
@ -90,7 +90,7 @@ func Truncate(s string, n int) (string, bool) {
|
|||
if n <= 3 {
|
||||
return string(r[:n]), true
|
||||
}
|
||||
return string(r[:n-3]) + "...", true
|
||||
return string(r[:n-1]) + "…", true
|
||||
}
|
||||
|
||||
// TmplText is using monadic error handling in order to make string templating
|
||||
|
|
|
@ -46,7 +46,7 @@ func TestTruncate(t *testing.T) {
|
|||
{
|
||||
in: "abcde",
|
||||
n: 4,
|
||||
out: "a...",
|
||||
out: "abc…",
|
||||
trunc: true,
|
||||
},
|
||||
{
|
||||
|
@ -58,7 +58,7 @@ func TestTruncate(t *testing.T) {
|
|||
{
|
||||
in: "abcdefgh",
|
||||
n: 5,
|
||||
out: "ab...",
|
||||
out: "abcd…",
|
||||
trunc: true,
|
||||
},
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ func TestTruncate(t *testing.T) {
|
|||
{
|
||||
in: "a⌘cdef",
|
||||
n: 5,
|
||||
out: "a⌘...",
|
||||
out: "a⌘cd…",
|
||||
trunc: true,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue