Ticket #4434 (closed defect: fixed)

Opened 5 months ago

Last modified 4 months ago

In `mc.ext.ini`, `Edit` command from `Default` section is ingored in 4.8.29

Reported by: humeniuc Owned by: andrew_b
Priority: minor Milestone: 4.8.30
Component: mc-config-ini Version: 4.8.29
Keywords: mc.ext, mc.ext.ini Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

For 4.8.28 and before, I use Edit=my_editor_command %f in default/* section
in order to configure a default editor.

Since 4.8.29 if an section exists for a filetype but not declaring an Edit command,
pressing <F4> over a file opens mcedit instead my_editor_command from Default section.

Ex: html section exists, and nano is the configured edtor in Default section.
Pressing <F4> over a html file opens mcedit instead of nano.

Old Behavior, 4.8.28 and before

mc -V

GNU Midnight Commander 4.8.28
Built with GLib 2.56.1
Built with S-Lang 2.3.2 with terminfo database
With builtin Editor
With subshell support as default
With support for background operations
With mouse support on xterm
With internationalization support
With multiple codepages support
Virtual File Systems:
 cpiofs, tarfs, sfs, extfs, ftpfs, fish
Data types:
 char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

mc.ext

# html
regex/i/\.html?$
    Open=/home/user/.local/libexec/mc/ext.d/web.sh open html
    View=%view{ascii} /home/user/.local/libexec/mc/ext.d/web.sh view html

# Default target for anything not described above
default/*
    Edit=nano %f
    View=

Behavior

Cursor over x.php.
Press <F4>
nano is started - OK, as expected

Cursor is over x.html
Press <F4>
nano is started - OK, as expected

Changed Behavior 4.8.29

mc -V

GNU Midnight Commander 4.8.29
Built with GLib 2.74.4
Built with S-Lang 2.3.3 with terminfo database
Built with libssh2 1.10.0
With builtin Editor and Aspell support
With subshell support as default
With support for background operations
With mouse support on xterm and Linux console
With support for X11 events
With internationalization support
With multiple codepages support
With ext2fs attributes support
Virtual File Systems:
 cpiofs, tarfs, sfs, extfs, ftpfs, sftpfs, fish
Data types:
 char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;

mc.ext.ini

[html]                                                                                       
Regex=\.html?$                                                                               
RegexIgnoreCase=true                                                                         
Open=/usr/lib/mc/ext.d/web.sh open html                                                      
View=%view{ascii} /usr/lib/mc/ext.d/web.sh view html 

# Default target for anything not described above
[Default]
Edit=nano %f
Open=
View=

Behavior

Cursor over x.php.
Press <F4>
nano is started - OK, as expected

Cursor is over x.html
Press <F4>
mcedit is started - FAIL, nano was expected to start.

Attachments

mc.ext.ini (25.4 KB) - added by humeniuc 5 months ago.
My mc.ext.ini file

Change History

comment:1 Changed 5 months ago by andrew_b

Works for me.

Does your mc.ext.ini above contain only those two sections?

Changed 5 months ago by humeniuc

My mc.ext.ini file

comment:2 Changed 5 months ago by humeniuc

Does your mc.ext.ini above contain only those two sections?

I included only the relevant parts for brevity.
I now attached my mc.ext.ini, although the difference from the default generated mc.ext.ini is only one line ( Edit=nano %f )

I captured the behavior at https://www.youtube.com/watch?v=6UnECS_n0yM
I use the stock mc version from my linux distribution, arch.
I will compile mc from source, to see if the behavior persists.

comment:3 Changed 5 months ago by zaytsev

That might actually be a feature. Do you have "use internal editor" on or off?

comment:4 Changed 5 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.30

Please test.

Branch: 4434_mc.ext.ini_default_action
changeset:59a28653a9cd03ebe6a3b28e73d0cc7933cc4f0f

comment:5 Changed 5 months ago by andrew_b

I've clarified the action processing in the second commit: [ae330f2d7987213fca95c65895b76a4ec4261b9a].

comment:6 Changed 5 months ago by humeniuc

I compiled 4434_mc.ext.ini_default_action branch.
Pressing F4 now use the editor declared in the Default section, as expected.
Thank you.

comment:7 Changed 4 months ago by zaytsev

Thank you for reporting and testing the fix!

comment:8 Changed 4 months ago by andrew_b

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

comment:9 Changed 4 months ago by andrew_b

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

comment:10 Changed 4 months ago by andrew_b

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.