rcmdnk / sentaku

Utility to make sentaku (selection, 選択(sentaku)) window with shell command.
http://rcmdnk.github.io/blog/2014/01/24/computer-bash-zsh/
MIT License
140 stars 6 forks source link

Backspace not functionnal in search #6

Closed Arnaudv6 closed 8 years ago

Arnaudv6 commented 8 years ago

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

rcmdnk commented 8 years ago

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.

Arnaudv6 commented 8 years ago

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

rcmdnk commented 8 years ago

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 8 years ago

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
Arnaudv6 commented 8 years ago

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

Arnaudv6 commented 8 years ago
$ 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.

rcmdnk commented 8 years ago

Thanks both.

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

It should work with v0.4.8.

xrat commented 8 years ago

Great! Works for me!

Arnaudv6 commented 8 years ago

Works here to ! Thanks rcmdnk !