As it turns out, using just a \r without it Windows compatriat \n will, well, return cursor to start on line, without, well, adding a newline. This may seem obvious⦠however, I never thought ācarriage returnā was literal.
@Druvis had it one of his video I re-watched since Iād recommended it another thread. He used \r\t\t\t in a :put to show an array-of-arrays to organize columns. You have to pause to catch the subtlety.
This may be esoteric to most, but avoids the [/terminal/cuu] (ācursor move one line upā) to do similar, which is more complex scheme to do columns since you have :put each cell, the use /terminal/cuu. Nor, calculating the number of tabs needed to include in [carefully] crafted string.
Anyway here is an example:
:for i from=0 to=10 do={
:local rnd do={:return [:rndstr length=[:rndnum from=5 to=20]]}
:local k "key-$[$rnd]"
:local v "value $[$rnd]"
:local m "#metadata?$[$rnd]"
:put " $k \r\t\t\t $v \r\t\t\t\t\t\t $m"
}
key-ofROyWb982Uha7rbkAA value 6tONhZrm4uug #metadata?HZG6EyRzrdc
key-tQUsw5xyqP54eb2GqTV value hy525M #metadata?aWMVnISf8gPPBNjvxZb
key-fHbrkZ4 value 8sby0Tc #metadata?eUXMPoGRM
key-P9Ls5ldiRvjJwVpaGv value 3O1kBNfO1Cl6APPYe #metadata?dAoedoPR3
key-DeCtksUVDDWEc value frDDy08Kx #metadata?SzrfzPpkd98Mt
key-7pkLfVq5CJ value fiejKZ2AAh #metadata?v9Wn4
key-3jrae5HfHLtmV value FkFg51MLfrQBbfxJ #metadata?jBNqcXp6E9LJ
key-SPr0bPQh value APLo12Nt9e #metadata?kfbmVZZEERET
key-VQl4hORKpObCH value Nvsd3cG4 #metadata?7DaB7
key-F7uW86HBsJQIGWO3 value twdkfht9dPmq #metadata?LAdEnHUzar
key-o0lRm8kxNft value L8Jt0Kodh8EVy #metadata?l3wxNXnmJ4
With the important line being:
:put " $k \r\t\t\t $v \r\t\t\t\t\t\t $m"
And that⦠\t == 8 characters forward
So the first \r\t\t\t means go to beginning of line, and move 3 * 8 (24) characters forward (without overriding text, apparently). And second group of \r\t\t\t\t\t\t start the third column at 24 (\t\t\t) for 1st column + another 24 \t\t\t allowed for 2nd column. With \r helping to keep the math simple:
desired output column # / 8 === number of \t tabs needed
With :put internally adding the \n for you.
I suppose this how the print command prints itās columns too - just never thought about it.
