mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
add bookmark_collapse_inc
This commit is contained in:
parent
9a1f3a3ac5
commit
d323924979
@ -346,3 +346,26 @@ int book_mark_get_collapse_state (GList * list, const int line)
|
|||||||
return C_LINES_LAST;
|
return C_LINES_LAST;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* shift down bookmarks after this line */
|
||||||
|
void book_mark_collapse_inc (GList * list, int line)
|
||||||
|
{
|
||||||
|
GList *cl, *l;
|
||||||
|
struct collapsed_lines *collapsed;
|
||||||
|
l = list;
|
||||||
|
if (!l)
|
||||||
|
return;
|
||||||
|
l = g_list_first (list);
|
||||||
|
cl = l;
|
||||||
|
while (cl) {
|
||||||
|
collapsed = (struct collapsed_lines *) cl->data;
|
||||||
|
if ( collapsed->start_line >= line ) {
|
||||||
|
collapsed->start_line++;
|
||||||
|
collapsed->end_line++;
|
||||||
|
} else if ( collapsed->end_line >= line ){
|
||||||
|
collapsed->end_line++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1019,6 +1019,8 @@ edit_insert (WEdit *edit, int c)
|
|||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
if (edit->book_mark)
|
if (edit->book_mark)
|
||||||
book_mark_inc (edit, edit->curs_line);
|
book_mark_inc (edit, edit->curs_line);
|
||||||
|
if (edit->collapsed)
|
||||||
|
book_mark_collapse_inc(edit->collapsed, edit->curs_line);
|
||||||
edit->curs_line++;
|
edit->curs_line++;
|
||||||
edit->total_lines++;
|
edit->total_lines++;
|
||||||
edit->force |= REDRAW_LINE_ABOVE | REDRAW_AFTER_CURSOR;
|
edit->force |= REDRAW_LINE_ABOVE | REDRAW_AFTER_CURSOR;
|
||||||
@ -1064,6 +1066,8 @@ void edit_insert_ahead (WEdit * edit, int c)
|
|||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
if (edit->book_mark)
|
if (edit->book_mark)
|
||||||
book_mark_inc (edit, edit->curs_line);
|
book_mark_inc (edit, edit->curs_line);
|
||||||
|
if (edit->collapsed)
|
||||||
|
book_mark_collapse_inc(edit->collapsed, edit->curs_line);
|
||||||
edit->total_lines++;
|
edit->total_lines++;
|
||||||
edit->force |= REDRAW_AFTER_CURSOR;
|
edit->force |= REDRAW_AFTER_CURSOR;
|
||||||
}
|
}
|
||||||
|
@ -256,6 +256,7 @@ int book_mark_collapse_query (GList *list, const int line,
|
|||||||
int *end_line,
|
int *end_line,
|
||||||
int *state);
|
int *state);
|
||||||
int book_mark_get_collapse_state (GList *list, const int line);
|
int book_mark_get_collapse_state (GList *list, const int line);
|
||||||
|
void book_mark_collapse_inc (GList * list, int line);
|
||||||
|
|
||||||
int line_is_blank (WEdit *edit, long line);
|
int line_is_blank (WEdit *edit, long line);
|
||||||
int edit_indent_width (WEdit *edit, long p);
|
int edit_indent_width (WEdit *edit, long p);
|
||||||
|
Loading…
Reference in New Issue
Block a user