its work! wow!

This commit is contained in:
Ilia Maslakov 2009-05-05 18:44:51 +00:00
parent 279787d2fc
commit e67dd226e0
3 changed files with 11 additions and 17 deletions

View File

@ -239,7 +239,7 @@ book_mark_collapse_find (GList * list, int line)
cl = l;
while (cl) {
collapsed = (struct collapsed_lines *) cl->data;
if ( collapsed->start_line>=line && line <= collapsed->end_line )
if ( collapsed->start_line <= line && line <= collapsed->end_line )
return cl;
cl = g_list_next (cl);
}
@ -269,15 +269,13 @@ book_mark_collapse_insert (GList *list, const int start_line, const int end_line
int sl = 0;
int el = 0;
mc_log("book_mark_collapse_insert \n");
while ( link ) {
newlink = g_list_previous (link);
q = (struct collapsed_lines *) link->data;
sl = q->start_line;
el = q->end_line;
mc_log("link\n");
/*if (((sl == start_line) || (el == end_line) ||
if (((sl == start_line) || (el == end_line) ||
(sl == end_line) || (el == start_line)) ||
((sl < start_line) && (el > start_line) && (el < end_line)) ||
((sl > start_line) && (sl < end_line) && (el > end_line))) {
@ -285,7 +283,6 @@ book_mark_collapse_insert (GList *list, const int start_line, const int end_line
tmp = g_list_remove_link (list, link);
g_list_free_1 (link);
}
*/
link = newlink;
}
return list;
@ -311,12 +308,10 @@ int book_mark_collapse_query (GList * list, const int line,
cl = book_mark_collapse_find (list, line);
if ( cl ){
p = (struct collapsed_lines *) cl->data;
if ((p->start_line >= line) && (line <= p->end_line) ) {
*start_line = p->start_line;
*end_line = p->end_line;
*state = p->state;
return 1;
}
*start_line = p->start_line;
*end_line = p->end_line;
*state = p->state;
return 1;
}
return 0;
}

View File

@ -2689,7 +2689,7 @@ edit_execute_cmd (WEdit *edit, int command, int char_for_insertion)
}
unsigned int end_line = start_line + lines_selected;
mc_log("lines_selected:%ld\n", lines_selected);
edit->collapsed = book_mark_collapse_insert (edit->collapsed, start_line, end_line, 1);
edit->collapsed = book_mark_collapse_insert (edit->collapsed, start_line, end_line, 0);
}
edit->force |= REDRAW_PAGE;
break;

View File

@ -374,16 +374,16 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
}
switch ( collapse_state ) {
case C_LINES_ELAPSED:
line_stat[0] = '-';
g_snprintf (line_stat, 4, "[-]");
break;
case C_LINES_COLLAPSED:
line_stat[0] = '+';
g_snprintf (line_stat, 4, "[+]");
break;
case C_LINES_MIDDLE_E:
line_stat[0] = '|';
g_snprintf (line_stat, 3, " |");
break;
case C_LINES_LAST:
line_stat[0] = '_';
g_snprintf (line_stat, 3, " \\");
break;
}
}
@ -613,7 +613,6 @@ render_edit_text (WEdit * edit, long start_row, long start_column, long end_row,
if (key_pending (edit))
goto exit_render;
cur_line = edit->start_line + row;
mc_log("REDRAW_PAGE cur_line:%i\n", cur_line);
collapse_state = book_mark_get_collapse_state(edit->collapsed, cur_line);
if ( collapse_state != C_LINES_MIDDLE_C ) {
edit_draw_this_line (edit, b, row, start_column, end_column, collapse_state);