Class: InLine::VT220Terminal

Inherits:
Terminal show all
Defined in:
lib/inline/terminal/vt220_terminal.rb

Overview

This class is used to define all the most common character codes and escape sequences used on *nix systems.

Instance Attribute Summary

Attributes inherited from Terminal

#escape_codes, #escape_sequences, #keys

Instance Method Summary collapse

Methods inherited from Terminal

#update

Constructor Details

#initializeVT220Terminal

Returns a new instance of VT220Terminal.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/inline/terminal/vt220_terminal.rb', line 20

def initialize
	super
	@escape_codes = [?\e]
	@keys.merge!(
		{
			:up_arrow => [?\e, ?[, ?A],
			:down_arrow => [?\e, ?[, ?B],
			:right_arrow => [?\e, ?[, ?C],
			:left_arrow => [?\e, ?[, ?D],
			:insert => [?\e, ?[, ?2, ?~],
			:delete => [?\e, ?[, ?3, ?~],
			:backspace => [?\C-?],
			:enter => [?\n],

			:ctrl_alt_a => [?\e, ?\C-a],
			:ctrl_alt_b => [?\e, ?\C-b],
			:ctrl_alt_c => [?\e, ?\C-c],
			:ctrl_alt_d => [?\e, ?\C-d],
			:ctrl_alt_e => [?\e, ?\C-e],
			:ctrl_alt_f => [?\e, ?\C-f],
			:ctrl_alt_g => [?\e, ?\C-g],
			:ctrl_alt_h => [?\e, ?\C-h],
			:ctrl_alt_i => [?\e, ?\C-i],
			:ctrl_alt_j => [?\e, ?\C-j],
			:ctrl_alt_k => [?\e, ?\C-k],
			:ctrl_alt_l => [?\e, ?\C-l],
			:ctrl_alt_m => [?\e, ?\C-m],
			:ctrl_alt_n => [?\e, ?\C-n],
			:ctrl_alt_o => [?\e, ?\C-o],
			:ctrl_alt_p => [?\e, ?\C-p],
			:ctrl_alt_q => [?\e, ?\C-q],
			:ctrl_alt_r => [?\e, ?\C-r],
			:ctrl_alt_s => [?\e, ?\C-s],
			:ctrl_alt_t => [?\e, ?\C-t],
			:ctrl_alt_u => [?\e, ?\C-u],
			:ctrl_alt_v => [?\e, ?\C-v],
			:ctrl_alt_w => [?\e, ?\C-w],
			:ctrl_alt_x => [?\e, ?\C-x],
			:ctrl_alt_y => [?\e, ?\C-y],
			:ctrl_alt_z => [?\e, ?\C-z]			
		})
end