mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
MC Edit: column_highlighting flag is a member of WEdit struct.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
2cc2f34912
commit
dfe9bc887a
@ -332,6 +332,4 @@ extern int option_edit_bottom_extreme;
|
||||
extern const char *option_whole_chars_search;
|
||||
extern int search_create_bookmark;
|
||||
|
||||
extern int column_highlighting;
|
||||
|
||||
#endif /* MC_EDIT_IMPL_H */
|
||||
|
@ -75,6 +75,7 @@ struct WEdit
|
||||
unsigned int screen_modified:1; /* File has been changed since the last screen draw */
|
||||
unsigned int delete_file:1; /* New file, needs to be deleted unless modified */
|
||||
unsigned int highlight:1; /* There is a selected block */
|
||||
unsigned int column_highlight:1;
|
||||
unsigned int utf8:1; /* It's multibyte file codeset */
|
||||
long prev_col; /* recent column position of the cursor - used when moving
|
||||
up or down past lines that are shorter than the current line */
|
||||
|
@ -2302,7 +2302,7 @@ edit_left_word_move (WEdit * edit, int s)
|
||||
for (;;)
|
||||
{
|
||||
int c1, c2;
|
||||
if (column_highlighting
|
||||
if (edit->column_highlight
|
||||
&& edit->mark1 != edit->mark2
|
||||
&& edit->over_col == 0 && edit->curs1 == edit_bol (edit, edit->curs1))
|
||||
break;
|
||||
@ -2334,7 +2334,7 @@ edit_right_word_move (WEdit * edit, int s)
|
||||
for (;;)
|
||||
{
|
||||
int c1, c2;
|
||||
if (column_highlighting
|
||||
if (edit->column_highlight
|
||||
&& edit->mark1 != edit->mark2
|
||||
&& edit->over_col == 0 && edit->curs1 == edit_eol (edit, edit->curs1))
|
||||
break;
|
||||
@ -2389,7 +2389,7 @@ static void
|
||||
edit_left_char_move_cmd (WEdit * edit)
|
||||
{
|
||||
int cw = 1;
|
||||
if (column_highlighting
|
||||
if (edit->column_highlight
|
||||
&& option_cursor_beyond_eol
|
||||
&& edit->mark1 != edit->mark2
|
||||
&& edit->over_col == 0 && edit->curs1 == edit_bol (edit, edit->curs1))
|
||||
@ -2519,10 +2519,10 @@ edit_do_undo (WEdit * edit)
|
||||
edit_delete (edit, 1);
|
||||
break;
|
||||
case COLUMN_ON:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
break;
|
||||
case COLUMN_OFF:
|
||||
column_highlighting = 0;
|
||||
edit->column_highlight = 0;
|
||||
break;
|
||||
}
|
||||
if (ac >= 256 && ac < 512)
|
||||
@ -2897,7 +2897,7 @@ edit_execute_key_command (WEdit * edit, unsigned long command, int char_for_inse
|
||||
edit_push_key_press (edit);
|
||||
|
||||
edit_execute_cmd (edit, command, char_for_insertion);
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
edit->force |= REDRAW_PAGE;
|
||||
}
|
||||
|
||||
@ -2916,12 +2916,12 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
||||
|
||||
/* The next key press will unhighlight the found string, so update
|
||||
* the whole page */
|
||||
if (edit->found_len || column_highlighting)
|
||||
if (edit->found_len || edit->column_highlight)
|
||||
edit->force |= REDRAW_PAGE;
|
||||
|
||||
if (command / 100 == 6)
|
||||
{ /* a highlight command like shift-arrow */
|
||||
column_highlighting = 0;
|
||||
edit->column_highlight = 0;
|
||||
if (!edit->highlight || (edit->mark2 != -1 && edit->mark1 != edit->mark2))
|
||||
{
|
||||
edit_mark_cmd (edit, 1); /* clear */
|
||||
@ -3020,9 +3020,9 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
||||
{
|
||||
if (!option_persistent_selections)
|
||||
{
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
edit_push_action (edit, COLUMN_ON);
|
||||
column_highlighting = 0;
|
||||
edit->column_highlight = 0;
|
||||
edit_mark_cmd (edit, 1);
|
||||
}
|
||||
}
|
||||
@ -3160,19 +3160,19 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
||||
break;
|
||||
|
||||
case CK_Page_Up_Alt_Highlight:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
case CK_Page_Up:
|
||||
case CK_Page_Up_Highlight:
|
||||
edit_move_up (edit, edit->num_widget_lines - 1, 1);
|
||||
break;
|
||||
case CK_Page_Down_Alt_Highlight:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
case CK_Page_Down:
|
||||
case CK_Page_Down_Highlight:
|
||||
edit_move_down (edit, edit->num_widget_lines - 1, 1);
|
||||
break;
|
||||
case CK_Left_Alt_Highlight:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
case CK_Left:
|
||||
case CK_Left_Highlight:
|
||||
if (option_fake_half_tabs)
|
||||
@ -3190,7 +3190,7 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
||||
edit_left_char_move_cmd (edit);
|
||||
break;
|
||||
case CK_Right_Alt_Highlight:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
case CK_Right:
|
||||
case CK_Right_Highlight:
|
||||
if (option_fake_half_tabs)
|
||||
@ -3223,37 +3223,37 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
||||
edit_right_word_move_cmd (edit);
|
||||
break;
|
||||
case CK_Up_Alt_Highlight:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
case CK_Up:
|
||||
case CK_Up_Highlight:
|
||||
edit_move_up (edit, 1, 0);
|
||||
break;
|
||||
case CK_Down_Alt_Highlight:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
case CK_Down:
|
||||
case CK_Down_Highlight:
|
||||
edit_move_down (edit, 1, 0);
|
||||
break;
|
||||
case CK_Paragraph_Up_Alt_Highlight:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
case CK_Paragraph_Up:
|
||||
case CK_Paragraph_Up_Highlight:
|
||||
edit_move_up_paragraph (edit, 0);
|
||||
break;
|
||||
case CK_Paragraph_Down_Alt_Highlight:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
case CK_Paragraph_Down:
|
||||
case CK_Paragraph_Down_Highlight:
|
||||
edit_move_down_paragraph (edit, 0);
|
||||
break;
|
||||
case CK_Scroll_Up_Alt_Highlight:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
case CK_Scroll_Up:
|
||||
case CK_Scroll_Up_Highlight:
|
||||
edit_move_up (edit, 1, 1);
|
||||
break;
|
||||
case CK_Scroll_Down_Alt_Highlight:
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
case CK_Scroll_Down:
|
||||
case CK_Scroll_Down_Highlight:
|
||||
edit_move_down (edit, 1, 1);
|
||||
@ -3298,16 +3298,16 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
||||
case CK_Mark:
|
||||
if (edit->mark2 >= 0)
|
||||
{
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
edit_push_action (edit, COLUMN_ON);
|
||||
column_highlighting = 0;
|
||||
edit->column_highlight = 0;
|
||||
}
|
||||
edit_mark_cmd (edit, 0);
|
||||
break;
|
||||
case CK_Column_Mark:
|
||||
if (!column_highlighting)
|
||||
if (!edit->column_highlight)
|
||||
edit_push_action (edit, COLUMN_OFF);
|
||||
column_highlighting = 1;
|
||||
edit->column_highlight = 1;
|
||||
edit_mark_cmd (edit, 0);
|
||||
break;
|
||||
case CK_Mark_All:
|
||||
@ -3315,9 +3315,9 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
|
||||
edit->force |= REDRAW_PAGE;
|
||||
break;
|
||||
case CK_Unmark:
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
edit_push_action (edit, COLUMN_ON);
|
||||
column_highlighting = 0;
|
||||
edit->column_highlight = 0;
|
||||
edit_mark_cmd (edit, 1);
|
||||
break;
|
||||
|
||||
|
@ -1150,7 +1150,7 @@ eval_marks (WEdit * edit, long *start_mark, long *end_mark)
|
||||
*end_mark = max (edit->mark1, edit->curs1);
|
||||
edit->column2 = edit->curs_col + edit->over_col;
|
||||
}
|
||||
if (column_highlighting
|
||||
if (edit->column_highlight
|
||||
&& (((edit->mark1 > edit->curs1) && (edit->column1 < edit->column2))
|
||||
|| ((edit->mark1 < edit->curs1) && (edit->column1 > edit->column2))))
|
||||
{
|
||||
@ -1321,7 +1321,7 @@ edit_block_copy_cmd (WEdit * edit)
|
||||
|
||||
edit_push_markers (edit);
|
||||
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
{
|
||||
edit_insert_column_of_text (edit, copy_buf, size, abs (edit->column2 - edit->column1));
|
||||
}
|
||||
@ -1334,11 +1334,11 @@ edit_block_copy_cmd (WEdit * edit)
|
||||
g_free (copy_buf);
|
||||
edit_scroll_screen_over_cursor (edit);
|
||||
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
{
|
||||
edit_set_markers (edit, 0, 0, 0, 0);
|
||||
edit_push_action (edit, COLUMN_ON);
|
||||
column_highlighting = 0;
|
||||
edit->column_highlight = 0;
|
||||
}
|
||||
else if (start_mark < current && end_mark > current)
|
||||
edit_set_markers (edit, start_mark, end_mark + end_mark - start_mark, 0, 0);
|
||||
@ -1359,7 +1359,7 @@ edit_block_move_cmd (WEdit * edit)
|
||||
|
||||
if (eval_marks (edit, &start_mark, &end_mark))
|
||||
return;
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
{
|
||||
edit_update_curs_col (edit);
|
||||
x = edit->curs_col;
|
||||
@ -1381,7 +1381,7 @@ edit_block_move_cmd (WEdit * edit)
|
||||
|
||||
edit_push_markers (edit);
|
||||
current = edit->curs1;
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
{
|
||||
long line;
|
||||
int size, c1, c2;
|
||||
@ -1415,7 +1415,7 @@ edit_block_move_cmd (WEdit * edit)
|
||||
}
|
||||
edit_set_markers (edit, 0, 0, 0, 0);
|
||||
edit_push_action (edit, COLUMN_ON);
|
||||
column_highlighting = 0;
|
||||
edit->column_highlight = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1489,7 +1489,7 @@ edit_block_delete (WEdit * edit)
|
||||
|
||||
if (eval_marks (edit, &start_mark, &end_mark))
|
||||
return 0;
|
||||
if (column_highlighting && edit->mark2 < 0)
|
||||
if (edit->column_highlight && edit->mark2 < 0)
|
||||
edit_mark_cmd (edit, 0);
|
||||
if ((end_mark - start_mark) > option_max_undo / 2)
|
||||
{
|
||||
@ -1523,7 +1523,7 @@ edit_block_delete (WEdit * edit)
|
||||
count = start_mark;
|
||||
if (start_mark < end_mark)
|
||||
{
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
{
|
||||
if (edit->mark2 < 0)
|
||||
edit_mark_cmd (edit, 0);
|
||||
@ -2074,7 +2074,7 @@ edit_get_block (WEdit * edit, long start, long finish, int *l)
|
||||
{
|
||||
unsigned char *s, *r;
|
||||
r = s = g_malloc0 (finish - start + 1);
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
{
|
||||
*l = 0;
|
||||
/* copy from buffer, excluding chars that are out of the column 'margins' */
|
||||
@ -2114,7 +2114,7 @@ edit_save_block (WEdit * edit, const char *filename, long start, long finish)
|
||||
if (file == -1)
|
||||
return 0;
|
||||
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
{
|
||||
int r;
|
||||
r = mc_write (file, VERTICAL_MAGIC, sizeof (VERTICAL_MAGIC));
|
||||
|
@ -118,7 +118,7 @@ status_string (WEdit * edit, char *s, int w)
|
||||
if (simple_statusbar)
|
||||
g_snprintf (s, w,
|
||||
"%c%c%c%c %3ld %5ld/%ld %6ld/%ld %s %s",
|
||||
edit->mark1 != edit->mark2 ? (column_highlighting ? 'C' : 'B') : '-',
|
||||
edit->mark1 != edit->mark2 ? (edit->column_highlight ? 'C' : 'B') : '-',
|
||||
edit->modified ? 'M' : '-',
|
||||
edit->macro_i < 0 ? '-' : 'R',
|
||||
edit->overwrite == 0 ? '-' : 'O',
|
||||
@ -134,7 +134,7 @@ status_string (WEdit * edit, char *s, int w)
|
||||
else
|
||||
g_snprintf (s, w,
|
||||
"[%c%c%c%c] %2ld L:[%3ld+%2ld %3ld/%3ld] *(%-4ld/%4ldb) %s %s",
|
||||
edit->mark1 != edit->mark2 ? (column_highlighting ? 'C' : 'B') : '-',
|
||||
edit->mark1 != edit->mark2 ? (edit->column_highlight ? 'C' : 'B') : '-',
|
||||
edit->modified ? 'M' : '-',
|
||||
edit->macro_i < 0 ? '-' : 'R',
|
||||
edit->overwrite == 0 ? '-' : 'O',
|
||||
@ -470,7 +470,7 @@ edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_co
|
||||
p->style |= MOD_CURSOR;
|
||||
if (q >= m1 && q < m2)
|
||||
{
|
||||
if (column_highlighting)
|
||||
if (edit->column_highlight)
|
||||
{
|
||||
int x;
|
||||
x = edit_move_forward3 (edit, b, 0, q);
|
||||
|
@ -54,8 +54,6 @@
|
||||
#include "src/cmddef.h"
|
||||
#include "src/keybind.h"
|
||||
|
||||
int column_highlighting = 0;
|
||||
|
||||
static cb_ret_t edit_callback (Widget *, widget_msg_t msg, int parm);
|
||||
|
||||
static char *
|
||||
|
Loading…
Reference in New Issue
Block a user