clients: draw border around qr code on linux console

Scanners won't recognize it on black background otherwise.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/327
This commit is contained in:
Lubomir Rintel
2019-11-04 15:27:13 +01:00
parent 8eb20013ab
commit c820c98f2a

View File

@@ -561,9 +561,9 @@ nmc_print_qrcode (const char *str)
if (term_linux) { if (term_linux) {
/* G1 alternate character set on Linux console. */ /* G1 alternate character set on Linux console. */
for (y = 0; y < size; y += 1) { for (y = -1; y < size + 1; y += 1) {
g_print (" \033[37;40;1m\016"); g_print (" \033[37;40;1m\016");
for (x = 0; x < size; x++) { for (x = -1; x < size + 1; x++) {
g_print ( qrcodegen_getModule (qrcode, x, y) g_print ( qrcodegen_getModule (qrcode, x, y)
? " " : "\060\060"); ? " " : "\060\060");
} }