screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Format strings -fu: truncating/padding


From: Chris Jones
Subject: Re: Format strings -fu: truncating/padding
Date: Fri, 04 Dec 2009 23:26:00 -0500
User-agent: Mutt/1.5.18 (2008-05-17)

On Fri, Dec 04, 2009 at 04:46:52AM EST, Jeremie Le Hen wrote:

> Hi list,
> 
> I've been using screen for a couple of years with a hardstatus string
> stolen on the web and tinkled a bit afterward.  But now I'd like to
> improve it.
> 
> Format escape sequences are fairly easy to understand (although
> re-reading them is another thing ;p) except the truncation/padding
> stuff.  I've tried to read and re-read the paragraphs about %=, %<
> and %= multiples times but honestly, I can't grasp the way it works.

Neither can I. 

Quote from the screen manual:

`>'
     mark the current text position for the next truncation. When
     screen needs to do truncation, it tries to do it in a way that the
     marked position gets moved to the specified percentage of the
     output area. (The area starts from the last absolute pad position
     and ends with the position specified by the truncation operator.)

Where (and how) is the percentage specified? What is the output area?
What's the last absolute pad position? What is a truncation operator?
How do you use it to specify the position?

> By browsing the web, it seems humans capable of mastering screen's
> string escapes exist but they didn't bother explaining those thoroughly.

I believe ubuntu ships a version of screen that features extensive
customization of the caption/hardstatus lines. You may want to take a
look at the config files.

> So my first question is: has a book (or more seriously an article or a
> detailed post) ever been written on the subject?  Is yes, I'd be glad to
> be pointed it out.

For such fine print you probably need to read the code.

> As a matter of fact, I'm trying to have a hardstatus string ressembling
> this (I've left out the attributes/color modifiers):
>     
>     [%H] %-w (%n-%t) %+n [%d/%m %c]
> 
> But I'd like [%H] to be snugged against the left side and [%d/%m %c] the
> be against the right one and the window list centered betweenthem.  I've
> fumbled to get this and eventually more or less found a solution at work
> by picking ideas here and there on the web:
> 
>     [%H]%= %-w (%n-%t) %+w %=[%d/%m %c]
> 
> But the icing on the cake would be the window list pushing neither left
> or right but instead getting trimmed with the current window still in
> the center.  But this I've never managed to make this up.
> 
> Thanks in advance for your help!

Try this:

  %0=[%H] %= %-w (%n-%t) %+w %= %93=[%d/%m %c]

Seriously, as much as I love GNU/screen, I feel that this part of the
manual needs a serious rewrite.. maybe send in a bug report?

But since my guess is that the vast majority of GNU/screen users don't
give a hoot about status line customization, you're probably on your
own with this one.

CJ




reply via email to

[Prev in Thread] Current Thread [Next in Thread]