mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-21 01:47:15 +08:00
builtin_string: change npad
This commit is contained in:
parent
f389bb0e97
commit
886290c123
|
@ -1277,7 +1277,6 @@ static int string_pad(parser_t &parser, io_streams_t &streams, int argc, wchar_t
|
|||
|
||||
arg_iterator_t aiter(argv, optind, streams);
|
||||
while (const wcstring *arg = aiter.nextstr()) {
|
||||
size_t begin = 0, end = arg->size();
|
||||
wcstring padded_arg = wcstring(*arg, 0, arg->size());
|
||||
if (opts.right) {
|
||||
padded_arg.append(opts.count, opts.char_to_pad);
|
||||
|
@ -1286,7 +1285,7 @@ static int string_pad(parser_t &parser, io_streams_t &streams, int argc, wchar_t
|
|||
padded_arg.insert(0, opts.count, opts.char_to_pad);
|
||||
}
|
||||
// assert(begin <= end && end <= arg->size());
|
||||
npad += arg->size() - (end - begin);
|
||||
npad += arg->size() + 2 * opts.count;
|
||||
if (!opts.quiet) {
|
||||
streams.out.append(padded_arg);
|
||||
streams.out.append(L'\n');
|
||||
|
|
Loading…
Reference in New Issue
Block a user