diff -urN mc-4.6.2_mcDC/ChangeLog mc-2009-04-05/ChangeLog
old
|
new
|
|
| 1 | 2009-04-05 Vit Rosin <vit_r@list.ru> |
| 2 | |
| 3 | * edit.c, edit.h : Add edit_an_ordinary_key_press () |
| 4 | Usually after typing comma-key (prints comma char ',') |
| 5 | spacebar press follows to insert space ' '. |
| 6 | With this patch typing comma-key prints two chars |
| 7 | comma char ',' and space ' ' (except some cases). |
| 8 | |
1 | 9 | 2007-11-02 Vladimir Nadvornik <nadvornik@suse.cz> |
2 | 10 | |
3 | 11 | * editlock.c (lock_build_name): Check the return value of getpwuid(). |
diff -urN mc-4.6.2_MCDC/edit.c mc-2009-04-05/edit.c
old
|
new
|
|
2176 | 2176 | if (edit_get_byte (edit, edit->curs1) != '\n') |
2177 | 2177 | edit_delete (edit); |
2178 | 2178 | } |
2179 | | edit_insert (edit, char_for_insertion); |
| 2179 | edit_an_ordinary_key_press (edit, char_for_insertion); |
2180 | 2180 | if (option_auto_para_formatting) { |
2181 | 2181 | format_paragraph (edit, 0); |
2182 | 2182 | edit->force |= REDRAW_PAGE; |
… |
… |
|
2701 | 2701 | cleanup: |
2702 | 2702 | g_free (block_file); |
2703 | 2703 | } |
| 2704 | |
| 2705 | void edit_an_ordinary_key_press (WEdit * edit, const int char_for_insertion) |
| 2706 | { |
| 2707 | int c0, c2; |
| 2708 | if (',' == char_for_insertion) { |
| 2709 | edit_insert (edit, char_for_insertion); |
| 2710 | c0 = edit_get_byte (edit, edit->curs1); |
| 2711 | if (isdigit (c0) || '\'' == c0) |
| 2712 | return; |
| 2713 | |
| 2714 | if (edit->curs1 > 1) { |
| 2715 | c2 = edit_get_byte (edit, edit->curs1 - 2); |
| 2716 | if (isdigit (c2) || '\'' == c2) |
| 2717 | return; |
| 2718 | } |
| 2719 | if ( ! (' ' == c0 || '\t' == c0 || '\'' == c0)) |
| 2720 | edit_insert (edit, ' '); |
| 2721 | |
| 2722 | return; |
| 2723 | |
| 2724 | } else if (isdigit (char_for_insertion)) { |
| 2725 | if (edit->curs1 > 2) { |
| 2726 | if (' ' == edit_get_byte (edit, edit->curs1 - 1) |
| 2727 | && ',' == edit_get_byte (edit, edit->curs1 - 2) |
| 2728 | && isdigit (edit_get_byte (edit, edit->curs1 - 3))) |
| 2729 | edit_backspace (edit); |
| 2730 | } |
| 2731 | } |
| 2732 | edit_insert (edit, char_for_insertion); |
| 2733 | } |
diff -urN mc-4.6.2_MCDC/edit.h mc-2009-04-05/edit.h
old
|
new
|
|
234 | 234 | |
235 | 235 | /* either command or char_for_insertion must be passed as -1 */ |
236 | 236 | void edit_execute_cmd (WEdit *edit, int command, int char_for_insertion); |
| 237 | void edit_an_ordinary_key_press (WEdit * edit, const int char_for_insertion); |
237 | 238 | |
238 | 239 | #define get_sys_error(s) (s) |
239 | 240 | |