Closed MaxGyver83 closed 11 months ago
Hi Max, thanks for the patch!
This fixes one of the issues listed in #1060 but doesn't replace any additional spaces with ␣
. Are you able to address that as well? Maybe a local 18 char buffer to copy key
into while replacing ` with
␣`,
Hi Randy, sure. I didn't think about this.
I have updated this pull request. I hope it's not too complicated. The main difficulty is that spaces (1 byte each) get replaced with ␣
which is 3 bytes but only 1 character. I have limited the number of space replacements to 3 because otherwise the destination string might grow in an unpredictable way.
Definitely a little more complicated then I was expecting but its partially because I forgot how to count bytes. It's on the right track though so I'll leave some comments inline.
Applied! Thanks for your work getting this patch in shape!
I get the following warning when building the latest version with this change:
In file included from sam.c:1813:
./vis-cmds.c:663:34: warning: field width should have type 'int', but argument has type 'unsigned long' [-Wformat]
return text_appendf(data, " %-*s\t%s\n", 18+invisiblebytes, buf, (char*)value);
~~~^ ~~~~~~~~~~~~~~~~~
./vis-cmds.c:673:34: warning: field width should have type 'int', but argument has type 'unsigned long' [-Wformat]
return text_appendf(data, " %-*s\t%s\n", 18+invisiblebytes, buf, desc ? desc : "");
I get the following warning when building the latest version with this change:
In file included from sam.c:1813: ./vis-cmds.c:663:34: warning: field width should have type 'int', but argument has type 'unsigned long' [-Wformat] return text_appendf(data, " %-*s\t%s\n", 18+invisiblebytes, buf, (char*)value); ~~~^ ~~~~~~~~~~~~~~~~~ ./vis-cmds.c:673:34: warning: field width should have type 'int', but argument has type 'unsigned long' [-Wformat] return text_appendf(data, " %-*s\t%s\n", 18+invisiblebytes, buf, desc ? desc : "");
Oh, looks like I missed this. I'll change the type of invisiblebytes
to int
!
Fixed in 599ced0. Sorry about that I don't know how I missed it.
Bug fix for #1060.