diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2022-07-21 22:24:11 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2022-07-21 22:30:01 +0900 |
commit | 7a7cfcacbe013f6ce179fb25a4b81c940b687af3 (patch) | |
tree | 6abeecfb8e820101a1a8c343ec49a500ce244ad9 /src | |
parent | 52594355bfa63ce7d579c7961f4f2fb30b486101 (diff) |
Lift unicode.IsGraphic constraint for pointer, marker, and ellipsis
Use at your own risk.
Close #2709
Close #2055
Diffstat (limited to 'src')
-rw-r--r-- | src/options.go | 16 | ||||
-rw-r--r-- | src/options_test.go | 2 |
2 files changed, 0 insertions, 18 deletions
diff --git a/src/options.go b/src/options.go index cb1b7efa..7e626f63 100644 --- a/src/options.go +++ b/src/options.go @@ -1307,7 +1307,6 @@ func parseOptions(opts *Options, allArgs []string) { validateJumpLabels := false validatePointer := false validateMarker := false - validateEllipsis := false for i := 0; i < len(allArgs); i++ { arg := allArgs[i] switch arg { @@ -1495,7 +1494,6 @@ func parseOptions(opts *Options, allArgs []string) { opts.HeaderFirst = false case "--ellipsis": opts.Ellipsis = nextString(allArgs, &i, "ellipsis string required") - validateEllipsis = true case "--preview": opts.Preview.command = nextString(allArgs, &i, "preview command required") case "--no-preview": @@ -1595,7 +1593,6 @@ func parseOptions(opts *Options, allArgs []string) { opts.HeaderLines = atoi(value) } else if match, value := optString(arg, "--ellipsis="); match { opts.Ellipsis = value - validateEllipsis = true } else if match, value := optString(arg, "--preview="); match { opts.Preview.command = value } else if match, value := optString(arg, "--preview-window="); match { @@ -1658,25 +1655,12 @@ func parseOptions(opts *Options, allArgs []string) { errorExit(err.Error()) } } - - if validateEllipsis { - for _, r := range opts.Ellipsis { - if !unicode.IsGraphic(r) { - errorExit("invalid character in ellipsis") - } - } - } } func validateSign(sign string, signOptName string) error { if sign == "" { return fmt.Errorf("%v cannot be empty", signOptName) } - for _, r := range sign { - if !unicode.IsGraphic(r) { - return fmt.Errorf("invalid character in %v", signOptName) - } - } if runewidth.StringWidth(sign) > 2 { return fmt.Errorf("%v display width should be up to 2", signOptName) } diff --git a/src/options_test.go b/src/options_test.go index b411e58e..e9cb5922 100644 --- a/src/options_test.go +++ b/src/options_test.go @@ -453,8 +453,6 @@ func TestValidateSign(t *testing.T) { {"😀", true}, {"", false}, {">>>", false}, - {"\n", false}, - {"\t", false}, } for _, testCase := range testCases { |