Sat, 03 Nov 2018 03:12:37 +0000 Tinker <t1...@protonmail.ch>
> On Saturday, November 3, 2018 10:29 AM, Diogo Galvao <diog...@gmail.com> 
> wrote:
> > Em sex, 2 de nov de 2018 às 19:06, li...@wrant.com escreveu:
> >  
> > > I use these bindings and history control options in the $HOME/.profile:
> > > bind -m '^L'=^U\ clear'^J^Y'
> > > bind -m '^[^L'=^U\ reset\;clear'^J^Y'
> > > export HISTCONTROL=ignoredups:ignorespace  
> >
> > Since June 18 [1] there's a new clear-screen editing command that we can
> > bind accordingly:
> >
> > bind ^L=clear-screen
> >
> > It's been working like a charm.
> >
> > [1]: https://cvsweb.openbsd.org/src/bin/ksh/ksh.1#rev1.201
> >
> > Yours,
> > Diogo  
> 
> 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

Reply via email to