1 | defeventtab default_keys
|
---|
2 | def 'A-UP' = find_prev
|
---|
3 | def 'A-DOWN' = find_next
|
---|
4 | def 'A-PGUP' = prev_window
|
---|
5 | def 'A-PGDN' = next_window
|
---|
6 | def 'A-d' = delete_line
|
---|
7 | def 'A-o' = kkeys_duplicate_line
|
---|
8 | def 'A-s' = kkeys_switch_lines
|
---|
9 | def 'A-u' = undo_cursor /* will cursor movement in one undo step. */
|
---|
10 | def 'A-g' = goto_line
|
---|
11 | def 'INS' = boxer_paste
|
---|
12 | def 'S-INS' = insert_toggle
|
---|
13 | def 'C-UP' = kkeys_scroll_down
|
---|
14 | def 'C-DOWN' = kkeys_scroll_up
|
---|
15 | def 'C-PGUP' = prev_proc
|
---|
16 | def 'C-PGDN' = next_proc
|
---|
17 | def 'C-DEL' = kkeys_delete_right
|
---|
18 |
|
---|
19 |
|
---|
20 |
|
---|
21 | void kkeys_switch_lines()
|
---|
22 | {
|
---|
23 | /* Allocate a selection for copying the current line. */
|
---|
24 | cursor_down();
|
---|
25 | mark_id= _alloc_selection();
|
---|
26 | if (mark_id>=0)
|
---|
27 | {
|
---|
28 | _select_line(mark_id);
|
---|
29 | cursor_up();
|
---|
30 | cursor_up();
|
---|
31 | _move_to_cursor(mark_id);
|
---|
32 | cursor_down();
|
---|
33 | _free_selection(mark_id);
|
---|
34 | // This selection can be freed because it is not the active selection.
|
---|
35 | }
|
---|
36 | else
|
---|
37 | message(get_message(mark_id));
|
---|
38 | }
|
---|
39 |
|
---|
40 | void kkeys_duplicate_line()
|
---|
41 | {
|
---|
42 | /* Allocate a selection for copying the current line. */
|
---|
43 | mark_id= _alloc_selection();
|
---|
44 | if (mark_id>=0)
|
---|
45 | {
|
---|
46 | _select_line(mark_id);
|
---|
47 | _copy_to_cursor(mark_id);
|
---|
48 | // This selection can be freed because it is not the active selection.
|
---|
49 | _free_selection(mark_id);
|
---|
50 | cursor_down();
|
---|
51 | }
|
---|
52 | else
|
---|
53 | message(get_message(mark_id));
|
---|
54 | }
|
---|
55 |
|
---|
56 | void kkeys_delete_right()
|
---|
57 | {
|
---|
58 | col=p_col
|
---|
59 | search('[ \t]#|?|$|^','r+');
|
---|
60 | if ( match_length()&& get_text(1,match_length('s'))=='' )
|
---|
61 | {
|
---|
62 | _nrseek(match_length('s'));
|
---|
63 | _delete_text(match_length());
|
---|
64 | }
|
---|
65 | else
|
---|
66 | delete_word();
|
---|
67 | p_col=col
|
---|
68 | //retrieve_command_results()
|
---|
69 |
|
---|
70 | }
|
---|
71 |
|
---|
72 | void kkeys_delete_left()
|
---|
73 | {
|
---|
74 | //denne virker ikkje som den skal!!!
|
---|
75 | message "not implemented"
|
---|
76 | return;
|
---|
77 | col=p_col
|
---|
78 | search('[ \t]#|?|$|^','r-');
|
---|
79 | if ( match_length()&& get_text(1,match_length('s'))=='' )
|
---|
80 | {
|
---|
81 | _nrseek(match_length('s'));
|
---|
82 | _delete_text(match_length());
|
---|
83 | }
|
---|
84 | else
|
---|
85 | delete_word();
|
---|
86 | p_col=col
|
---|
87 | }
|
---|
88 |
|
---|
89 | void kkeys_scroll_up()
|
---|
90 | {
|
---|
91 | if (p_cursor_y == 0)
|
---|
92 | down();
|
---|
93 | set_scroll_pos(p_left_edge, p_cursor_y-1);
|
---|
94 | }
|
---|
95 |
|
---|
96 | void kkeys_scroll_down()
|
---|
97 | {
|
---|
98 | if (p_cursor_y intdiv p_font_height == p_char_height-1)
|
---|
99 | up()
|
---|
100 | set_scroll_pos(p_left_edge, p_cursor_y+p_font_height);
|
---|
101 | }
|
---|
102 |
|
---|
103 |
|
---|
104 |
|
---|
105 |
|
---|
106 |
|
---|
107 | /* for later, not used yet. */
|
---|
108 |
|
---|
109 |
|
---|
110 | int boxer_paste()
|
---|
111 | {
|
---|
112 | int rc;
|
---|
113 | offset=_QROffset();
|
---|
114 | message(offset);
|
---|
115 | rc = paste();
|
---|
116 | _GoToROffset(offset);
|
---|
117 | return rc;
|
---|
118 | }
|
---|
119 |
|
---|
120 | _command boxer_select()
|
---|
121 | {
|
---|
122 | if (command_state())
|
---|
123 | fSelected = (p_sel_length != 0);
|
---|
124 | else
|
---|
125 | fSelected = select_active();
|
---|
126 |
|
---|
127 | key = last_event();
|
---|
128 | if (key :== name2event('s-down'))
|
---|
129 | {
|
---|
130 | if (!fSelected)
|
---|
131 | select_line();
|
---|
132 | else
|
---|
133 | cursor_down();
|
---|
134 | }
|
---|
135 | else if (key :== name2event('s-up'))
|
---|
136 | {
|
---|
137 | if (!fSelected)
|
---|
138 | select_line();
|
---|
139 | else
|
---|
140 | cursor_up();
|
---|
141 | }
|
---|
142 | else if (key :== name2event('s-left'))
|
---|
143 | {
|
---|
144 | if (!fSelected)
|
---|
145 | select_char();
|
---|
146 | else
|
---|
147 | cursor_left();
|
---|
148 | }
|
---|
149 | else if (key :== name2event('s-right'))
|
---|
150 | {
|
---|
151 | if (!fSelected)
|
---|
152 | select_char();
|
---|
153 | else
|
---|
154 | cursor_right();
|
---|
155 | }
|
---|
156 | else if (key :== name2event('s-home'))
|
---|
157 | {
|
---|
158 | if (!fSelected) select_char();
|
---|
159 | begin_line_text_toggle();
|
---|
160 | }
|
---|
161 | else if (key :== name2event('s-end'))
|
---|
162 | {
|
---|
163 | if (!fSelected) select_char();
|
---|
164 | end_line();
|
---|
165 | if (p_col > 0) //this is not identical with boxer...
|
---|
166 | cursor_left();
|
---|
167 | }
|
---|
168 | else if (key :== name2event('c-s-home'))
|
---|
169 | {
|
---|
170 | if (!fSelected) select_char();
|
---|
171 | top_of_buffer();
|
---|
172 | }
|
---|
173 | else if (key :== name2event('c-s-end'))
|
---|
174 | {
|
---|
175 | if (!fSelected) select_char();
|
---|
176 | bottom_of_buffer();
|
---|
177 | }
|
---|
178 | else if (key :== name2event('c-s-left'))
|
---|
179 | {
|
---|
180 | if (!fSelected)
|
---|
181 | {
|
---|
182 | cursor_left();
|
---|
183 | select_char(); /* start this selection non-inclusive */
|
---|
184 | }
|
---|
185 | prev_word();
|
---|
186 | }
|
---|
187 | else if (key :== name2event('c-s-right'))
|
---|
188 | {
|
---|
189 | if (!fSelected)
|
---|
190 | {
|
---|
191 | select_char(); /* start this selection non-inclusive */
|
---|
192 | }
|
---|
193 | /* temporary hack */
|
---|
194 | prevpos = p_col;
|
---|
195 | prevline = p_line;
|
---|
196 | p_col++;
|
---|
197 | next_word();
|
---|
198 | if ((p_line == prevline && p_col > prevpos + 1) || (p_line != prevline && p_col > 0))
|
---|
199 | p_col--;
|
---|
200 | }
|
---|
201 | }
|
---|
202 |
|
---|
203 |
|
---|
204 | void nop()
|
---|
205 | {
|
---|
206 |
|
---|
207 | }
|
---|
208 |
|
---|