Skip to content

Commit

Permalink
Merge branch '3761_mcedit_delete_vertical_block'
Browse files Browse the repository at this point in the history
* 3761_mcedit_delete_vertical_block:
  Tricket #3761: mcedit: wrong deletion of marked column.
  • Loading branch information
aborodin committed Dec 31, 2023
2 parents 1541952 + b50470f commit 6abea99
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/editor/editcmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,13 +460,11 @@ edit_save_cmd (WEdit * edit)
/* --------------------------------------------------------------------------------------------- */

static void
edit_delete_column_of_text (WEdit * edit)
edit_delete_column_of_text (WEdit * edit, off_t m1, off_t m2)
{
off_t m1, m2;
off_t n;
long b, c, d;

eval_marks (edit, &m1, &m2);
n = edit_buffer_get_forward_offset (&edit->buffer, m1, 0, m2) + 1;
c = (long) edit_move_forward3 (edit, edit_buffer_get_bol (&edit->buffer, m1), 0, m1);
d = (long) edit_move_forward3 (edit, edit_buffer_get_bol (&edit->buffer, m2), 0, m2);
Expand Down Expand Up @@ -500,15 +498,11 @@ edit_delete_column_of_text (WEdit * edit)
/** if success return 0 */

static int
edit_block_delete (WEdit * edit)
edit_block_delete (WEdit * edit, off_t start_mark, off_t end_mark)
{
off_t start_mark, end_mark;
off_t curs_pos;
long curs_line, c1, c2;

if (!eval_marks (edit, &start_mark, &end_mark))
return 0;

if (edit->column_highlight && edit->mark2 < 0)
edit_mark_cmd (edit, FALSE);

Expand Down Expand Up @@ -542,7 +536,7 @@ edit_block_delete (WEdit * edit)

if (edit->mark2 < 0)
edit_mark_cmd (edit, FALSE);
edit_delete_column_of_text (edit);
edit_delete_column_of_text (edit, start_mark, end_mark);
/* move cursor to the saved position */
edit_move_to_line (edit, curs_line);
/* calculate line width and cursor position before cut */
Expand Down Expand Up @@ -1496,7 +1490,7 @@ edit_block_delete_cmd (WEdit * edit)
off_t start_mark, end_mark;

if (eval_marks (edit, &start_mark, &end_mark))
return edit_block_delete (edit);
return edit_block_delete (edit, start_mark, end_mark);

edit_delete_line (edit);

Expand Down

0 comments on commit 6abea99

Please sign in to comment.