mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
use width in when printing formatted string to control padding added after the string
This commit is contained in:
@@ -898,6 +898,11 @@ fmt_string :: proc(fi: ^Info, s: string, verb: rune) {
|
|||||||
switch verb {
|
switch verb {
|
||||||
case 's', 'v':
|
case 's', 'v':
|
||||||
strings.write_string(fi.buf, s);
|
strings.write_string(fi.buf, s);
|
||||||
|
if fi.width_set && len(s) < fi.width {
|
||||||
|
for i in 0..<fi.width - len(s) {
|
||||||
|
strings.write_byte(fi.buf, ' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case 'q': // quoted string
|
case 'q': // quoted string
|
||||||
strings.write_quoted_string(fi.buf, s, '"');
|
strings.write_quoted_string(fi.buf, s, '"');
|
||||||
|
|||||||
Reference in New Issue
Block a user