mirror of
https://github.com/MidnightCommander/mc
synced 2025-02-04 01:14:17 +03:00
now it work! wow...
This commit is contained in:
parent
7f8e057b6a
commit
8ae9d0c263
@ -289,6 +289,36 @@ book_mark_collapse_insert (GList *list, const int start_line, const int end_line
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
book_mark_collapse (GList *list, const int line)
|
||||
{
|
||||
GList *cl;
|
||||
collapsed_lines *p;
|
||||
int collapse_state;
|
||||
|
||||
collapse_state = book_mark_get_collapse_state(list, line, NULL);
|
||||
cl = book_mark_collapse_find (list, line);
|
||||
switch ( collapse_state ) {
|
||||
case C_LINES_ELAPSED:
|
||||
if ( cl ) {
|
||||
p = (collapsed_lines *) cl->data;
|
||||
p->state = 1;
|
||||
}
|
||||
break;
|
||||
case C_LINES_COLLAPSED:
|
||||
if ( cl ) {
|
||||
p = (collapsed_lines *) cl->data;
|
||||
p->state = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* returns true if a collapsed exists at this line
|
||||
* return start_line, end_line if found region
|
||||
*
|
||||
@ -325,11 +355,11 @@ int book_mark_get_collapse_state (GList * list, const int line,
|
||||
int c = 0;
|
||||
|
||||
c = book_mark_collapse_query (list, line, &start_line, &end_line, &state);
|
||||
mc_log("l: %i, start_line:%i, end_line:%i", line, start_line, end_line);
|
||||
if ( c == 0 )
|
||||
return C_LINES_DEFAULT;
|
||||
|
||||
if ( cl ) {
|
||||
mc_log("set cl");
|
||||
cl->start_line = start_line;
|
||||
cl->end_line = end_line;
|
||||
cl->state = state;
|
||||
@ -341,18 +371,16 @@ int book_mark_get_collapse_state (GList * list, const int line,
|
||||
else
|
||||
return C_LINES_ELAPSED;
|
||||
}
|
||||
if ( line > start_line && line< end_line ) {
|
||||
if ( line > start_line && line < end_line ) {
|
||||
if ( state )
|
||||
return C_LINES_MIDDLE_C;
|
||||
else
|
||||
return C_LINES_MIDDLE_E;
|
||||
}
|
||||
if ( line == end_line ) {
|
||||
if ( state )
|
||||
return C_LINES_MIDDLE_C;
|
||||
else
|
||||
return C_LINES_LAST;
|
||||
return C_LINES_LAST;
|
||||
}
|
||||
return C_LINES_DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
@ -415,7 +443,7 @@ int book_mark_get_shiftup (GList * list, int line)
|
||||
cl = g_list_first (list);
|
||||
while (cl) {
|
||||
collapsed = (collapsed_lines *) cl->data;
|
||||
if ( line >= collapsed->start_line && collapsed->state ) {
|
||||
if ( line > collapsed->start_line && collapsed->state ) {
|
||||
res += collapsed->end_line - collapsed->start_line - 1;
|
||||
}
|
||||
cl = g_list_next (cl);
|
||||
|
@ -2697,9 +2697,13 @@ edit_execute_cmd (WEdit *edit, int command, int char_for_insertion)
|
||||
start_line = edit->curs_line + upto_start;
|
||||
}
|
||||
edit->highlight = 0;
|
||||
edit->mark1 = 0;
|
||||
edit->mark2 = 0;
|
||||
unsigned int end_line = start_line + lines_selected - 1;
|
||||
if ( abs (end_line - start_line) > 1 )
|
||||
edit->collapsed = book_mark_collapse_insert (edit->collapsed, start_line, end_line, 1);
|
||||
} else {
|
||||
book_mark_collapse (edit->collapsed, edit->curs_line);
|
||||
}
|
||||
edit->force |= REDRAW_PAGE;
|
||||
break;
|
||||
|
@ -361,7 +361,11 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
|
||||
if ( option_line_status ) {
|
||||
cur_line = edit->start_line + row;
|
||||
collapse_state = book_mark_get_collapse_state(edit->collapsed, cur_line, NULL);
|
||||
/* not show line if in middle collapsed region */
|
||||
if ( collapse_state == C_LINES_MIDDLE_C )
|
||||
return;
|
||||
skip_rows = book_mark_get_shiftup(edit->collapsed, cur_line);
|
||||
mc_log("line: %i, skip: %i state: %i\n", cur_line, skip_rows, collapse_state);
|
||||
if ( cur_line <= edit->total_lines ) {
|
||||
g_snprintf (line_stat, LINE_STATUS_WIDTH + 1, "%7ld ", cur_line + 1);
|
||||
} else {
|
||||
@ -388,7 +392,7 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
|
||||
if (col + 16 > -edit->start_col) {
|
||||
eval_marks (edit, &m1, &m2);
|
||||
|
||||
if (row <= edit->total_lines - edit->start_line) {
|
||||
if (row - skip_rows <= edit->total_lines - edit->start_line) {
|
||||
long tws = 0;
|
||||
if (use_colors && visible_tws) {
|
||||
tws = edit_eol (edit, b);
|
||||
|
Loading…
x
Reference in New Issue
Block a user