rcmdnk/sentaku

Backspace not functionnal in search

Arnaudv6 opened this issue · 9 comments

Hello rcmdnk,
me again, still wonderfully happy with your script.

When I hit backspace key in "search", I get a weird UTF character printed,
but previous key is not removed from search, instead "backspace" character is searched for...
I report it though it's not a hot problem in my workflow.

I stay tuned if more info be needed.
thanks
Arnaudv6

Hello,

what type of character does it show?
It may be that Backspace is assigned to other than Ctrl-H in your terminal (or OS, or shell).

In "search" mode, it uses character of $'\ch' (=Ctrl-H = 08) as deleting one character..

You can check which character is passed by backspace key by:

$ echo ^H|od -x
0000000      0a08
0000002
$ echo ^H|od -a
0000000   bs  nl
0000002

^H is Ctrl-V + Backspace. (or you will see different character if it is set to so).
It should show 0a0x and bs as above.

It could be a good information to update the script,
so if you have a time, could you please try it.

Thanks for the support, here is what I get:

$ echo ^H|od -x
0000000 485e 000a
0000003
$ echo ^H|od -a
0000000 ^ H nl
0000003

I think you put ^ and H directly there. (or copy and paste)
^H is special character which you can put by Ctrl-V then Ctrl-H.

xrat commented

I can confirm the problem. The whole thing might depend on the TERM setup, though.

$ echo ^?|od -x
0000000 0a7f
0000002
$ echo ^?|od -a
0000000 del  nl
0000002
$ echo $TERM
xterm

You're right, I got it wrong in the first place:

$ echo ^?|od -x (Ctrl-V + Backspace)
0000000 0a7f
0000002
$ echo ^H|od -x (Ctrl-V then Ctrl-H)
0000000 0a08
0000002
$ echo ^?|od -a (Ctrl-V + Backspace)
0000000 del  nl
0000002
$ echo ^H|od -a (Ctrl-V then Ctrl-H)
0000000  bs  nl
0000002

Hope I'm right this time

$ echo $COLORTERM
xfce4-terminal

forgot to mention this.
xfce4-terminal has compatibility modes for [backspace] and [del] keys:
They both can be set to either "ASCII supr", "escaping sequence", "ctrl-H", "blank TTY"
Last option we want to ignore of course.

Thanks both.

I put the Backspace code to delete search characters, too.

It should work with v0.4.8.

xrat commented

Great! Works for me!

Works here to ! Thanks rcmdnk !