mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
mark inserted from file
Signed-off-by: Ilia Maslakov <il.smind@gmail.com> Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
dc6bd875c4
commit
ecd8ca2292
@ -288,7 +288,8 @@ int edit_insert_file_cmd (WEdit * edit);
|
||||
void edit_insert_over (WEdit * edit);
|
||||
void edit_insert_column_of_text (WEdit * edit, unsigned char *data, int size, int width,
|
||||
long *start_pos, long *end_pos, int *col1, int *col2);
|
||||
int edit_insert_column_of_text_from_file (WEdit * edit, int file);
|
||||
int edit_insert_column_of_text_from_file (WEdit * edit, int file,
|
||||
long *start_pos, long *end_pos, int *col1, int *col2);
|
||||
long edit_insert_file (WEdit * edit, const char *filename);
|
||||
int edit_load_back_cmd (WEdit * edit);
|
||||
int edit_load_forward_cmd (WEdit * edit);
|
||||
|
@ -2060,7 +2060,17 @@ edit_insert_file (WEdit * edit, const char *filename)
|
||||
}
|
||||
if (vertical_insertion)
|
||||
{
|
||||
blocklen = edit_insert_column_of_text_from_file (edit, file);
|
||||
long mark1, mark2;
|
||||
int c1, c2;
|
||||
blocklen = edit_insert_column_of_text_from_file (edit, file, &mark1, &mark2, &c1, &c2);
|
||||
edit_set_markers (edit, edit->curs1, mark2, c1, c2);
|
||||
/* highlight inserted text then not persistent blocks */
|
||||
if (!option_persistent_selections)
|
||||
{
|
||||
if (!edit->column_highlight)
|
||||
edit_push_undo_action (edit, COLUMN_OFF);
|
||||
edit->column_highlight = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2069,8 +2079,16 @@ edit_insert_file (WEdit * edit, const char *filename)
|
||||
for (i = 0; i < blocklen; i++)
|
||||
edit_insert (edit, buf[i]);
|
||||
}
|
||||
|
||||
/* highlight inserted text then not persistent blocks */
|
||||
if (!option_persistent_selections)
|
||||
{
|
||||
edit_set_markers (edit, edit->curs1, current, 0, 0);
|
||||
if (edit->column_highlight)
|
||||
edit_push_undo_action (edit, COLUMN_ON);
|
||||
edit->column_highlight = 0;
|
||||
}
|
||||
}
|
||||
edit->force |= REDRAW_PAGE;
|
||||
ins_len = edit->curs1 - current;
|
||||
edit_cursor_move (edit, current - edit->curs1);
|
||||
g_free (buf);
|
||||
|
@ -1960,17 +1960,21 @@ edit_insert_column_of_text (WEdit * edit, unsigned char *data, int size, int wid
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
edit_insert_column_of_text_from_file (WEdit * edit, int file)
|
||||
edit_insert_column_of_text_from_file (WEdit * edit, int file,
|
||||
long *start_pos, long *end_pos, int *col1, int *col2)
|
||||
{
|
||||
long cursor;
|
||||
int i, col;
|
||||
int blocklen = -1, width;
|
||||
int col;
|
||||
int blocklen = -1, width = 0;
|
||||
unsigned char *data;
|
||||
|
||||
cursor = edit->curs1;
|
||||
col = edit_get_col (edit);
|
||||
data = g_malloc0 (TEMP_BUF_LEN);
|
||||
|
||||
while ((blocklen = mc_read (file, (char *) data, TEMP_BUF_LEN)) > 0)
|
||||
{
|
||||
int i;
|
||||
for (width = 0; width < blocklen; width++)
|
||||
{
|
||||
if (data[width] == '\n')
|
||||
@ -2018,9 +2022,13 @@ edit_insert_column_of_text_from_file (WEdit * edit, int file)
|
||||
edit_insert (edit, data[i]);
|
||||
}
|
||||
}
|
||||
*col1 = col;
|
||||
*col2 = col + width;
|
||||
*start_pos = cursor;
|
||||
*end_pos = edit->curs1;
|
||||
edit_cursor_move (edit, cursor - edit->curs1);
|
||||
g_free (data);
|
||||
edit->force |= REDRAW_PAGE;
|
||||
|
||||
return blocklen;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user