Ticket #3672 (closed defect: fixed)

Opened 14 months ago

Last modified 12 months ago

Unable to redefine tab key action #TAB

Reported by: Argon Owned by: andrew_b
Priority: major Milestone: 4.8.19
Component: mc-key-bindings Version: master
Keywords: TAB, autocompletion, keybinding Cc: xxxargonxxx@…, zaytsev
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

I searched like 5 hours for any way to redefine default action assigned to TAB key (to not switch between panels so to be able to use it for autocompletion). I looked over all mc.keymap config files, but it doesnt contain such setting. I checked man mc, internal mc help utility and this website wiki. No information at all. Is it possible at least?

This issue adressed to problem with TAB key action rebinding (it needs to be possible to trigger autocompletion on TAB key) AND providing any information if it is:
a) possible (so, how?);
b) not possible (this should be covered in man pages, help topics and wiki as well, as special remark)

Change History

comment:1 Changed 14 months ago by Argon

  • Cc xxxargonxxx@… added

comment:2 Changed 14 months ago by andrew_b

  • Milestone changed from Documentation to Future Releases

comment:3 Changed 14 months ago by Argon

Also, similar qustions asked a couple of times in stackexchange/overflow and discussed a lot of times in different help forums, so many people stuck on that. This problem repels many new users out of using MC.

comment:4 Changed 12 months ago by andrew_b

  • Owner set to andrew_b
  • Status changed from new to accepted
  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.18

comment:5 follow-up: ↓ 9 Changed 12 months ago by mooffie

I haven't tested the patch, but the code looks fine.

(I guess you've investigated the possibility of putting the TAB key on the dialog_map keymap and deemed it problematic for some reason.)

Here's an idea for improvement (though I haven't thought about it much; it might be flawed):

If CK_ChangePanel returned MSG_NOT_HANDLED when there's only one panel shown (as in the case of the "Long file list" listing mode), then the TAB will be sent next the to command-line (see sequence diagram). This would let users use TAB to switch panels normally, but to auto-complete when only one panel is shown.

Other random notes, which you can ignore:

  • The "ChangePanel" command introduced here is half of solving #3591.
  • BTW, if the user wants TAB to ChangePanel only if the cmdline is empty, and Complete otherwise, then #3664 would let him do this with:
# !! untested !!
[main:empty-cmdline]
ChangePanel = tab
[main]
ChangePanel =
[input]
Complete = tab; alt-tab

comment:6 follow-up: ↓ 7 Changed 12 months ago by zaytsev

  • Cc zaytsev added

OT: @mooffie did you generate this nice diagram programmatically, or you drew it yourself manually? Just curious.

comment:7 in reply to: ↑ 6 Changed 12 months ago by mooffie

Replying to zaytsev:

OT: @mooffie did you generate this nice diagram programmatically, or you drew it yourself manually? Just curious.


It was generated programmatically. Here, where I introduced this diagram, I linked to its source script.

A little history:

Many years ago I used sequence diagrams to help me study some system. The tool I used for drawing was sdedit, which draws the diagram for you based on a textual description you give it. Unfortunately, its language is horrible for humans (IMHO), so I ended up writing a Ruby "DSL" that, given a less horrible syntax, produces input for sdedit. That's how I generated that diagram. I'd imagine that nowadays there exist nicer tools/languages for doing this.

comment:8 Changed 12 months ago by zaytsev

Ah, I see; thank you for the clarification. In that case, it's not programmatic in a sense that you have to write the DSL yourself, instead of some source code analyzer. That's what I was interested in...

comment:9 in reply to: ↑ 5 Changed 12 months ago by Argon

Replying to mooffie:

(I guess you've investigated the possibility of putting the TAB key on the dialog_map keymap and deemed it problematic for some reason.)

Yes, I tried in many ways (using mc.keymap in user's home dir and also global mc.keymap file in /etc/mc). My settings just ignored/overwritten.

Here's an idea for improvement (though I haven't thought about it much; it might be flawed):

If CK_ChangePanel returned MSG_NOT_HANDLED when there's only one panel shown (as in the case of the "Long file list" listing mode), then the TAB will be sent next the to command-line (see sequence diagram). This would let users use TAB to switch panels normally, but to auto-complete when only one panel is shown.

I like this idea as last resort case, I don't think this is the best idea because one key must do same action no matter how many pannels in screen, thats a good practice for any UI. Users will get used to press TAB for some action being in one panel view mode and will be confused trying to make same action in another view.

  • BTW, if the user wants TAB to ChangePanel only if the cmdline is empty, and Complete otherwise <...>

The bad thing here is that you will be unable to switch if command line is not empty (like in case if you want to put to cmd string some file name from other panel).

Generally, it should be possibly to redefine TAB for autocomplete action and TAB+something for panel switch. Alternatively it also will be useful to make some checkbox for inverting ESC-TAB (M-TAB) with TAB (so ESC-TAB will switch and TAB will autocomplete) - it is easy for configuration and hotkeys will act evenly in any cases. May be last solution is even better than making option for arbitrary redefinition, at least I use panel switching quite rarely and wont be annoyed to press two keys to switch (like now when I annoyed of having to press two key for autocompletion).

comment:10 Changed 12 months ago by andrew_b

  • Votes for changeset set to andrew_b
  • Branch state changed from on review to approved

comment:11 Changed 12 months ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

comment:12 follow-up: ↓ 13 Changed 12 months ago by andrew_b

  • Status changed from testing to closed

comment:13 in reply to: ↑ 12 ; follow-up: ↓ 14 Changed 12 months ago by Argon

Replying to andrew_b:
Nice, thanks! I guess using apt-get for update wont get it because it is not released yet.
What is a proper way to get this patch? Or better to wait until new version release?

comment:14 in reply to: ↑ 13 Changed 12 months ago by andrew_b

Replying to Argon:

What is a proper way to get this patch?

You can try a one of nightly builds.

Or better to wait until new version release?

The next release will be after a long time (several months).

Note: See TracTickets for help on using tickets.