mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 00:21:13 +00:00
Improve handling of alignment
This commit is contained in:
parent
8efd1a8ef6
commit
8d9d528bf5
@ -1665,16 +1665,11 @@ template <typename Range> class basic_writer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (specs.align == align::none) {
|
if (specs.align == align::numeric && fspecs.sign) {
|
||||||
specs.align = align::right;
|
auto&& it = reserve(1);
|
||||||
} else if (specs.align == align::numeric) {
|
*it++ = static_cast<char_type>(data::signs[fspecs.sign]);
|
||||||
if (fspecs.sign) {
|
fspecs.sign = sign::none;
|
||||||
auto&& it = reserve(1);
|
if (specs.width != 0) --specs.width;
|
||||||
*it++ = static_cast<char_type>(data::signs[fspecs.sign]);
|
|
||||||
fspecs.sign = sign::none;
|
|
||||||
if (specs.width != 0) --specs.width;
|
|
||||||
}
|
|
||||||
specs.align = align::right;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memory_buffer buffer;
|
memory_buffer buffer;
|
||||||
@ -1698,7 +1693,7 @@ template <typename Range> class basic_writer {
|
|||||||
: static_cast<char_type>('.');
|
: static_cast<char_type>('.');
|
||||||
float_writer<char_type> w(buffer.data(), static_cast<int>(buffer.size()),
|
float_writer<char_type> w(buffer.data(), static_cast<int>(buffer.size()),
|
||||||
exp, fspecs, point);
|
exp, fspecs, point);
|
||||||
out_ = write_padded(out_, specs, w.size(), w);
|
out_ = write_padded<align::right>(out_, specs, w.size(), w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void write(char value) {
|
void write(char value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user