!diff -urN mc-4.6.2_MDC/edit/ChangeLog mc-2009-03-31/edit/ChangeLog
!--- mc-4.6.2_MDC/edit/ChangeLog 2009-02-01 19:30:21.000000000 +0000
!+++ mc-2009-03-31/edit/ChangeLog 2009-03-31 07:48:20.000000000 +0100
!@@ -1,3 +1,16 @@
!+2009-03-31 Vit Rosin <vit_r@list.ru>
!+ flow column insertion:
!+ * edit.c (edit_insert_file):
!+ When chars are inserted place cursor after inserted chars.
!+ * edit.h (edit_copy_to_X_buf_cmd): Add new argument.
!+ * editcmd.c (edit_copy_to_X_buf_cmd):
!+ Add saving the insert-start clmn.
!+ * edit.c (edit_execute_key_command):
!+ If after insertion next key press is <Up-arrow>, <Down-arrow>,
!+ <PageUp>, <PageDown>, <BeginText> or <EndText>, -
!+ move cursor to the insert-start clmn.
!+ Any other key press resets the insert-start clmn.
!+ Its _NOT_ patch yet, - to test and discuss only.
! 2007-11-02 Vladimir Nadvornik <nadvornik@suse.cz>
!
! * editlock.c (lock_build_name): Check the return value of getpwuid().
diff -urN mc-4.6.2_MDC/edit/edit.c mc-2009-03-31/edit/edit.c
old
|
new
|
|
70 | 70 | int option_edit_left_extreme = 0; |
71 | 71 | int option_edit_top_extreme = 0; |
72 | 72 | int option_edit_bottom_extreme = 0; |
| 73 | int flow_insert_col = -1; |
73 | 74 | |
74 | 75 | const char *option_whole_chars_search = "0123456789abcdefghijklmnopqrstuvwxyz_"; |
75 | 76 | char *option_backup_ext = NULL; |
… |
… |
|
267 | 268 | char *p; |
268 | 269 | if ((p = edit_get_filter (filename))) { |
269 | 270 | FILE *f; |
270 | | long current = edit->curs1; |
271 | 271 | f = (FILE *) popen (p, "r"); |
272 | 272 | if (f) { |
273 | 273 | edit_insert_stream (edit, f); |
274 | | edit_cursor_move (edit, current - edit->curs1); |
275 | 274 | if (pclose (f) > 0) { |
276 | 275 | GString *errmsg = g_string_new (NULL); |
277 | 276 | g_string_sprintf (errmsg, _(" Error reading from pipe: %s "), p); |
… |
… |
|
291 | 290 | g_free (p); |
292 | 291 | } else { |
293 | 292 | int i, file, blocklen; |
294 | | long current = edit->curs1; |
295 | 293 | unsigned char *buf; |
296 | 294 | if ((file = mc_open (filename, O_RDONLY | O_BINARY)) == -1) |
297 | 295 | return 0; |
… |
… |
|
300 | 298 | for (i = 0; i < blocklen; i++) |
301 | 299 | edit_insert (edit, buf[i]); |
302 | 300 | } |
303 | | edit_cursor_move (edit, current - edit->curs1); |
304 | 301 | g_free (buf); |
305 | 302 | mc_close (file); |
306 | 303 | if (blocklen) |
… |
… |
|
2125 | 2122 | edit_push_key_press (edit); |
2126 | 2123 | |
2127 | 2124 | edit_execute_cmd (edit, command, char_for_insertion); |
| 2125 | |
| 2126 | if (CK_Beginning_Of_Text == command || CK_End_Of_Text == command |
| 2127 | || CK_Page_Up == command || CK_Page_Down == command |
| 2128 | || CK_Up == command || CK_Down == command) { |
| 2129 | if (flow_insert_col >= 0) { |
| 2130 | edit->force |= REDRAW_COMPLETELY; |
| 2131 | edit_update_screen (edit); |
| 2132 | if ((edit_eol (edit, edit->curs1) - edit_bol (edit, edit->curs1)) > flow_insert_col) { |
| 2133 | edit_cursor_move (edit, flow_insert_col - edit->curs_col); |
| 2134 | edit->force |= REDRAW_COMPLETELY; |
| 2135 | edit_update_screen (edit); |
| 2136 | } |
| 2137 | } |
| 2138 | } else if (CK_XStore != command && CK_XCut != command |
| 2139 | && CK_XPaste != command) { |
| 2140 | flow_insert_col = -1; |
| 2141 | } |
2128 | 2142 | if (column_highlighting) |
2129 | 2143 | edit->force |= REDRAW_PAGE; |
2130 | 2144 | } |
… |
… |
|
2453 | 2467 | break; |
2454 | 2468 | |
2455 | 2469 | case CK_XStore: |
2456 | | edit_copy_to_X_buf_cmd (edit); |
| 2470 | edit_copy_to_X_buf_cmd (edit, &flow_insert_col); |
2457 | 2471 | break; |
2458 | 2472 | case CK_XCut: |
2459 | 2473 | edit_cut_to_X_buf_cmd (edit); |
| 2474 | flow_insert_col = edit_get_col (edit); |
2460 | 2475 | break; |
2461 | 2476 | case CK_XPaste: |
2462 | 2477 | edit_paste_from_X_buf_cmd (edit); |
diff -urN mc-4.6.2_MDC/edit/editcmd.c mc-2009-03-31/edit/editcmd.c
old
|
new
|
|
2291 | 2291 | edit_error_dialog (_(" Error "), _(" This function is not implemented. ")); |
2292 | 2292 | } |
2293 | 2293 | |
2294 | | int edit_copy_to_X_buf_cmd (WEdit * edit) |
| 2294 | int edit_copy_to_X_buf_cmd (WEdit * edit, int *flow_insert_col) |
2295 | 2295 | { |
2296 | 2296 | long start_mark, end_mark; |
2297 | 2297 | if (eval_marks (edit, &start_mark, &end_mark)) |
… |
… |
|
2300 | 2300 | edit_error_dialog (_(" Copy to clipboard "), get_sys_error (_(" Unable to save to file. "))); |
2301 | 2301 | return 1; |
2302 | 2302 | } |
| 2303 | if (start_mark == edit->mark1) |
| 2304 | *flow_insert_col = edit->column1; |
| 2305 | else |
| 2306 | *flow_insert_col = edit->column2; |
| 2307 | |
2303 | 2308 | edit_mark_cmd (edit, 1); |
2304 | 2309 | return 0; |
2305 | 2310 | } |
diff -urN mc-4.6.2_MDC/edit/edit.h mc-2009-03-31/edit/edit.h
old
|
new
|
|
197 | 197 | int edit_load_macro_cmd (WEdit * edit, struct macro macro[], int *n, int k); |
198 | 198 | void edit_delete_macro_cmd (WEdit * edit); |
199 | 199 | |
200 | | int edit_copy_to_X_buf_cmd (WEdit * edit); |
| 200 | int edit_copy_to_X_buf_cmd (WEdit * edit, int *flow_insert_col); |
201 | 201 | int edit_cut_to_X_buf_cmd (WEdit * edit); |
202 | 202 | void edit_paste_from_X_buf_cmd (WEdit * edit); |
203 | 203 | |