Ticket #3211: 3_edit_lock.patch
File 3_edit_lock.patch, 7.8 KB (added by aurel, 11 years ago) |
---|
-
lib/keybind.c
old new static name_keymap_t command_names[] = { 290 290 {"BookmarkFlush", CK_BookmarkFlush}, 291 291 {"BookmarkNext", CK_BookmarkNext}, 292 292 {"BookmarkPrev", CK_BookmarkPrev}, 293 {"ChangeLockToggle", CK_ChangeLockToggle}, 293 294 {"MarkPageUp", CK_MarkPageUp}, 294 295 {"MarkPageDown", CK_MarkPageDown}, 295 296 {"MarkToFileBegin", CK_MarkToFileBegin}, -
lib/keybind.h
old new enum 246 246 CK_BookmarkFlush, 247 247 CK_BookmarkNext, 248 248 CK_BookmarkPrev, 249 CK_ChangeLockToggle, 249 250 /* mark commands */ 250 251 CK_MarkColumn, 251 252 CK_MarkWord, -
misc/mc.default.keymap
old new Bookmark = alt-k 319 319 BookmarkFlush = alt-o 320 320 BookmarkNext = alt-j 321 321 BookmarkPrev = alt-i 322 ChangeLockToggle = ctrl-alt-l 322 323 # History = 323 324 Shell = ctrl-o 324 325 InsertLiteral = ctrl-q -
misc/mc.emacs.keymap
old new Menu = f9 318 318 # BookmarkFlush = 319 319 # BookmarkNext = 320 320 # BookmarkPrev = 321 # ChangeLockToggle = 321 322 # History = 322 323 Shell = ctrl-o 323 324 InsertLiteral = ctrl-q -
src/editor/edit.c
old new edit_move_updown (WEdit * edit, long lin 1053 1053 static void 1054 1054 edit_right_delete_word (WEdit * edit) 1055 1055 { 1056 if (edit->edit_locked) 1057 return; 1058 1056 1059 while (edit->buffer.curs1 < edit->buffer.size) 1057 1060 { 1058 1061 int c1, c2; … … edit_right_delete_word (WEdit * edit) 1073 1076 static void 1074 1077 edit_left_delete_word (WEdit * edit) 1075 1078 { 1079 if (edit->edit_locked) 1080 return; 1081 1076 1082 while (edit->buffer.curs1 > 0) 1077 1083 { 1078 1084 int c1, c2; … … edit_do_undo (WEdit * edit) 1100 1106 long ac; 1101 1107 long count = 0; 1102 1108 1109 if (edit->edit_locked) 1110 return; 1111 1103 1112 edit->undo_stack_disable = 1; /* don't record undo's onto undo stack! */ 1104 1113 edit->over_col = 0; 1105 1114 while ((ac = edit_pop_undo_action (edit)) < KEY_PRESS) … … edit_do_redo (WEdit * edit) 1183 1192 long ac; 1184 1193 long count = 0; 1185 1194 1195 if (edit->edit_locked) 1196 return; 1197 1186 1198 if (edit->redo_stack_reset) 1187 1199 return; 1188 1200 … … edit_group_undo (WEdit * edit) 1280 1292 static void 1281 1293 edit_delete_to_line_end (WEdit * edit) 1282 1294 { 1295 if (edit->edit_locked) 1296 return; 1297 1283 1298 while (edit_buffer_get_current_byte (&edit->buffer) != '\n' && edit->buffer.curs2 != 0) 1284 1299 edit_delete (edit, TRUE); 1285 1300 } … … edit_delete_to_line_end (WEdit * edit) 1289 1304 static void 1290 1305 edit_delete_to_line_begin (WEdit * edit) 1291 1306 { 1307 if (edit->edit_locked) 1308 return; 1309 1292 1310 while (edit_buffer_get_previous_byte (&edit->buffer) != '\n' && edit->buffer.curs1 != 0) 1293 1311 edit_backspace (edit, TRUE); 1294 1312 } … … edit_init (WEdit * edit, int y, int x, i 2096 2114 2097 2115 edit->loading_done = 1; 2098 2116 edit->modified = 0; 2117 edit->edit_locked = 0; 2099 2118 edit->locked = 0; 2100 2119 edit_load_syntax (edit, NULL, NULL); 2101 2120 edit_get_syntax_color (edit, -1); … … edit_push_redo_action (WEdit * edit, lon 2450 2469 void 2451 2470 edit_insert (WEdit * edit, int c) 2452 2471 { 2472 if (edit->edit_locked) 2473 return; 2474 2453 2475 /* first we must update the position of the display window */ 2454 2476 if (edit->buffer.curs1 < edit->start_display) 2455 2477 { … … edit_insert (WEdit * edit, int c) 2494 2516 void 2495 2517 edit_insert_ahead (WEdit * edit, int c) 2496 2518 { 2519 if (edit->edit_locked) 2520 return; 2521 2497 2522 if (edit->buffer.curs1 < edit->start_display) 2498 2523 { 2499 2524 edit->start_display++; … … edit_delete (WEdit * edit, gboolean byte 2544 2569 int cw = 1; 2545 2570 int i; 2546 2571 2547 if (edit-> buffer.curs2 == 0)2572 if (edit->edit_locked || edit->buffer.curs2 == 0) 2548 2573 return 0; 2549 2574 2550 2575 #ifdef HAVE_CHARSET … … edit_backspace (WEdit * edit, gboolean b 2606 2631 int cw = 1; 2607 2632 int i; 2608 2633 2609 if (edit-> buffer.curs1 == 0)2634 if (edit->edit_locked || edit->buffer.curs1 == 0) 2610 2635 return 0; 2611 2636 2612 2637 if (edit->mark2 != edit->mark1) … … edit_mark_current_line_cmd (WEdit * edit 3080 3105 void 3081 3106 edit_delete_line (WEdit * edit) 3082 3107 { 3108 if (edit->edit_locked) 3109 return; 3110 3083 3111 /* 3084 3112 * Delete right part of the line. 3085 3113 * Note that edit_buffer_get_byte() returns '\n' when byte position is … … edit_execute_cmd (WEdit * edit, unsigned 3641 3669 edit_mark_current_line_cmd (edit); 3642 3670 break; 3643 3671 3672 case CK_ChangeLockToggle: 3673 edit->edit_locked = !edit->edit_locked; 3674 break; 3675 3644 3676 case CK_Bookmark: 3645 3677 book_mark_clear (edit, edit->buffer.curs_line, BOOK_MARK_FOUND_COLOR); 3646 3678 if (book_mark_query_color (edit, edit->buffer.curs_line, BOOK_MARK_COLOR)) -
src/editor/editdraw.c
old new status_string (WEdit * edit, char *s, in 152 152 /* The field lengths just prevent the status line from shortening too much */ 153 153 if (simple_statusbar) 154 154 g_snprintf (s, w, 155 "%c%c%c%c %3ld %5ld/%ld %6ld/%ld %s %s",155 "%c%c%c%c%c %3ld %5ld/%ld %6ld/%ld %s %s", 156 156 edit->mark1 != edit->mark2 ? (edit->column_highlight ? 'C' : 'B') : '-', 157 157 edit->modified ? 'M' : '-', 158 158 macro_index < 0 ? '-' : 'R', 159 159 edit->overwrite == 0 ? '-' : 'O', 160 edit->edit_locked == 0 ? '-' : 'L', 160 161 edit->curs_col + edit->over_col, 161 162 edit->buffer.curs_line + 1, 162 163 edit->buffer.lines + 1, (long) edit->buffer.curs1, (long) edit->buffer.size, … … status_string (WEdit * edit, char *s, in 167 168 ""); 168 169 else 169 170 g_snprintf (s, w, 170 "[%c%c%c%c ] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb) %s %s",171 "[%c%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb) %s %s", 171 172 edit->mark1 != edit->mark2 ? (edit->column_highlight ? 'C' : 'B') : '-', 172 173 edit->modified ? 'M' : '-', 173 174 macro_index < 0 ? '-' : 'R', 174 175 edit->overwrite == 0 ? '-' : 'O', 176 edit->edit_locked == 0 ? '-' : 'L', 175 177 edit->curs_col + edit->over_col, 176 178 edit->start_line + 1, 177 179 edit->curs_row, -
src/editor/editmenu.c
old new create_command_menu (void) 154 154 entries = 155 155 g_list_prepend (entries, 156 156 menu_entry_create (_("Toggle s&yntax highlighting"), CK_SyntaxOnOff)); 157 entries = 158 g_list_prepend (entries, 159 menu_entry_create (_("Toggle &change lock"), CK_ChangeLockToggle)); 157 160 entries = g_list_prepend (entries, menu_separator_create ()); 158 161 entries = g_list_prepend (entries, menu_entry_create (_("&Find declaration"), CK_Find)); 159 162 entries = -
src/editor/editwidget.h
old new struct WEdit 105 105 long over_col; /* pos after '\n' */ 106 106 int force; /* how much of the screen do we redraw? */ 107 107 unsigned int overwrite:1; /* Overwrite on type mode (as opposed to insert) */ 108 unsigned int edit_locked:1; /* File modification is prohibited */ 108 109 unsigned int modified:1; /* File has been modified and needs saving */ 109 110 unsigned int loading_done:1; /* File has been loaded into the editor */ 110 111 unsigned int locked:1; /* We hold lock on current file */ -
src/keybind-defaults.c
old new static const global_keymap_ini_t default 404 404 {"BookmarkFlush", "alt-o"}, 405 405 {"BookmarkNext", "alt-j"}, 406 406 {"BookmarkPrev", "alt-i"}, 407 {"ChangeLockToggle", "ctrl-alt-l"}, 407 408 {"MacroStartStopRecord", "ctrl-r"}, 408 409 {"MacroExecute", "ctrl-a"}, 409 410 {"ShowNumbers", "alt-n"},