Bug 848899

Summary: Ctrl-PgUp and Ctrl-PgDn keys no longer work on MC
Product: [Fedora] Fedora Reporter: Steevithak <steevithak>
Component: gnome-terminalAssignee: Matthias Clasen <mclasen>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 19CC: behdad, dvlasenk, egmont, mclasen, pahan, pknirsch, slavazanko
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 551062 Environment:
Last Closed: 2014-02-05 12:04:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Steevithak 2012-08-16 18:17:19 UTC
+++ This bug was initially created as a clone of Bug #551062 +++

Description of problem: 

There is a long-standing bug in GNOME terminal that causes it to output incorrect escape sequences for certain key combinations. Maintainers have long refused or been unable to fix the bug. To work around the GNOME terminal bug, Midnight Command uses alternate key-combos for certain actions such as move-to-end-of-file and move-to-top-of-file. At some point around Fedora 14, the MC maintainers updated the key combos used by MC, in the process removing the special key-combos that work around the GNOME terminal bug. After their update, the MC key-combos for top-of-file and end-of-file no longer work as-installed on Fedora or *any* GNOME-based distro.

GNOME terminal maintainers have still not fixed the terminal bug. MC maintainers now refuse to revert their changes and use key-combos compatible with GNOME. But there is an easy fix - RedHat just needs to update the mc.keymap file to contain key-combos that actual work with Fedora. All that's needed is to change a couple of lines in the MC config file. This bug was originally filed in 2009 against F14 but no progress has been made toward getting a working mc.keymap file yet. The bug has now been closed due to end-of-life for F14 so I'm refiling it using the "clone" feature for Fedora 17.


Version-Release number of selected component (if applicable):
any post-2009 version of mc

How reproducible:
always

Steps to Reproduce:
1. install MC on Fedora 14, 15, 16, or 17
2. press F4 to edit a large text file ( 50+ lines ) 
3. press Ctrl-PgDn, then Ctrl-End
  
Actual results:
nothing happens


Expected results:
cursor should move to the last character in the file


Additional info:

--- Additional comment from srainwater on 2009-12-28 14:18:18 EST ---

The Ctrl-Home and Ctrl-End key bindings appear broken as well in this version.

--- Additional comment from jnovy on 2009-12-29 05:47:23 EST ---

Yes, upstream likely decided to remap these keys to Ctrl-Home and Ctrl-End for jumping to the beginning and end of the file. Ctrl-PgUp and Ctrl-PgDn for cursor movement to the top and bottom of the screen. I have no further references so maybe it is good idea to ask upstream directly.

--- Additional comment from jnovy on 2009-12-29 05:48:46 EST ---

Slava, do you have any idea what happenned?

--- Additional comment from slavazanko on 2009-12-29 07:08:35 EST ---

> Slava, do you have any idea what happenned?

Yep, have idea.

In /etc/mc/mc.keymap file change next parameters:

-EditBeginningOfText = ctrl-home; alt-lt
-EditEndOfText = ctrl-end; alt-gt
+EditBeginningOfText = ctrl-pgup; alt-lt
+EditEndOfText = ctrl-pgdn; alt-gt
EditScrollUp = ctrl-up
EditScrollDown = ctrl-down
-EditBeginPage = ctrl-pgup
-EditEndPage = ctrl-pgdn
+EditBeginPage = ctrl-home
+EditEndPage = ctrl-end

Why it happens... hm... IMHO action 'go to EndOfFile' by pressing 'CTRL+END' have more sence (rather than pressing 'CTRL+PGDN'). But now anyone feel free to change default hotkeys... and anyone feel free to create new ticket with attached mc.keymap.<name> file. Maintainers of distros may change defaults (keymap, skin) too (for distro-specific features ;) ).

--- Additional comment from jnovy on 2009-12-29 10:34:04 EST ---

Thanks for explanation and workaround :)

--- Additional comment from srainwater on 2009-12-29 11:39:36 EST ---

Thanks for the feedback but I think my initial description of the problem may not have been clear, let me try again. 

In this new version of MC, NEITHER ctrl-home NOR ctrl-pgup will take me to the top of the file. Likewise, NEITHER ctrl-end NOR ctrl-pgdn will take me to the bottom of the file. 

I've examined my mc.keymap file and it contains this:

EditBeginningOfText = ctrl-home; alt-lt
EditEndofText = ctrl-end; alt-gt

There is also another file called mc.keymap.default that is identical. Both files are dated Dec 22.

I have never edited this file manually, so I presume these are the defaults. But with this new version of MC, hitting ctrl-home DOES NOT move my cursor to the beginning of the file and hitting ctrl-end DOES NOT move my cursor to the end of the file. Hopefully that's clearer.

I don't really care what key combo works, just so there are combos that I can use to quickly get to the top or bottom of a file.

--- Additional comment from jnovy on 2009-12-29 14:38:58 EST ---

Does this mc help?

http://koji.fedoraproject.org/koji/taskinfo?taskID=1894649

--- Additional comment from srainwater on 2009-12-29 15:19:41 EST ---

No, that version exhibits the same problem.

I have another box still running Fedora 11 and this version of mc:
mc-4.6.2-10.fc11.i586

Here's how the editor behaves on that box:

ctrl-pgdn = go to bottom of file being edited
ctrl-pgup = go to top of file being edited

ctrl-home = go to first character of current line
ctrl-end = go to last character of current line


On F12 with the new mc-4.7.0-0.6.pre4.20091221git.fc12.x86_64 (the current version) and mc-4.7.0-1.fc12.x86_64 (the one you reference above) I'm seeing this behavior:

ctrl-pgdn = go to last line of terminal window (not bottom of file)
ctrl-pgup = go to first line of terminal window (not top of file)

ctrl-home = go to first character of current line
ctrl-end = go to last character of current line

ctrl-home and ctrl-end do appear to actually work as they did in the F11 version. The problem seems limited to ctrl-pgup and ctrl-pgdn.

So it looks to me like ctrl-pgup and ctrl-pgdn are now effectively duplicates of pgup and pgdn (in one case moving the cursor one page while holding the line count the same and in the other shifting the line count by one page while holding the cursor in the same place). 

But the change still removes (as far as I can tell) the key combinations that will take me instantly to the top or bottom of the file being edited as ctrl-pgup and ctrl-pgdn used to. This is functionality that most editors have an MC has had for as long as I have used it. I'd hate to see MC lose this! Has the ctrl-pgup / ctrl-pgdn functionality been moved to some other key combination that I'm missing?

--- Additional comment from srainwater on 2009-12-30 15:58:22 EST ---

Has anyone figured out a work around that will bring back the ctrl-pgup / ctrl-pgdn functionality? As far as I can tell, none of the new mc.keymap options even allow for a key combo to move the the cursor to the top or bottom of the file.

The removal of this function is making me crazy. Trying to get to the top or bottom of a multi-thousand line file used to take a fraction of a second - now I have to hold down the arrow or pgdn keys for as much as a minute to get there. :(

I think it should be relatively easy to fix this bug because the underlying code for doing a top of file or bottom of file move is still there. You can trigger it by manually going through a sequence of menu selections:

1. F9 to bring up the menu
2. E to open the Edit menu
3. Select:
B for beginning of file
E for end of file

Interestingly, the menu shows the key combos at ctrl-home for beginning of file and ctrl-end for bottom of file. As noted above though, these key combos were repurposed some time ago to move the cursor to the beginning or end of the line. Ctrl-pgup / ctrl-pgdn took over moving to the top or bottom of the file. It appears ctrl-pgup / ctrl-pgdn have now been repurposed to duplicate pgup and pgdn and no new key combos were created to replace the old top/bottom of file functionality. 

But the fact that the menu still performs the appropriate action demonstrates that the underlying code is still present in the editor. So we just need to fix the ctrl-pgup / ctrl-pgdn key combos to work again or find a way to add new key combos for the function.

--- Additional comment from srainwater on 2010-01-05 12:18:37 EST ---

Yum update installed a new version of mc today:

 mc-4.7.0.1-1.fc12.x86_64

This bug is still present in the new version. All previously working keyboard shortcuts for reaching top of file and bottom of file are still broken.

--- Additional comment from srainwater on 2010-01-05 19:06:22 EST ---

Found the problem. Here's what caused it:

1. GNOME terminal outputs escape sequences that MC doesn't understand for ctrl-home and ctrl-end. $TERM reports xterm but GNOME terminal apparently doesn't output the same escape sequences as xterm for these key combos.

2. MC switched the key bindings so top of file uses ctrl-home and bottom of file uses ctrl-end

3. Because of the GNOME terminal / MC miscommunication, functions using the bad key combos stopped working.

So I think this bug should be changed to either a GNOME terminal bug or, if GNOME terminal key sequences can't be fixed, then maybe an fedora packaging bug so at least MC will continue to work as delivered without the user needing to remap the key sequences first.

--- Additional comment from jnovy on 2010-01-06 02:25:58 EST ---

Good catch. I'm using xterm so I haven't noticed anything wrong and everything worked for me as expected. Agreed that it is a gnome-terminal bug. Reassigning.

--- Additional comment from srainwater on 2010-01-06 11:27:29 EST ---

Great! Is there a web page or mailing list related to GNOME terminal development? I'm having trouble finding anything.

--- Additional comment from srainwater on 2010-01-08 11:42:26 EST ---

Hmmm... I've had no luck finding any sort of development mailing list or website for GNOME terminal. Is it even actively developed or maintained any more? Is there anyone at Redhat who maintains the packaging of GNOME terminal for Fedora? I'm really baffled as to how to follow up on this bug to get it fixed. I use MC heavily in my daily work and this bug makes it virtually unusable for editing large files. The root cause of the bug seems to be the faulty esc sequences emitted by GNOME terminal but I'm not sure how to get that fixed. Even if I could code up a patch myself, I don't see any place to submit it. Any clues?

--- Additional comment from slavazanko on 2010-01-11 03:25:12 EST ---

I run gnome-terminal and see into "help"->"about" menu item:

Guilherme de S. Pastore gpastore (maintainer)
Havoc Pennington hp
Mariano Suárez-Alvarez mariano

I think, gnome-terminal don't have dedicated maillist, need to use http://mail.gnome.org/mailman/listinfo/gnome-infrastructure

Also, I found same component into Gnome bugzilla: https://bugzilla.gnome.org/buglist.cgi?query_format=specific&order=relevance+desc&bug_status=__open__&product=gnome-terminal&content=

I hope, this info will help to you...

--- Additional comment from behdad on 2010-02-26 00:38:15 EST ---

Feel free to file a bug upstream at bugzilla.gnome.org, product vte.  That's where the development for the emulation side of gnome-terminal happens.

--- Additional comment from triage.org on 2010-11-03 22:21:00 EDT ---


This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

--- Additional comment from srainwater on 2010-11-04 12:31:28 EDT ---

This bug still exists in Fedora 14. As provided, the editor in the mc package in F14 has no way of reaching top of file or end of file by any key combination. Neither Ctrl-PgUp nor Ctrl-Home takes you to top of file. Neither Ctrl-PgDn nor Ctrl-End takes you to end of file. I assume this means the underlying problem in the GNOME terminal key bindings still has not been fixed and the key binding changes in MC have not been reverted to use the key combos they used prior to F12 which worked fine.

--- Additional comment from srainwater on 2012-03-06 16:07:38 EST ---

This bug still exists in Fedora 16. As provided, the editor in the mc package
in F16 has no way of reaching top of file or end of file by any key
combination. Neither Ctrl-PgUp nor Ctrl-Home takes you to top of file. Neither
Ctrl-PgDn nor Ctrl-End takes you to end of file. I don't care if it's the fault of MC or GNOME terminal but one of the two needs to be fixed so they play nice together again.

--- Additional comment from endoflife on 2012-08-16 13:16:20 EDT ---

This message is a notice that Fedora 14 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 14. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained.  At this time, all open bugs with a Fedora 'version'
of '14' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this 
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen 
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we were unable to fix it before Fedora 14 reached end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" (top right of this page) and open it against that 
version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

--- Additional comment from srainwater on 2012-08-16 14:01:35 EDT ---

This bug still exists in Fedora 17.

Comment 1 Steevithak 2013-01-17 23:06:08 UTC
This bug still exists in Fedora 18.

Comment 2 Fedora End Of Life 2013-12-21 08:41:18 UTC
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2014-02-05 12:04:23 UTC
Fedora 18 changed to end-of-life (EOL) status on 2014-01-14. Fedora 18 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 4 Steevithak 2014-02-05 16:52:14 UTC
This bug still exists in Fedora 19.

Comment 5 Egmont Koblinger 2014-08-15 23:49:51 UTC
In Rawhide (to become Fedora 21), gnome-terminal was modified to emit the correct escape sequences.  (Caveat: Ctrl+PgUp/Dn are bound to Prev/Next Terminal by default, you need to modify these shortcuts in Edit->Preferences first).

mcedit's default binding is to move the cursor to the top/bottom of the current viewport, can be tailored in mc.keymap to anyone's favorites.