Bug 76976

Summary: AppScreen support in konsole keytab
Product: [Applications] konsole Reporter: Don Mahurin <dmahurin>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Don Mahurin 2004-03-08 00:45:20 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:          Linux

This patch adds AppScreen support to keytab, so you can have bindings that are different depending on whether you are in a curses editor or not.
Sample use:

key Prior +Shift +AppScreen : "\E[5$"
key Next +Shift +AppScreen: "\E[6$"

key Prior +Shift -AppScreen  : scrollPageUp
key Down  +Shift  -AppScreen : scrollLineDown

Where do I attach the patch?

Index: konsole/konsole/TEmuVt102.cpp
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/TEmuVt102.cpp,v
retrieving revision 1.107
diff -u -3 -p -r1.107 TEmuVt102.cpp
--- konsole/konsole/TEmuVt102.cpp       3 Nov 2003 08:27:30 -0000       1.107
+++ konsole/konsole/TEmuVt102.cpp       5 Mar 2004 21:41:51 -0000
@@ -895,6 +895,7 @@ void TEmuVt102::onKeyPress( QKeyEvent* e
   if (keytrans->findEntry(ev->key(), encodeMode(MODE_NewLine  , BITS_NewLine   ) + // OLD,
                                      encodeMode(MODE_Ansi     , BITS_Ansi      ) + // OBSOLETE,
                                      encodeMode(MODE_AppCuKeys, BITS_AppCuKeys ) + // VT100 stuff
+                                     encodeMode(MODE_AppScreen, BITS_AppScreen ) + // VT100 stuff
                                      encodeStat(ControlButton , BITS_Control   ) +
                                      encodeStat(ShiftButton   , BITS_Shift     ) +
                                      encodeStat(AltButton     , BITS_Alt       ),
Index: konsole/konsole/keytrans.cpp
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/keytrans.cpp,v
retrieving revision 1.46
diff -u -3 -p -r1.46 keytrans.cpp
--- konsole/konsole/keytrans.cpp        26 Jul 2003 10:41:25 -0000      1.46
+++ konsole/konsole/keytrans.cpp        5 Mar 2004 21:41:51 -0000
@@ -483,6 +483,7 @@ void KeyTransSymbols::defModSyms()
   defModSym("Ansi",       BITS_Ansi         );
   defModSym("NewLine",    BITS_NewLine      );
   defModSym("AppCuKeys",  BITS_AppCuKeys    );
+  defModSym("AppScreen",  BITS_AppScreen    );
 }

 void KeyTransSymbols::defKeySyms()
Index: konsole/konsole/keytrans.h
===================================================================
RCS file: /home/kde/kdebase/konsole/konsole/keytrans.h,v
retrieving revision 1.22
diff -u -3 -p -r1.22 keytrans.h
--- konsole/konsole/keytrans.h  16 Feb 2003 23:27:46 -0000      1.22
+++ konsole/konsole/keytrans.h  5 Mar 2004 21:41:51 -0000
@@ -25,6 +25,7 @@
 #define BITS_Shift      5
 #define BITS_Alt        6
 #define BITS_COUNT      7
+#define BITS_AppScreen  8

 #define CMD_none          -1
 #define CMD_send           0
Comment 1 Don Mahurin 2004-07-27 01:28:12 UTC
Please apply this simple yet needed patch.

It allows definitions like Alt or Shift-Arrows to depend on whether in app-screen-mode (vi/other editor) or not.
example1: Shift-Arrow scrolls back in Konsole, but it app mode, it is sent to application (highlight in fte).
example2: Alt-E means Konsole-Edit menu, but in App-Mode it is sent to application (menus). 
Comment 2 Don Mahurin 2004-08-24 19:33:33 UTC
From: Lars Doelle <lars.doelle@on-line.de>

Don, your patch is fine and a good idea, too, i think.
I'd vote to apply the patch.

-lars

Comment 3 Waldo Bastian 2004-09-22 22:02:23 UTC
CVS commit by waba: 

Add AppScreen support to keytab (BR76976)
Patch by Don Mahurin
CCMAIL: 76976-done@bugs.kde.org


  M +1 -0      TEmuVt102.cpp   1.112
  M +1 -0      keytrans.cpp   1.48
  M +2 -1      keytrans.h   1.23


--- kdebase/konsole/konsole/TEmuVt102.cpp  #1.111:1.112
@@ -909,4 +909,5 @@ void TEmuVt102::onKeyPress( QKeyEvent* e
                                      encodeMode(MODE_Ansi     , BITS_Ansi      ) + // OBSOLETE,
                                      encodeMode(MODE_AppCuKeys, BITS_AppCuKeys ) + // VT100 stuff
+                                     encodeMode(MODE_AppScreen, BITS_AppScreen ) + // VT100 stuff
                                      encodeStat(ControlButton , BITS_Control   ) +
                                      encodeStat(ShiftButton   , BITS_Shift     ) +

--- kdebase/konsole/konsole/keytrans.cpp  #1.47:1.48
@@ -483,4 +483,5 @@ void KeyTransSymbols::defModSyms()
   defModSym("NewLine",    BITS_NewLine      );
   defModSym("AppCuKeys",  BITS_AppCuKeys    );
+  defModSym("AppScreen",  BITS_AppScreen    );
 }
 

--- kdebase/konsole/konsole/keytrans.h  #1.22:1.23
@@ -25,5 +25,6 @@
 #define BITS_Shift      5
 #define BITS_Alt        6
-#define BITS_COUNT      7
+#define BITS_AppScreen  7
+#define BITS_COUNT      8
 
 #define CMD_none          -1


Comment 4 Waldo Bastian 2004-09-22 22:05:45 UTC
I have applied it, should it be used by the default keytab as well?
Comment 5 Don Mahurin 2004-09-22 23:09:27 UTC
Yes, it makes sense to use it in the default keytab for shift 
application key support.
Attached is patch that I quickly created to support keys needed for 
shift selection:  shift-up,down,left,right,ins,del,pgup,pgdn (when in 
AppScreen mode).

Thanks,

-don

Waldo Bastian wrote:

>------- Additional Comments From bastian kde org  2004-09-22 22:05 -------
>I have applied it, should it be used by the default keytab as well?
>  
>

--- konsole/konsole/default.keytab.h	2004-07-26 15:23:02.000000000 -0700
+++ konsole/konsole/default.keytab.h	2004-09-22 14:09:31.738553760 -0700
@@ -21,6 +21,10 @@
   "key Down -Shift+Ansi-AppCuKeys : \"\\E[B\"\n"
   "key Right-Shift+Ansi-AppCuKeys : \"\\E[C\"\n"
   "key Left -Shift+Ansi-AppCuKeys : \"\\E[D\"\n"
+  "key Up    +Shift+AppScreen   : \"\\E[a\"\n"
+  "key Down  +Shift+AppScreen   : \"\\E[b\"\n"
+  "key Right +Shift+AppScreen   : \"\\E[c\"\n"
+  "key Left  +Shift+AppScreen   : \"\\E[d\"\n"
   "key Enter+NewLine : \"\\r\\n\"\n"
   "key Enter-NewLine : \"\\r\"\n"
   "key Home  -Shift-AppCuKeys : \"\\E[H\"  \n"
@@ -35,7 +39,10 @@
   "key Delete-Shift : \"\\E[3~\"  \n"
   "key Prior -Shift : \"\\E[5~\"  \n"
   "key Next  -Shift : \"\\E[6~\"  \n"
+  "key Insert+Shift : \"\\E[2;2~\"  \n"
   "key Delete+Shift : \"\\E[3;2~\"  \n"
+  "key Prior+Shift+AppScreen : \"\\E[5;2\"\n"
+  "key Next+Shift+AppScreen  : \"\\E[6;2\"\n"
   "key F1    -Shift   : \"\\EOP\"\n"
   "key F2    -Shift   : \"\\EOQ\"\n"
   "key F3    -Shift   : \"\\EOR\"\n"
@@ -61,9 +68,9 @@
   "key F11+Shift    : \"\\E[23;2~\"\n"
   "key F12+Shift    : \"\\E[24;2~\"\n"
   "key Space +Control : \"\\x00\"\n"
-  "key Up    +Shift   : scrollLineUp\n"
-  "key Prior +Shift   : scrollPageUp\n"
-  "key Down  +Shift   : scrollLineDown\n"
-  "key Next  +Shift   : scrollPageDown\n"
+  "key Up    +Shift-AppScreen   : scrollLineUp\n"
+  "key Prior +Shift-AppScreen   : scrollPageUp\n"
+  "key Down  +Shift-AppScreen   : scrollLineDown\n"
+  "key Next  +Shift-AppScreen   : scrollPageDown\n"
   "key ScrollLock     : scrollLock\n"
   ""
Comment 6 Lars Doelle 2004-09-23 21:00:25 UTC
>------- Additional Comments From bastian kde org  2004-09-22 22:05 ------- 
>I have applied it, should it be used by the default keytab as well? 

I think, yes, as the modification does not break normal operation and the new 
feature should be available under normal operation

> --- konsole/konsole/default.keytab.h 2004-07-26 15:23:02.000000000 -0700 

Changing the default keytab is slightly different procedure, though, as the 
original source is:

   konsole/other/default.Keytab

when change, the default.keytab.h is to be build using:

   $ cd konsole/konsole
   $ ./MakeDefaults

One might need to

   $ cd konsole/tests
   $ make quote

before.

This should end in your patch as well as in a changed default.Keytab, which is 
also a reference for the poor people who wonder how keys are interpreted.

I've never included this build process into the regular Makefiles, as this 
operation is very rare.

-lars