View Issue Details

IDProjectCategoryView StatusLast Update
0034751FPCTextmode IDEpublic2018-12-22 16:17
ReporterMarģersAssigned ToMarco van de Voort 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Platformamd64OSlinuxOS Version
Product Version3.0.4Product Build 
Target VersionFixed in Version3.3.1 
Summary0034751: [patch] Ctrl+Shift+arrowKeys emits escape code sequences
DescriptionCtrl+Shift+Right supposed to select word next to cursor, but instead writes escape sequence: 1;66D

Provided patch solves issue. As well Ctrl+PgUp and Ctrl+PgUp in xTerm.
In xfce4-terminal functional are only Ctrl+Shift+Right, Ctrl+Shift+Left.
TagsNo tags attached.
Fixed in Revision40611
FPCOldBugId
FPCTarget
Attached Files
  • keyCtrlShiftArrow.patch (3,575 bytes)
    Index: packages/rtl-console/src/unix/keyboard.pp
    ===================================================================
    --- packages/rtl-console/src/unix/keyboard.pp	(revision 40601)
    +++ packages/rtl-console/src/unix/keyboard.pp	(working copy)
    @@ -96,6 +96,12 @@
           KbShiftDown  = $f3;
           KbShiftHome  = $f4;
           KbShiftEnd   = $f5;
    +      KbCtrlShiftUp    = $f6;
    +      KbCtrlShiftDown  = $f7;
    +      KbCtrlShiftRight = $f8;
    +      KbCtrlShiftLeft  = $f9;
    +      KbCtrlShiftHome  = $fa;
    +      KbCtrlShiftEnd   = $fb;
     
           double_esc_hack_enabled : boolean = false;
     
    @@ -494,7 +500,7 @@
         MouseEvent.buttons := 0;
         PutMouseEvent(MouseEvent);
       end;
    -  
    +
       procedure GenMouseEvent;
       var MouseEvent: TMouseEvent;
           ch : char;
    @@ -869,7 +875,7 @@
             st:string[7];
           end;
     
    -const key_sequences:array[0..289] of key_sequence=(
    +const key_sequences:array[0..297] of key_sequence=(
            (char:0;scan:kbAltA;st:#27'A'),
            (char:0;scan:kbAltA;st:#27'a'),
            (char:0;scan:kbAltB;st:#27'B'),
    @@ -1136,6 +1142,15 @@
            (char:0;scan:kbShiftHome;st:#27'[1;2H'),  {xterm}
            (char:0;scan:kbShiftHome;st:#27'[7$'),    {rxvt}
     
    +       (char:0;scan:KbCtrlShiftUp;st:#27'[1;6A'),    {xterm}
    +       (char:0;scan:KbCtrlShiftDown;st:#27'[1;6B'),  {xterm}
    +       (char:0;scan:KbCtrlShiftRight;st:#27'[1;6C'), {xterm, xfce4}
    +       (char:0;scan:KbCtrlShiftLeft;st:#27'[1;6D'),  {xterm, xfce4}
    +       (char:0;scan:KbCtrlShiftHome;st:#27'[1;6H'),  {xterm}
    +       (char:0;scan:KbCtrlShiftEnd;st:#27'[1;6F'),   {xterm}
    +
    +       (char:0;scan:kbCtrlPgDn;st:#27'[6;5~'),   {xterm}
    +       (char:0;scan:kbCtrlPgUp;st:#27'[5;5~'),   {xterm}
            (char:0;scan:kbCtrlUp;st:#27'[1;5A'),     {xterm}
            (char:0;scan:kbCtrlDown;st:#27'[1;5B'),   {xterm}
            (char:0;scan:kbCtrlRight;st:#27'[1;5C'),  {xterm}
    @@ -1304,7 +1319,7 @@
                   {This is the same hack as in findsequence; see findsequence for
                    explanation.}
                   ch:=ttyrecvchar;
    -              {Alt+O cannot be used in this situation, it can be a function key.} 
    +              {Alt+O cannot be used in this situation, it can be a function key.}
                   if not(ch in ['a'..'z','A'..'N','P'..'Z','0'..'9','-','+','_','=']) then
                     begin
                       if intail=0 then
    @@ -1361,11 +1376,11 @@
             end
           else
             RestoreArray;
    -   end
    +   end;
     {$ifdef logging}
            writeln(f);
     {$endif logging}
    -    ;
    +
       ReadKey:=PopKey;
     End;
     
    @@ -1541,6 +1556,8 @@
         kbAltDown,kbAltPgDn,kbAltIns,kbAltDel);
       ShiftArrow : array [kbShiftUp..kbShiftEnd] of byte =
        (kbUp,kbLeft,kbRight,kbDown,kbHome,kbEnd);
    +  CtrlShiftArrow : array [kbCtrlShiftUp..kbCtrlShiftEnd] of byte =
    +   (kbCtrlUp,kbCtrlDown,kbCtrlRight,kbCtrlLeft,kbCtrlHome,kbCtrlEnd);
     
     var
       MyScan:byte;
    @@ -1601,10 +1618,17 @@
                 kbF11..KbF12 : { sF11-sF12 }
                   MyScan:=MyScan+kbShiftF11-kbF11;
               end;
    -        if myscan in [kbShiftUp..kbShiftEnd] then
    +        if myscan in [kbShiftUp..kbCtrlShiftEnd] then
               begin
    -            myscan:=ShiftArrow[myscan];
    -            sstate:=sstate or kbshift;
    +            if myscan <= kbShiftEnd then
    +            begin
    +               myscan:=ShiftArrow[myscan];
    +               sstate:=sstate or kbshift;
    +            end else
    +            begin
    +               myscan:=CtrlShiftArrow[myscan];
    +               sstate:=sstate or kbshift or kbCtrl;
    +            end;
               end;
             if myscan=kbAltBack then
               sstate:=sstate or kbalt;
    
    keyCtrlShiftArrow.patch (3,575 bytes)

Activities

Marģers

2018-12-22 11:20

reporter  

keyCtrlShiftArrow.patch (3,575 bytes)
Index: packages/rtl-console/src/unix/keyboard.pp
===================================================================
--- packages/rtl-console/src/unix/keyboard.pp	(revision 40601)
+++ packages/rtl-console/src/unix/keyboard.pp	(working copy)
@@ -96,6 +96,12 @@
       KbShiftDown  = $f3;
       KbShiftHome  = $f4;
       KbShiftEnd   = $f5;
+      KbCtrlShiftUp    = $f6;
+      KbCtrlShiftDown  = $f7;
+      KbCtrlShiftRight = $f8;
+      KbCtrlShiftLeft  = $f9;
+      KbCtrlShiftHome  = $fa;
+      KbCtrlShiftEnd   = $fb;
 
       double_esc_hack_enabled : boolean = false;
 
@@ -494,7 +500,7 @@
     MouseEvent.buttons := 0;
     PutMouseEvent(MouseEvent);
   end;
-  
+
   procedure GenMouseEvent;
   var MouseEvent: TMouseEvent;
       ch : char;
@@ -869,7 +875,7 @@
         st:string[7];
       end;
 
-const key_sequences:array[0..289] of key_sequence=(
+const key_sequences:array[0..297] of key_sequence=(
        (char:0;scan:kbAltA;st:#27'A'),
        (char:0;scan:kbAltA;st:#27'a'),
        (char:0;scan:kbAltB;st:#27'B'),
@@ -1136,6 +1142,15 @@
        (char:0;scan:kbShiftHome;st:#27'[1;2H'),  {xterm}
        (char:0;scan:kbShiftHome;st:#27'[7$'),    {rxvt}
 
+       (char:0;scan:KbCtrlShiftUp;st:#27'[1;6A'),    {xterm}
+       (char:0;scan:KbCtrlShiftDown;st:#27'[1;6B'),  {xterm}
+       (char:0;scan:KbCtrlShiftRight;st:#27'[1;6C'), {xterm, xfce4}
+       (char:0;scan:KbCtrlShiftLeft;st:#27'[1;6D'),  {xterm, xfce4}
+       (char:0;scan:KbCtrlShiftHome;st:#27'[1;6H'),  {xterm}
+       (char:0;scan:KbCtrlShiftEnd;st:#27'[1;6F'),   {xterm}
+
+       (char:0;scan:kbCtrlPgDn;st:#27'[6;5~'),   {xterm}
+       (char:0;scan:kbCtrlPgUp;st:#27'[5;5~'),   {xterm}
        (char:0;scan:kbCtrlUp;st:#27'[1;5A'),     {xterm}
        (char:0;scan:kbCtrlDown;st:#27'[1;5B'),   {xterm}
        (char:0;scan:kbCtrlRight;st:#27'[1;5C'),  {xterm}
@@ -1304,7 +1319,7 @@
               {This is the same hack as in findsequence; see findsequence for
                explanation.}
               ch:=ttyrecvchar;
-              {Alt+O cannot be used in this situation, it can be a function key.} 
+              {Alt+O cannot be used in this situation, it can be a function key.}
               if not(ch in ['a'..'z','A'..'N','P'..'Z','0'..'9','-','+','_','=']) then
                 begin
                   if intail=0 then
@@ -1361,11 +1376,11 @@
         end
       else
         RestoreArray;
-   end
+   end;
 {$ifdef logging}
        writeln(f);
 {$endif logging}
-    ;
+
   ReadKey:=PopKey;
 End;
 
@@ -1541,6 +1556,8 @@
     kbAltDown,kbAltPgDn,kbAltIns,kbAltDel);
   ShiftArrow : array [kbShiftUp..kbShiftEnd] of byte =
    (kbUp,kbLeft,kbRight,kbDown,kbHome,kbEnd);
+  CtrlShiftArrow : array [kbCtrlShiftUp..kbCtrlShiftEnd] of byte =
+   (kbCtrlUp,kbCtrlDown,kbCtrlRight,kbCtrlLeft,kbCtrlHome,kbCtrlEnd);
 
 var
   MyScan:byte;
@@ -1601,10 +1618,17 @@
             kbF11..KbF12 : { sF11-sF12 }
               MyScan:=MyScan+kbShiftF11-kbF11;
           end;
-        if myscan in [kbShiftUp..kbShiftEnd] then
+        if myscan in [kbShiftUp..kbCtrlShiftEnd] then
           begin
-            myscan:=ShiftArrow[myscan];
-            sstate:=sstate or kbshift;
+            if myscan <= kbShiftEnd then
+            begin
+               myscan:=ShiftArrow[myscan];
+               sstate:=sstate or kbshift;
+            end else
+            begin
+               myscan:=CtrlShiftArrow[myscan];
+               sstate:=sstate or kbshift or kbCtrl;
+            end;
           end;
         if myscan=kbAltBack then
           sstate:=sstate or kbalt;
keyCtrlShiftArrow.patch (3,575 bytes)

Marco van de Voort

2018-12-22 15:56

manager   ~0112817

Committed, thanks. (also very good that you checked against xterm)

Marģers

2018-12-22 16:17

reporter   ~0112818

Thanks!

Issue History

Date Modified Username Field Change
2018-12-22 11:20 Marģers New Issue
2018-12-22 11:20 Marģers File Added: keyCtrlShiftArrow.patch
2018-12-22 15:56 Marco van de Voort Fixed in Revision => 40611
2018-12-22 15:56 Marco van de Voort Note Added: 0112817
2018-12-22 15:56 Marco van de Voort Status new => resolved
2018-12-22 15:56 Marco van de Voort Fixed in Version => 3.3.1
2018-12-22 15:56 Marco van de Voort Resolution open => fixed
2018-12-22 15:56 Marco van de Voort Assigned To => Marco van de Voort
2018-12-22 16:17 Marģers Note Added: 0112818
2018-12-22 16:17 Marģers Status resolved => closed