Using qed on non-QNX terminal types

Setting Your Terminal Type

When qed is invoked, it uses terminal capabilities described in the terminfo entry for the terminal type set in the TERM environment variable. The qed editor was written specifically for the original QNX console terminal type (TERM=QNX) and the IBM PC keyboard. Depending on the console driver in use, your system may be using either ANSI based screen controls (Dev.ansi) or QNX screen controls (Dev.con). When used on an ANSI-based terminal, some key combinations may not work.

Most of the basic keycodes needed by qed are described in extra terminfo capabilities that are included in the terminfo files for the terminal components shipped with QNX; this includes Dev.ansi (terminal type qansi) and xterm (terminal type xterm). For other terminal types you may need to add capabilities to make qed function acceptably well.

The following is a table of the mappings for the terminfo capabilities used by qed:

qnxterm.h #def kbd value 16/8 terminfo name curses #def full name
K_DOWN ffa9 251 kcud1 KEY_DOWN down arrow
K_UP ffa1 241 kcuu1 KEY_UP up arrow
K_LEFT ffa4 244 kcub1 KEY_LEFT left arrow
K_RIGHT ffa6 246 kcuf1 KEY_RIGHT right arrow
K_HOME ffa0 240 khome KEY_HOME home
kbs KEY_BACKSPACE backspace
kf0 KEY_F(0) f0
K_F1 ff81 201 kf1 KEY_F(1) f1
K_F2 ff82 202 kf2 KEY_F(2) f2
K_F3 ff83 203 kf3 KEY_F(3) f3
K_F4 ff84 204 kf4 KEY_F(4) f4
K_F5 ff85 205 kf5 KEY_F(5) f5
K_F6 ff86 206 kf6 KEY_F(6) f6
K_F7 ff87 207 kf7 KEY_F(7) f7
K_F8 ff88 210 kf8 KEY_F(8) f8
K_F9 ff89 211 kf9 KEY_F(9) f9
K_F10 ff8a 212 kf10 KEY_F(10) f10
K_F11 ffae 256 kf11 KEY_F(11) f11
K_F12 ffaf 257 kf12 KEY_F(12) f12
K_SHF_F1 ff8b 213 kf13 KEY_F(13) f13
K_SHF_F2 ff8c 214 kf14 KEY_F(14) f14
K_SHF_F3 ff8d 215 kf15 KEY_F(15) f15
K_SHF_F4 ff8e 216 kf16 KEY_F(16) f16
K_SHF_F5 ff8f 217 kf17 KEY_F(17) f17
K_SHF_F6 ff90 220 kf18 KEY_F(18) f18
K_SHF_F7 ff91 221 kf19 KEY_F(19) f19
K_SHF_F8 ff92 222 kf20 KEY_F(20) f20
K_SHF_F9 ff93 223 kf21 KEY_F(21) f21
K_SHF_F10 ff94 224 kf22 KEY_F(22) f22
K_SHF_F11 ffdb 333 kf23 KEY_F(23) f23
K_SHF_F12 ffdc 334 kf24 KEY_F(24) f24
K_CTL_F1 ff95 225 kf25 KEY_F(25) f25
K_CTL_F2 ff96 226 kf26 KEY_F(26) f26
K_CTL_F3 ff97 227 kf27 KEY_F(27) f27
K_CTL_F4 ff98 230 kf28 KEY_F(28) f28
K_CTL_F5 ff99 231 kf29 KEY_F(29) f29
K_CTL_F6 ff9a 232 kf30 KEY_F(30) f30
K_CTL_F7 ff9b 233 kf31 KEY_F(31) f31
K_CTL_F8 ff9c 234 kf32 KEY_F(32) f32
K_CTL_F9 ff9d 235 kf33 KEY_F(33) f33
K_CTL_F10 ff9e 236 kf34 KEY_F(34) f34
K_CTL_F11 ffbe 276 kf35 KEY_F(35) f35
K_CTL_F12 ffbf 277 kf36 KEY_F(36) f36
K_ALT_F1 ffd1 321 kf37 KEY_F(37) f37
K_ALT_F2 ffd2 322 kf38 KEY_F(38) f38
K_ALT_F3 ffd3 323 kf39 KEY_F(39) f39
K_ALT_F4 ffd4 324 kf40 KEY_F(40) f40
K_ALT_F5 ffd5 325 kf41 KEY_F(41) f41
K_ALT_F6 ffd6 326 kf42 KEY_F(42) f42
K_ALT_F7 ffd7 327 kf43 KEY_F(43) f43
K_ALT_F8 ffd8 330 kf44 KEY_F(44) f44
K_ALT_F9 ffd9 331 kf45 KEY_F(45) f45
K_ALT_F10 ffda 332 kf46 KEY_F(46) f46
K_ALT_F11 ffce 316 kf47 KEY_F(47) f47
K_ALT_F12 ffcf 317 kf48 KEY_F(48) f48
kf49 KEY_F(49) f49
kf50 KEY_F(50) f50
kf51 KEY_F(51) f51
kf52 KEY_F(52) f52
kf53 KEY_F(53) f53
kf54 KEY_F(54) f54
kf55 KEY_F(55) f55
kf56 KEY_F(56) f56
kf57 KEY_F(57) f57
kf58 KEY_F(58) f58
kf69 KEY_F(59) f59
kf10 KEY_F(60) f60
kf61 KEY_F(61) f61
kf62 KEY_F(62) f62
kf63 KEY_F(63) f63
K_CTL_DELETE ffbc 274 kdl1 KEY_DL delete line key
K_CTL_INSERT ffbb 273 kil1 KEY_IL insert line
K_DELETE ffac 254 kdch1 KEY_DC delete character key
K_INSERT ffab 253 kich1 KEY_IC ins char/enter ins mode key
K_ALT_INSERT ffcb 313 krmir KEY_EIC rmir or smir in insert mode
K_ALT_A ffe1 341 kclr KEY_CLEAR clear screen or erase key
K_ALT_DELETE ffcc 314 ked KEY_EOS clear-to-end-of-screen key
K_ALT_END ffc8 310 kel KEY_EOL clear-to-end-of-line key
K_CTL_UP ffb1 261 kind KEY_SF scroll-forward/down key
K_CTL_DOWN ffb9 271 kri KEY_SR scroll-backward/up key
K_PGDN ffaa 252 knp KEY_NPAGE next-page key
K_PGUP ffa2 242 kpp KEY_PPAGE previous-page key
K_ALT_B ffe2 342 khts KEY_STAB set-tab key
K_CTL_TAB ff9f 237 kctab KEY_CTAB clear-tab key
K_ALT_D ffe4 344 ktbc KEY_CATAB clear-all-tabs key
K_CTL_ENTER ffd0 320 kent KEY_ENTER Enter/send (unreliable)
K_PRTSC ffad 255 kprt KEY_PRINT print or copy
kll KEY_LL home-down key
ka1 KEY_A1 Upper left of keypad
ka3 KEY_A3 Upper right of keypad
kb2 KEY_B2 Center of keypad
kc1 KEY_C1 Lower left of keypad
kc3 KEY_C3 Lower right of keypad
K_BACKTAB ff80 200 kcbt KEY_BTAB Back tab key
K_ALT_HOME ffc0 300 kbeg KEY_BEG beg(inning) key
K_KPDMINUS ffa3 243 kcan KEY_CANCEL cancel key
K_ALT_C ffe3 343 kclo KEY_CLOSE close key
K_KPDFIVE ffa5 245 kcmd KEY_COMMAND cmd (command) key
K_CTL_KPDFIVE ffb5 265 kcpy KEY_COPY copy key
K_ALT_KPDFIVE ffc5 305 kcrt KEY_CREATE create key
K_END ffa8 250 kend KEY_END end key
K_CTL_END ffb8 270 kext KEY_EXIT exit key
K_ALT_F ffe6 346 kfnd KEY_FIND find key
K_ALT_H ffe8 350 khlp KEY_HELP help key
K_ALT_M ffed 355 kmrk KEY_MARK mark key
K_ALT_E ffe5 345 kmsg KEY_MESSAGE message key
K_ALT_I ffe9 351 kmov KEY_MOVE move key
K_ALT_PGDN ffca 312 knxt KEY_NEXT next object key
K_ALT_O ffef 357 kopn KEY_OPEN open key
K_ALT_K ffeb 353 kopt KEY_OPTIONS options key
K_ALT_PGUP ffc2 302 kprv KEY_PREVIOUS previous object key
K_CTL_RUBOUT ffde 336 krdo KEY_REDO redo key
K_ALT_L ffec 354 kref KEY_REFERENCE ref(erence) key
K_ALT_G ffe7 347 krfr KEY_REFRESH refresh key
K_ALT_R fff2 362 krpl KEY_REPLACE replace key
K_ALT_J ffea 352 krst KEY_RESTART restart key
K_ALT_P fff0 360 kres KEY_RESUME resume key
K_ALT_Q fff1 361 ksav KEY_SAVE save key
K_ALT_N ffee 356 kBEG KEY_SBEG shifted beginning key
K_CTL_KPDMINUS ffb3 263 kCAN KEY_SCANCEL shifted cancel key
K_CTL_KPDPLUS ffb7 267 kCMD KEY_SCOMMAND shifted command key
K_ALT_S fff3 363 kCPY KEY_SCOPY shifted copy key
K_ALT_T fff4 364 kCRT KEY_SCREATE shifted create key
kDC KEY_SDC shifted delete char key
K_ALT_V fff6 366 kDL KEY_SDL shifted delete line key
K_KBDPLUS ffa7 247 kslt KEY_SELECT select key
K_ALT_UP ffc1 301 kEND KEY_SEND shifted end key
K_ALT_DOWN ffc9 311 kEOL KEY_SEOL shifted clear line key
K_ALT_W fff7 367 kEXT KEY_SEXIT shifted exit key
K_ALT_X fff8 370 kFND KEY_SFIND shifted find key
K_ALT_Y fff9 371 kHLP KEY_SHELP shifted help key
K_CTL_HOME ffb0 260 kHOM KEY_SHOME shifted home key
K_SHF_ENTER ffe0 340 kIC KEY_SIC shifted input key
K_CTL_LEFT ffb4 264 kLFT KEY_SLEFT shifted left arrow key
K_ALT_LEFT ffc4 304 kMSG KEY_SMESSAGE shifted message key
K_ALT_RIGHT ffc6 306 kMOV KEY_SMOVE shifted move key
K_CTL_PGDN ffba 272 kNXT KEY_SNEXT shifted next key
K_ALT_Z fffa 372 kOPT KEY_SOPTIONS shifted options key
K_CTL_PGUP ffb2 262 kPRV KEY_SPREVIOUS shifted prev key
K_CTL_PRTSC ffbd 275 kPRT KEY_SPRINT shifted print key
K_ALT_PRTSC ffcd 315 kRDO KEY_SREDO shifted redo key
kRPL KEY_SREPLACE shifted replace key
K_CTL_RIGHT ffb6 266 kRIT KEY_SRIGHT shifted right arrow
kRES KEY_SRSUME shifted resume key
K_ALT_KPDPLUS ffc7 307 kSAV KEY_SSAVE shifted save key
K_ALT_KPDMINUS ffc3 303 kSPD KEY_SSUSPEND shifted suspend key
kUND KEY_SUNDO shifted undo key
kspd KEY_SUSPEND suspend key
K_ALT_U fff5 365 kund KEY_UNDO undo key
K_RUBOUT 007f 177 del
K_ERASE 0018 030 ^x
K_TAB 0009 tab 011

Required Terminal Capabilities

Any terminal which is to be used with qed must support the following capabilities:

The last point requires further explanation. On some terminals, an escape sequence to turn on inverse video takes up a character position on the line. As a result your standard 80 column line will be reduced to 78 columns (one character to turn on, and one character to turn off) The qed editor does not work properly on this type of terminal. Escape sequences must not take any physical room on the screen.

Although not required, the following capabilities are recommended

The first two will speed up display updates while the third is necessary for displaying tagged blocks of text. If your terminal supports Highlighting or underline, but not inverse video, then qed will attempt to display tagged areas of text using these capabilities. Without cursor keys, the editor may be painful to use.

Screen Output

qed will adjust its output to conform to your terminal's screen size. Display updates will be determined by the baud rate if qed is being run from an attached terminal. This will be considerably slower than running qed on a console, xterm etc. Non-ASCII characters (0x00-0x1f and 0x7e-0xff) will be displayed as a question (?) mark. They are saved and manipulated as the characters they really represent. It is only the display which prints them as question marks.

Note: on attached terminals, the column position is NOT updated as you move your cursor. To force an update you must type the <SHOW> key, which on a PC keyboard, is the center key (5) on the numeric keypad when Num Lock is turned off.

Keyboard Input

It is keyboard input which really differentiates using qed on a QNX terminal type from qed on a non-QNX terminal. The console keyboard is rich in both function and cursor keys. Unfortunately, most terminals are rather limited in the special keys that they provide. To overcome this it is often necessary to enter a two or three character sequence to simulate a single console key. The terminal database defines keys according to their function. For example, the large + key on the console keyboard's numeric keypad is called the "select" key. It is used by qed to leave some form of input mode and return back to a command state. This key is very seldom found on a terminal, so you will have to add a kslt capability to your terminal type. Note that this should be something sent by one keystroke unless you have very fast fingers -- the timeout between characters of multi-character keycodes is quite quick.

There is no provision for executing any of the Alt letter keys such as Alt-b to turn on option blank. You will have to go to the command line and type the option command directly. (ob+ or ob-)

You may examine the escape sequences in effect for your terminal by using the infocmp utility. For more information, see the Utilities Reference.