View previous topic :: View next topic |
Author |
Message |
dgouders n00b
Joined: 29 Jan 2024 Posts: 9
|
Posted: Mon Jan 29, 2024 10:12 am Post subject: Double backspaces in tty output |
|
|
Could someone please explain the reason for portage printing "\b\b" in various situations?
`git log` has no single mentioning of the word backspace, so it probably is a very obvious reason
but I am failing to see it.
One example is `emerge --search ...`:
Code: |
search.py:388
msg.append(
"\b\b \n[ Results for search key : " + bold(self.searchkey) + " ]\n"
)
|
Regards
Dirk |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3826 Location: Rasi, Finland
|
Posted: Mon Jan 29, 2024 12:26 pm Post subject: |
|
|
I can only guess it's meant to remove the so called "spinner" on the previous line. _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
dgouders n00b
Joined: 29 Jan 2024 Posts: 9
|
Posted: Mon Jan 29, 2024 2:42 pm Post subject: |
|
|
Thanks for the hint.
Then perhaps commit 4938b8a8a72e719b (Display emerge search results incrementally (412471))
caused just two inital \b in --search output:
Quote: |
The spinner is now disabled, but the spinner
code remains, in case we later decide to enable it optionally.
|
The reason I am asking is that I was wondering what a pager application that I am working on
should do with those. less(1) outputs them as "^H^H".
Perhaps, a pager should just output them and let the tty handle them...
Regards
Dirk |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3826 Location: Rasi, Finland
|
Posted: Mon Jan 29, 2024 3:02 pm Post subject: |
|
|
dgouders wrote: | less(1) outputs them as "^H^H". | I'd guess passing -R would strip them. man less wrote: | : | -r or --raw-control-chars
Causes "raw" control characters to be displayed. The
default is to display control characters using the
caret notation; for example, a control-A (octal 001)
is displayed as "^A" (with some exceptions as de‐
scribed under the -U option). Warning: when the -r
option is used, less cannot keep track of the actual
appearance of the screen (since this depends on how
the screen responds to each type of control charac‐
ter). Thus, various display problems may result,
such as long lines being split in the wrong place.
USE OF THE -r OPTION IS NOT RECOMMENDED.
-R or --RAW-CONTROL-CHARS
Like -r, but only ANSI "color" escape sequences and
OSC 8 hyperlink sequences are output in "raw" form.
Unlike -r, the screen appearance is maintained cor‐
rectly, provided that there are no escape sequences
in the file other than these types of escape se‐
quences. Color escape sequences are only supported
when the color is changed within one line, not across
lines. In other words, the beginning of each line is
assumed to be normal (non-colored), regardless of any
escape sequences in previous lines. For the purpose
of keeping track of screen appearance, these escape
sequences are assumed to not move the cursor.
OSC 8 hyperlinks are sequences of the form:
ESC ] 8 ; ... \7
The terminating sequence may be either a BEL charac‐
ter (\7) or the two-character sequence "ESC \".
ANSI color escape sequences are sequences of the
form:
ESC [ ... m
where the "..." is zero or more color specification
characters. You can make less think that characters
other than "m" can end ANSI color escape sequences by
setting the environment variable LESSANSIENDCHARS to
the list of characters which can end a color escape
sequence. And you can make less think that charac‐
ters other than the standard ones may appear between
the ESC and the m by setting the environment variable
LESSANSIMIDCHARS to the list of characters which can
appear. |
|
To think of it... -R maybe should be defaulted on.
Anyway, if I were to create an anternative pager, then (by default) I'd let it pass all the color code characters and text formatting characters, in addition to obvious line feeds and tabs. Then just strip the rest, or alternatively display them the same way cat -A does for example.
May I ask what features are you planning on your pager..? _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
dgouders n00b
Joined: 29 Jan 2024 Posts: 9
|
Posted: Mon Jan 29, 2024 6:53 pm Post subject: |
|
|
Hmm, -R is on here -- that is a reason why I was wondering about its ^H:
Code: |
$ echo $LESS
-R -M --shift 5 -i
|
In short: my pager reloads manual pages on resizes of the terminal and it can visit
manual pages that are being referred to in the one you are currently paging. Quite useful
for git(1) etc.
You can see all the features (and try it, if you want) at
https://github.com/dgouders/lsp
But there is no ebuild yet -- I have one local but only for 0.4.0 and that you don't want to test, because
there were some major fixes since then. My plan was to pring it in through GURU but only after I have fixed all
major problems -- like input with two backspaces...
Regards
Dirk |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3826 Location: Rasi, Finland
|
Posted: Mon Jan 29, 2024 8:25 pm Post subject: |
|
|
dgouders wrote: | https://github.com/dgouders/lsp
But there is no ebuild yet -- I have one local but only for 0.4.0 and that you don't want to test, because
there were some major fixes since then. My plan was to pring it in through GURU but only after I have fixed all
major problems -- like input with two backspaces...
Regards
Dirk | Please do make a topic in Gentoo Chat after you have submitted lsp there.
I'll, for sure, test it by then at least. ;) _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
dgouders n00b
Joined: 29 Jan 2024 Posts: 9
|
Posted: Mon Jan 29, 2024 8:54 pm Post subject: |
|
|
Zucca wrote: |
Please do make a topic in Gentoo Chat after you have submitted lsp there.
I'll, for sure, test it by then at least.
|
Will do, thank you.
But: there is no raw output (yet) -- I thought I implement the tough part first but it seems I was wrong with this assumption.
That's not a stopper for GURU though -- just to minimize your expectations.
Also, today I read the following discussion and realized that with my current testing, I didn't even try to feed a file in /proc or /sys to lsp:
https://lore.kernel.org/all/20240127094717.63c09edb@rorschach.local.home/T/#mc8cea1b2e1469927ff3ad72c41ccf1481ccbadf6
So, there is quite some work left.
(Anyway: I'm using PAGER=lsp for about two years now and the branch next always has the last commits that fixed the major problems I am aware of.)
Regards
Dirk |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3826 Location: Rasi, Finland
|
Posted: Wed Feb 21, 2024 10:35 am Post subject: |
|
|
I just installed lsp and learning how to use it.
Content redraw works great when resizing the terminal window.
I'll start experimenting with it. I already ran Code: | PAGER=lsp man emerge | ... and I could follow "links" to other man pages. _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2556
|
Posted: Wed Feb 21, 2024 11:00 am Post subject: |
|
|
I'm not sure if this is relevant, but LSP also means Language Server Protocol and there are a lot of emacs and vim lsp plugins. Now this is completely different thing and confusion doesn't seem very likely, because one is a command and the other - protocol, but I just thought it's good to let you know.
Otherwise it sounds good and as soon as I try it I might write an ebuild for it.
Best Regards,
Georgi |
|
Back to top |
|
|
Zucca Moderator
Joined: 14 Jun 2007 Posts: 3826 Location: Rasi, Finland
|
Posted: Wed Feb 21, 2024 12:27 pm Post subject: |
|
|
logrusx wrote: | I might write an ebuild for it. | It's in ::guru. ;) _________________ ..: Zucca :..
My gentoo installs: | init=/sbin/openrc-init
-systemd -logind -elogind seatd |
Quote: | I am NaN! I am a man! |
|
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2556
|
Posted: Wed Feb 21, 2024 12:44 pm Post subject: |
|
|
Zucca wrote: | logrusx wrote: | I might write an ebuild for it. | It's in ::guru. ;) |
- Shouldn't it be in sys-apps like less
- I think it doesn't need src_configure since it inherits meson eclass and it's the last to be inherited, it should automatically pick up meson_src_configure
- What delayed me is I wondered how to make it available in eselect pager.
Best Regards,
Georgi |
|
Back to top |
|
|
dgouders n00b
Joined: 29 Jan 2024 Posts: 9
|
Posted: Fri Jan 03, 2025 8:29 pm Post subject: |
|
|
Hi Georgi,
I missed that last post for quite some time. Sorry.
logrusx wrote: | Zucca wrote: | logrusx wrote: | I might write an ebuild for it. | It's in ::guru. |
- Shouldn't it be in sys-apps like less
- I think it doesn't need src_configure since it inherits meson eclass and it's the last to be inherited, it should automatically pick up meson_src_configure
- What delayed me is I wondered how to make it available in eselect pager.
|
Meanwhile, Zucca opened another topic concerning lsp to
give it more testing and bug fixes.
I'm not sure about sys-apps or app-text and don't remember why I chose app-text.
I can correct it if it is better.
In the next ebuild for GURU I will also try to leave out src_configure as you suggested.
Best regards,
Dirk |
|
Back to top |
|
|
|