9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [PATCH] Make pstree work with proportional fonts
@ 2023-11-22 23:11 Blue-Maned_Hawk
  2023-11-23  4:27 ` Jacob Moody
  0 siblings, 1 reply; 13+ messages in thread
From: Blue-Maned_Hawk @ 2023-11-22 23:11 UTC (permalink / raw)
  To: 9front

Pstree's current placement of the box-drawing characters after an 
inconsistent proportion of digits and spaces means that they don't align 
when using proportional fonts.  This patch rearranges the output of 
pstree to have the box-drawing characters first.

diff 6b6b9a236d773c704daaf7f7b5b090111e28ac87 uncommitted
--- a/sys/src/cmd/pstree.c
+++ b/sys/src/cmd/pstree.c
@@ -149,7 +149,7 @@
  	last = *--r;
  	*r = last == L' ' ? L'└' : L'├';
  	if(p->pid != 0){
-		Bprint(&bout, "%-11d %S", p->pid, buf);
+		Bprint(&bout, "%S%d: ", buf, p->pid);
  		printargs(p->pid);
  		Bprint(&bout, "\n");
  	}
\x1f
diff f70cf0b70eb2b9b6cdf7208bf775189c724eb446 uncommitted
--- a/sys/man/1/ps
+++ b/sys/man/1/ps
@@ -109,10 +109,12 @@
  to print the arguments for the process.  Newlines in arguments will be 
translated to spaces for display.
  .PP
  .I Pstree
-prints the processes as a tree in a two-column layout where
-the first column being the process id and second column
-the program name and arguments indented and prefixed with
-line drawing runes to reflect the nesting in the hierarchy.
+prints the processes as a tree in a layout where each line
+coresponds to a process and consists of line-drawing
+characters reflecting the nesting of the process in terms of
+the surrounding lines followed by the process ID followed by
+a colon and a space followed by the program name and
+arguments.
  .SH FILES
  .B /proc/*/status
  .SH SOURCE

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-22 23:11 [9front] [PATCH] Make pstree work with proportional fonts Blue-Maned_Hawk
@ 2023-11-23  4:27 ` Jacob Moody
  2023-11-23  4:39   ` umbraticus
  0 siblings, 1 reply; 13+ messages in thread
From: Jacob Moody @ 2023-11-23  4:27 UTC (permalink / raw)
  To: 9front

On 11/22/23 17:11, Blue-Maned_Hawk wrote:
> Pstree's current placement of the box-drawing characters after an 
> inconsistent proportion of digits and spaces means that they don't align 
> when using proportional fonts.  This patch rearranges the output of 
> pstree to have the box-drawing characters first.

The width specifier there makes all pids take up 11 characters minimum
so the characters until the "box characters" is consistent.
I am not exactly sure what the bug here is or why this patch fixes it.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-23  4:27 ` Jacob Moody
@ 2023-11-23  4:39   ` umbraticus
  2023-11-23  4:45     ` Jacob Moody
  2023-11-25  0:29     ` Blue-Maned_Hawk
  0 siblings, 2 replies; 13+ messages in thread
From: umbraticus @ 2023-11-23  4:39 UTC (permalink / raw)
  To: 9front

> I am not exactly sure what the bug here is or why this patch fixes it.

hand-wringing over pixels like this, I guess:

http://www.9paste.net/none/proptree.png

get a life.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-23  4:39   ` umbraticus
@ 2023-11-23  4:45     ` Jacob Moody
  2023-11-23  4:56       ` umbraticus
  2023-11-25  0:29     ` Blue-Maned_Hawk
  1 sibling, 1 reply; 13+ messages in thread
From: Jacob Moody @ 2023-11-23  4:45 UTC (permalink / raw)
  To: 9front

On 11/22/23 22:39, umbraticus@prosimetrum.com wrote:
>> I am not exactly sure what the bug here is or why this patch fixes it.
> 
> hand-wringing over pixels like this, I guess:
> 
> http://www.9paste.net/none/proptree.png

I see, now that makes sense.

> 
> get a life.

Is this directed at me?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-23  4:45     ` Jacob Moody
@ 2023-11-23  4:56       ` umbraticus
  2023-11-23  5:30         ` ori
  0 siblings, 1 reply; 13+ messages in thread
From: umbraticus @ 2023-11-23  4:56 UTC (permalink / raw)
  To: 9front

> Is this directed at me?

no, people worried about such things

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-23  4:56       ` umbraticus
@ 2023-11-23  5:30         ` ori
  2023-11-23  5:51           ` Kurt H Maier
  2023-11-23  5:59           ` umbraticus
  0 siblings, 2 replies; 13+ messages in thread
From: ori @ 2023-11-23  5:30 UTC (permalink / raw)
  To: 9front

Quoth umbraticus@prosimetrum.com:
> > Is this directed at me?
> 
> no, people worried about such things

meh, it'd annoy me too. I'd suggest using a
tab here, though, as god intended.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-23  5:30         ` ori
@ 2023-11-23  5:51           ` Kurt H Maier
  2023-11-23  5:59           ` umbraticus
  1 sibling, 0 replies; 13+ messages in thread
From: Kurt H Maier @ 2023-11-23  5:51 UTC (permalink / raw)
  To: 9front

On Thu, Nov 23, 2023 at 12:30:00AM -0500, ori@eigenstate.org wrote:
> Quoth umbraticus@prosimetrum.com:
> > > Is this directed at me?
> > 
> > no, people worried about such things
> 
> meh, it'd annoy me too. I'd suggest using a
> tab here, though, as god intended.
> 

pic(1)

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-23  5:30         ` ori
  2023-11-23  5:51           ` Kurt H Maier
@ 2023-11-23  5:59           ` umbraticus
  2023-11-25  0:29             ` Blue-Maned_Hawk
  1 sibling, 1 reply; 13+ messages in thread
From: umbraticus @ 2023-11-23  5:59 UTC (permalink / raw)
  To: 9front

> I'd suggest using a tab here, though, as god intended.

http://www.9paste.net/none/tabtab.png


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-23  5:59           ` umbraticus
@ 2023-11-25  0:29             ` Blue-Maned_Hawk
  2023-11-25  1:33               ` Jacob Moody
  0 siblings, 1 reply; 13+ messages in thread
From: Blue-Maned_Hawk @ 2023-11-25  0:29 UTC (permalink / raw)
  To: 9front

On 11/23/23 00:59, umbraticus@prosimetrum.com wrote:
>> I'd suggest using a tab here, though, as god intended.
> 
> http://www.9paste.net/none/tabtab.png

As it happens, i'd in fact tried using tabs for this patch instead 
before settling on its current state.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-23  4:39   ` umbraticus
  2023-11-23  4:45     ` Jacob Moody
@ 2023-11-25  0:29     ` Blue-Maned_Hawk
  2023-11-25  1:40       ` umbraticus
  1 sibling, 1 reply; 13+ messages in thread
From: Blue-Maned_Hawk @ 2023-11-25  0:29 UTC (permalink / raw)
  To: 9front

On 11/22/23 23:39, umbraticus@prosimetrum.com wrote:
> get a life.

Hostility getsn't a person nowhere.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-25  0:29             ` Blue-Maned_Hawk
@ 2023-11-25  1:33               ` Jacob Moody
  2023-11-25 12:11                 ` Blue-Maned_Hawk
  0 siblings, 1 reply; 13+ messages in thread
From: Jacob Moody @ 2023-11-25  1:33 UTC (permalink / raw)
  To: 9front

On 11/24/23 18:29, Blue-Maned_Hawk wrote:
> On 11/23/23 00:59, umbraticus@prosimetrum.com wrote:
>>> I'd suggest using a tab here, though, as god intended.
>>
>> http://www.9paste.net/none/tabtab.png
> 
> As it happens, i'd in fact tried using tabs for this patch instead 
> before settling on its current state.

You'll find this space padded numerical output pattern to be quite common in
Plan 9, pstree is not unique in this. With a majority of fonts we ship with the system,
this works fine. If we label this instance "wrong" do we also intend to fix it elsewhere?
Changing this output also has the consequence of breaking people's existing scripts, and while
pstree is not exactly used for scripting there are other instances of this space padded numeric
output that very much are.

I would prefer to not go ripping up the floorboards because the output does not look perfect on
some custom fonts. If you would like to have a "perfect" display that knows how wide your font is
and takes that in to account I suggest to try your hand at writing a graphical program. Perhaps you
can make your own 9front task manager with collapsible process tree.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-25  0:29     ` Blue-Maned_Hawk
@ 2023-11-25  1:40       ` umbraticus
  0 siblings, 0 replies; 13+ messages in thread
From: umbraticus @ 2023-11-25  1:40 UTC (permalink / raw)
  To: 9front

> Hostility getsn't a person nowhere.

Whither've double negatives & other obstinately idiomatic speech patterns gotten thee?

But sure, I'll rephrase. I am an avid user of proportional fonts and
things like this can annoy me a little but never to the point that
I have bothered to fix them, so thanks for the patch, I guess.

I think I once hacked up a font-changing mechanism for rio & it
wasn't too hard, but again, never bothered keeping it. iirc there
is some scaffolding in libframe and/or rio to indicate that this may
have been an intended feature.

khm's mentioning pic somehow made me try pstree | page which
will do in a pinch to see monospaced output all lined up, so thanks
for instigating that discovery, too.

umbraticus

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [9front] [PATCH] Make pstree work with proportional fonts
  2023-11-25  1:33               ` Jacob Moody
@ 2023-11-25 12:11                 ` Blue-Maned_Hawk
  0 siblings, 0 replies; 13+ messages in thread
From: Blue-Maned_Hawk @ 2023-11-25 12:11 UTC (permalink / raw)
  To: 9front

On 11/24/23 20:33, Jacob Moody wrote:
> Changing this output also has the consequence of breaking people's existing scripts, and while
> pstree is not exactly used for scripting there are other instances of this space padded numeric
> output that very much are.

Ah, i see.  In that case, i hereby completely rescind this patch.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-11-25 12:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-22 23:11 [9front] [PATCH] Make pstree work with proportional fonts Blue-Maned_Hawk
2023-11-23  4:27 ` Jacob Moody
2023-11-23  4:39   ` umbraticus
2023-11-23  4:45     ` Jacob Moody
2023-11-23  4:56       ` umbraticus
2023-11-23  5:30         ` ori
2023-11-23  5:51           ` Kurt H Maier
2023-11-23  5:59           ` umbraticus
2023-11-25  0:29             ` Blue-Maned_Hawk
2023-11-25  1:33               ` Jacob Moody
2023-11-25 12:11                 ` Blue-Maned_Hawk
2023-11-25  0:29     ` Blue-Maned_Hawk
2023-11-25  1:40       ` umbraticus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).