Bug 59256 - Konsole does not supprt selecting text with shift + arrow keys in mcedit
Summary: Konsole does not supprt selecting text with shift + arrow keys in mcedit
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources All
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 118257 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-06-02 16:34 UTC by Tobias Koenig
Modified: 2012-04-26 12:36 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.3


Attachments
Restores configurable window scroll from keyboard. (4.85 KB, patch)
2008-10-23 03:16 UTC, Dmitry Prokoptsev
Details
Restores configurable window scroll from keyboard. (4.85 KB, patch)
2008-10-23 03:16 UTC, Dmitry Prokoptsev
Details
Restores configurable window scroll from keyboard. (4.24 KB, patch)
2009-03-16 00:06 UTC, Kurt Hindenburg
Details
Rebased patch against current GIT (4.40 KB, patch)
2011-02-13 22:13 UTC, Vitaliy Margolen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Koenig 2003-06-02 16:34:13 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

Hi,

in mcedit, the editor of midnight commander, you can use shift + arrow keys to
start a selection. However, it seems that konsole does not forward this key codes
to mc, so selecting text isn't possible...
I know the same shortcuts are already used for switching between the single consoles,
but it would be quite cool, if we could find a solution for this problem.

Ciao,
Tobias
Comment 1 Dominik Stadler 2003-06-02 21:39:22 UTC
You can assign different keys to the actions in nearly every KDE-Application (BTW one 
of my favourite feature at all about KDE, I can really choose the hotkeys everywhere). I 
think that should solve your problem. 
 
Go to "Settings" - "Configure shortcuts" and search for the entry for "next session" and 
"previous session". 
Comment 2 Tobias Koenig 2003-06-02 22:53:13 UTC
Subject: Re:  selection with shift + arrow keys in midnight commander

On Mon, Jun 02, 2003 at 07:39:24PM -0000, Dominik Stadler wrote:
Hi Dominik,

> You can assign different keys to the actions in nearly every
> KDE-Application (BTW one of my favourite feature at all about
> KDE, I can really choose the hotkeys everywhere). I 
> think that should solve your problem. 
Yeah, I'm aware of this feature. Nevertheless, the Shift+Arrow
key codes aren't forwarded to mc, so I can't select text in
mcedit or any other editor, which uses this functionality.

Ciao,
Tobias
Comment 3 Gary Cramblitt 2003-10-02 06:03:48 UTC
The problem is that konsole is using the shifted arrow keys for other functions.
 For example, <Shift-Up> and <Shift-Down> are used to scroll the konsole
history.  <Shift-Right> and <Shift-Left> are used to switch sessions.  To solve
this problem, do the following:

1.  Go to KDE Control Center | Keyboard Shortcuts and make sure these keys are
not assigned as shortcuts.

2.  Copy /usr/share/apps/konsole/default.Keytab to
~/.kde/share/apps/konsole/mytab.keytab

3.  Edit mytab.keytab.  Change the "Keyboard" line to something like

keyboard "XTerm (mytab)"

Add the following lines below the cursor keys section.

# shifted cursor keys
key Up    +Shift   : "\EO2A"
key Down  +Shift   : "\EO2B"
key Right +Shift   : "\EO2C"
key Left  +Shift   : "\EO2D"

Comment out (add #) the following two lines.

# key Up    +Shift   : scrollLineUp
# key Down  +Shift   : scrollLineDown

4.  Close and restart konsole.  In konsole menu, choose "Settings | Keyboard |
XTerm (mytab)".

You should now be able to select using arrow keys in Midnight Commander.

Note that you cannot scroll up/down one line at a time in konsole history
anymore, but <Shift-PgUp> and <Shift-PgDn> still work.

This fix also allows shifted selection in non-GUI vim and non-GUI emacs.  You
may have to do some mappings in the .vimrc or .emacs files to get it working.

Note that the above fixes work on my RedHat 9 KDE 3.1 system.  Your mileage may
vary.

Developers, an enhancement to konsole is needed that would permit Shift arrows
to change sessions and scroll history, but still send escape sequences when a
full-screen curses app (such as MC, non-GUI vim, non-GUI emacs) is running.  The
current design of the keytab files does not permit this.  Something like

# shifted cursor keys
key Up    +Shift   : "\EO2A"
key Down  +Shift   : "\EO2B"
key Right +Shift   : "\EO2C"
key Left  +Shift   : "\EO2D"
scrollLineUp       : Up    +Shift
scrollLineDown     : Down  +Shift

would allow the shifted Up/Down keys to work in two different modes. 
Determining which mode is the problem, of course.  Perhaps a custom terminal
initialization escape sequence?

Gary Cramblitt
Comment 4 Daniël Mantione 2006-01-31 11:17:45 UTC
One vote for this, the shift arrow keys should be available in text mode applications to select text. I'm developer of Free Pascal and I'm getting complaints that it is impossible to select text in the Integrated Development Environment (even though, just like Midnight Commander, there exists a workaround). I also want an option for shift+ins to give an escape code.
Comment 5 esigra 2006-02-15 11:18:29 UTC
Yes, I also want Shift+Arrowkey selection in Konsole (not just in embedded editors). And I want to get rid of the Shift+Left/Right switching. It is confusing for KDevelop users who are used to Alt+Left/Right. So I suggest this default configuration:
Alt+Left/Right: switching
Alt+Up/Down/PageUp/PageDown: scrolling
Shift+Left/Right/Up/Down/PageUp/PageDown: selecting

And I want the Alt shortcuts to also work with AltGr so that I can switch between consoles with one hand (sorry but Alt is just too far away from the arrow keys for my hands).
Comment 6 FiNeX 2007-12-11 20:31:19 UTC
*** Bug 118257 has been marked as a duplicate of this bug. ***
Comment 7 Dmitry Prokoptsev 2008-10-23 03:10:12 UTC
The reason is that Shift+Arrows are hardcoded to scroll Konsole buffer since r666607.

I've made a patch which makes Konsole respect settings in its keymap, but keeps ability to scroll different windows within a session independently.
Comment 8 Dmitry Prokoptsev 2008-10-23 03:16:25 UTC
Created attachment 28071 [details]
Restores configurable window scroll from keyboard.
Comment 9 Dmitry Prokoptsev 2008-10-23 03:16:27 UTC
Created attachment 28072 [details]
Restores configurable window scroll from keyboard.
Comment 10 Kurt Hindenburg 2009-03-16 00:06:08 UTC
Created attachment 32159 [details]
Restores configurable window scroll from keyboard.

The same patch as above but it applies to trunk cleanly.

I need someway to test this easily.
Comment 11 Vitaliy Margolen 2009-11-18 03:55:18 UTC
Kde 4 4.3.1 (SuSE 11.2) and the bug is back again. Would someone actually commit this fix?
Comment 12 Sergei Ivanov 2010-06-14 21:08:42 UTC
I confirm that the patch from #10 works on Kubuntu 10.04 (KDE 4.4.2), provided that the following lines are added to the keytab:

key Up    +Shift   : "\EO2A"
key Down  +Shift   : "\EO2B"
key Right +Shift   : "\EO2C"
key Left  +Shift   : "\EO2D"

I added them before the "# Function keys" line. And, of course, reassigned the tab switching shortcuts in Menu->Settings->Configure Shortcuts.
Comment 13 Vitaliy Margolen 2010-07-15 07:06:56 UTC
KDE 4.4.4-1.2 and this bug is still not fixed.
Comment 14 Kevin Kofler 2011-02-13 21:58:02 UTC
Ping? What's the status of this patch?

Is it the very idea of the patch which is the problem? Then you should be aware that if you drop the default.keymap changes, the patch should not break the existing behavior, yet allow reconfiguring the keys correctly (which doesn't work without the patch because there's code checking for shift+arrows explicitly). So I don't think that principle of the patch without the default.keymap is objectionable, is it?

Is it the implementation of the patch which is faulty? Then how can it be done better?

Or did you just not have time to look at it?

We were asked to apply this patch in Fedora, and I'd really like to know your (upstream's) position before even considering doing that.
Comment 15 Vitaliy Margolen 2011-02-13 22:13:25 UTC
Created attachment 57229 [details]
Rebased patch against current GIT

BTW, this is not a wishlist, it's a bug. And platform is not Linux, but all, since it's a code bug that applies to everything.

Anyone can reset those fields accordingly?

Patch works fine but it really does need to be included into KDE. What's a holdup with that anyway? How many years you need to fix bugs?

This is a regression and broken by this commit:
commit 8a81e29f8f9cb1950cac3fd036e02ddd364e0cba
Author: Robert Knight <robertknight@gmail.com>
Date:   Sun May 20 12:15:10 2007 +0000

    Reimplement scrolling the display up and down using the keyboard.  This is now done in the display rather than the emulation, which allows displays on the same session to be scrolled independantly, but doesn't respect the scroll commands defined in the key bindings file.
    
    svn path=/trunk/KDE/kdebase/apps/konsole/; revision=666607
Comment 16 Kevin Kofler 2011-02-13 22:32:03 UTC
> Anyone can reset those fields accordingly?

Done.

And from the commit message:
> but doesn't respect the scroll commands defined in the key bindings file.
… so you KNOW you break something and you commit it anyway? Huh?
Comment 17 Robert Knight 2011-02-14 00:38:09 UTC
> Ping? What's the status of this patch?

Nobody has been actively working on Konsole these past 3-4 years as far as I know.  If you want to get patches reviewed, fixed up and merged you can either do it yourself or appeal for assistance from developers working on other areas of KDE (eg. via a mail to kde-devel).

From a brief glance at the patch, I think that the Vt102Emulation::sendKeyEvent() implementation is not the right approach - the code assumes that it is part of a slot which has been invoked from a signal of an object which itself has a particular set of signals.  That is liable to accidentally break if someone modifies the surrounding code or the context from which it is called in future.
Comment 18 Jekyll Wu 2011-10-07 13:09:16 UTC
I didn't invesitage this problem in depth, but with konsole-2.7.2 the only needed fix is adding those 4 lines from comment #10 into default.keytab and reassigning the predefined shortcuts.

Could someone who suffers from this problem confirm above statement?
Comment 19 Jekyll Wu 2012-04-26 12:35:10 UTC
Git commit ad4314c769dda0ce0bca6741b6bff4f4c9e18a61 by Jekyll Wu.
Committed on 26/04/2012 at 08:32.
Pushed by jekyllwu into branch 'master'.

Allow Shift+Arrow to be passed into to applications like mc and vim

Note: action shortcuts take precedence of keybindings. So to use
Shift+Arrow in mc/vim, make sure they are not set as action shortcuts.
Related: bug 204388
FIXED-IN: 4.8.3

M  +5    -0    data/keyboard-layouts/default.keytab

http://commits.kde.org/konsole/ad4314c769dda0ce0bca6741b6bff4f4c9e18a61
Comment 20 Jekyll Wu 2012-04-26 12:36:41 UTC
Git commit b74cc7f2446cdd709ec293505f55360e0fabc7b5 by Jekyll Wu.
Committed on 26/04/2012 at 08:32.
Pushed by jekyllwu into branch 'KDE/4.8'.

Allow Shift+Arrow to be passed into to applications like mc and vim

Note: action shortcuts take precedence of keybindings. So to use
Shift+Arrow in mc/vim, make sure they are not set as action shortcuts.
Related: bug 204388
FIXED-IN: 4.8.3
(cherry picked from commit ad4314c769dda0ce0bca6741b6bff4f4c9e18a61)

M  +5    -0    data/keyboard-layouts/default.keytab

http://commits.kde.org/konsole/b74cc7f2446cdd709ec293505f55360e0fabc7b5