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