xterm.sh (3802B)
1 #!/bin/bash 2 3 function ble/cmap:xterm/CSI-CMS { 4 local Fp="$1" Ft="$2" key="$3" 5 ble-bind -k "ESC [ $Fp $Ft" "$key" 6 ble-bind -k "ESC [ $Fp ; 1 $Ft" "$key" 7 ble-bind -k "ESC [ $Fp ; 2 $Ft" "S-$key" 8 ble-bind -k "ESC [ $Fp ; 3 $Ft" "M-$key" 9 ble-bind -k "ESC [ $Fp ; 4 $Ft" "M-S-$key" 10 ble-bind -k "ESC [ $Fp ; 5 $Ft" "C-$key" 11 ble-bind -k "ESC [ $Fp ; 6 $Ft" "C-S-$key" 12 ble-bind -k "ESC [ $Fp ; 7 $Ft" "C-M-$key" 13 ble-bind -k "ESC [ $Fp ; 8 $Ft" "C-M-S-$key" 14 } 15 function ble/cmap:xterm/SS3-CMS { 16 local Ft="$1" key="$2" 17 ble-bind -k "ESC O $Ft" "$key" 18 19 # 要Check: 以下のシーケンスの出所は?? 20 ble-bind -k "ESC O 1 $Ft" "$key" 21 ble-bind -k "ESC O 2 $Ft" "S-$key" 22 ble-bind -k "ESC O 3 $Ft" "M-$key" 23 ble-bind -k "ESC O 4 $Ft" "M-S-$key" 24 ble-bind -k "ESC O 5 $Ft" "C-$key" 25 ble-bind -k "ESC O 6 $Ft" "C-S-$key" 26 ble-bind -k "ESC O 7 $Ft" "C-M-$key" 27 ble-bind -k "ESC O 8 $Ft" "C-M-S-$key" 28 } 29 30 ble-bind --csi 'A' up 31 ble-bind --csi 'B' down 32 ble-bind --csi 'C' right 33 ble-bind --csi 'D' left 34 #ble-bind --csi 'E' begin 35 ble-bind --csi 'F' end 36 ble-bind --csi 'H' home 37 ble-bind --csi 'P' f1 38 ble-bind --csi 'Q' f2 39 ble-bind --csi 'R' f3 40 ble-bind --csi 'S' f4 41 42 ble/cmap:xterm/SS3-CMS 'A' up 43 ble/cmap:xterm/SS3-CMS 'B' down 44 ble/cmap:xterm/SS3-CMS 'C' right 45 ble/cmap:xterm/SS3-CMS 'D' left 46 #ble/cmap:xterm/SS3-CMS 'E' begin 47 ble/cmap:xterm/SS3-CMS 'F' end 48 ble/cmap:xterm/SS3-CMS 'H' home 49 ble/cmap:xterm/SS3-CMS 'P' f1 50 ble/cmap:xterm/SS3-CMS 'Q' f2 51 ble/cmap:xterm/SS3-CMS 'R' f3 52 ble/cmap:xterm/SS3-CMS 'S' f4 53 ble/cmap:xterm/SS3-CMS 'j' kpmul 54 ble/cmap:xterm/SS3-CMS 'k' kpadd 55 ble/cmap:xterm/SS3-CMS 'l' kpsep 56 ble/cmap:xterm/SS3-CMS 'm' kpsub 57 ble/cmap:xterm/SS3-CMS 'o' kpdiv 58 ble/cmap:xterm/SS3-CMS 'p' kp0 59 ble/cmap:xterm/SS3-CMS 'q' kp1 60 ble/cmap:xterm/SS3-CMS 'r' kp2 61 ble/cmap:xterm/SS3-CMS 's' kp3 62 ble/cmap:xterm/SS3-CMS 't' kp4 63 ble/cmap:xterm/SS3-CMS 'u' kp5 64 ble/cmap:xterm/SS3-CMS 'v' kp6 65 ble/cmap:xterm/SS3-CMS 'w' kp7 66 ble/cmap:xterm/SS3-CMS 'x' kp8 67 ble/cmap:xterm/SS3-CMS 'y' kp9 68 69 ble-bind --csi '1~' home 70 ble-bind --csi '2~' insert 71 ble-bind --csi '3~' delete 72 ble-bind --csi '4~' end # 73 ble-bind --csi '4~' select # xterm 74 ble-bind --csi '5~' prior 75 ble-bind --csi '6~' next 76 77 ble-bind --csi '11~' f1 78 ble-bind --csi '12~' f2 79 ble-bind --csi '13~' f3 80 ble-bind --csi '14~' f4 81 ble-bind --csi '15~' f5 82 ble-bind --csi '17~' f6 83 ble-bind --csi '18~' f7 84 ble-bind --csi '19~' f8 85 ble-bind --csi '20~' f9 86 ble-bind --csi '21~' f10 87 ble-bind --csi '23~' f11 88 ble-bind --csi '24~' f12 89 ble-bind --csi '25~' f13 90 ble-bind --csi '26~' f14 91 ble-bind --csi '28~' f15 92 ble-bind --csi '29~' f16 93 ble-bind --csi '29~' print # xterm 94 ble-bind --csi '31~' f17 95 ble-bind --csi '32~' f18 96 ble-bind --csi '33~' f19 97 ble-bind --csi '34~' f20 98 ble/cmap:xterm/CSI-CMS '2 3' '$' f21 99 ble/cmap:xterm/CSI-CMS '2 4' '$' f22 100 ble/cmap:xterm/CSI-CMS '2 5' '$' f23 101 ble/cmap:xterm/CSI-CMS '2 6' '$' f24 102 103 # 104 # xterm "CSI 2 7 ; ... ; code ~" 形式は 105 # 直接 ble 内で解釈されるので登録の必要はなくなった。 106 # 参考の為に、以下にデータだけは残しておく。 107 # 108 109 # xterm27form_code2key=( 110 # [9]=TAB [13]=RET 111 # # [8]=BS [27]=ESC [32]=SP 112 113 # [33]='!' [34]='"' [35]='#' [36]='$' [37]='%' [38]='&' [39]="'" [40]='(' 114 # [41]=')' [42]='*' [43]='+' [44]=',' [45]='-' [46]=',' [47]='/' 115 116 # [48]=0 [49]=1 [50]=2 [51]=3 [52]=4 [53]=5 [54]=6 [55]=7 117 # [56]=8 [57]=9 [58]=':' [59]=';' [60]='<' [61]='=' [62]='>' [63]='?' 118 119 # [92]='\' 120 121 # # [96]='`' [97]=a [98]=b [99]=c 122 # # [100]=d [101]=e [102]=f [103]=g 123 # # [104]=h [105]=i [106]=j [107]=k 124 # # [108]=l [109]=m [110]=n [111]=o 125 # # [112]=p [113]=q [114]=r [115]=s 126 # # [116]=t [117]=u [118]=v [119]=w 127 # # [120]=x [121]=y [122]=z [123]='{' 128 # # [124]='|' [125]='}' [126]='~' 129 # )