Index | Thread | Search

From:
James Cook <falsifian@falsifian.org>
Subject:
Re: [new] gurk-rs - a cli signal client
To:
ports@openbsd.org
Date:
Sun, 19 May 2024 15:48:46 +0000

Download raw body.

Thread
On Thu, May 16, 2024 at 07:53:41PM GMT, Stefan Hagen wrote:
>James Cook wrote (2024-05-14 21:21 CEST):
>> > I wasn't able to link to my phone because the QR code is not displayed in a
>> > usable way.  Here are the first three lines of what I assume is supposed to
>> > be a QR code.
>> >
>> > 	$ gurk
>> > 	Linking new device with device name: gurk@angel
>> > 						     	   ▄▄▄▄▄    ▄▄ ▄ ▄   ▄   ▄▄ ▄ ▄      ▄▄▄▄▄   		    ▄  ▄  ▄ ▄ ▄ ▄
>> > ▄ ▄     ▄          	    ▄▄▄    ▄ ▄▄▄▄▄▄▄▄▄  ▄▄▄▄  ▄▄ ▄▄   ▄▄▄
>>
>> Sorry, format=flowed messed that up. Here are the first three lines
>> again:
>>
>>            ▄▄▄▄▄    ▄▄ ▄ ▄   ▄   ▄▄ ▄ ▄      ▄▄▄▄▄
>>                     ▄  ▄  ▄ ▄ ▄ ▄ ▄ ▄     ▄
>>             ▄▄▄    ▄ ▄▄▄▄▄▄▄▄▄  ▄▄▄▄  ▄▄ ▄▄   ▄▄▄
>
>Try playing with a different font / different terminal.
>It should look like a square'ish block that resembles
>a QR code.
>
>Best regards,
>Stefan

Some more info:

I tried redirecting gurk's stdout to a file. Feeding that output to vis, it begins like this:

	Linking new device with device name: gurk@angel
	\^[[m\^[[m \^[[m\^[[m\^[[m\^[[m \^[[m\^[[m\^[[m\^[[m \^[[m\^[[m

This seems broken, because when I wrote my own program to call 
qr2term::print_qr, the output began like this (again, viewed with
vis):

	\^[[48;5;15m\^[[38;5;0m \^[[49m\^[[39m\^[[48;5;15m

It looks like some terminal escape codes are not properly generated 
when gurk calls qr2term::print_qr. My own program's output is a 
usable QR code.

I tried gurk in xterm, in tmux in xterm, and in gnome-terminal 
(hastily installed just for this purpose; gnome-terminal is using 
a weird ugly font and I didn't dig into why). In all three cases, 
gurk|vis|head shows the same (as far as I can see) sequence of 
\^[[m\^[m.... The TERM environment variable is "xterm", "screen"
and "xterm-256color respectively in those three cases.


--------

Details on how I manually tried qr2term::print_qr:

I built and ran the following program:

	use qr2term;

	fn main() {
	    qr2term::print_qr("https://rust-lang.org/").unwrap();
	}

and it works fine: I see a (kind of ugly) QR code on the terminal 
that I can scan. I built it with the following Cargo.toml file, 
which I generated with "cargo init" then "cargo add qr2term":

	[package]
	name = "r"
	version = "0.1.0"
	edition = "2021"

	# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

	[dependencies]
	qr2term = "0.3.1"

-- 
James