Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, November 3, 2018 5:18 PM, <li...@wrant.com> wrote:
..
> > > bind ^L=clear-screen
> > > It's been working like a charm.
..
> > Ah, perfect - finally. This is way cleaner, perfect even - the previous
> > solution had the space prefix history filtering quirk and would also
> > flash the word "clear" on the screen when pressing ctrl+L.
> > Works out of the box in 6.4. Thanks a ton.
> > Tinker
>
> Hi Diogo, Tinker, misc@,
>
> Yes indeed. I tried that at the time of addition and now again, only to
> reiterate once more why I kept using the complex combination assignment.
>
> In my use case, it doesn't work clean on multiple line prompts like with
> '\n' in PS1, a clear-screen loses all prompt lines before the last line.
>
> To see if you could reproduce this behaviour try the following examples:
>
> PS1='=== line1 ===\n=== line2 ===\nline3 h\! \$ '
> bind ^L=clear-screen
> HISTCONTROL=ignoredups:ignorespace
> export PS1 HISTCONTROL
>
> Here the history line count stays accurate on issuing ^L, try 'fc -l 1'.
> For comparison with the actual prompt and working clear assignment, see:
>
> PS1='\a=== \D{%a %b %d [%H:%M]} \u@\h:\w (\l) j\j e$? h\! ===\n\$ '
> bind -m '^L'=^U\ clear'^J^Y'
> HISTCONTROL=ignoredups:ignorespace
> export PS1 HISTCONTROL
>
> Here the multiple line output prompt is kept, and indeed screen flashes.
> Oddly the history line count '\!' increases on ^L, albeit 'ignorespace'.
>
> I can understand why it changes, but it renumbers the history sequences.
> The command issued first is listed as a different higher number, really?
>
> Ideally, clear-screen would honour the prompt more faithfully, and for a
> perfect score would have (please suggest) a variant to also issue reset.
>
> Most probably, it is too much weight to have reset-clear-screen builtin.
>
> Not sure anything needs fixes, definitely using the work around for now.
> But the history count renumbering, plus the discrepancy is just bugging.
>
> Kind regards,
> Anton Lazarov

Hi Anton,

Aha so "bind ^L=clear-screen" is perfect for your usecase also, except
in a multi-line PS1 it will presently only show the last line of the
PS1 after the clearscreen.

I wonder if this is deliberate - I'd wildguess this behavior requires
more implementational complexity than printing the whole multiline set
would - you can check the code. If it's the other way around and a
trivial tweak is needed to print the multiline prompt (if fixing your
thing would mean removal of complexity maybe it would be welcome too),
maybe a diff would be welcome, just guessing.

(About your space prefix based approach I understand you have issues, I
think that whole approach looks like asking for problems. I'd be
interested first to understand if clear-screen is supposed to match
your usecase, I think it is but don't know.)

Tinker

Reply via email to