add more...

This commit is contained in:
Ilia Maslakov 2009-05-04 14:31:54 +00:00
parent eac001af97
commit 2377115b8e
6 changed files with 41 additions and 13 deletions

View File

@ -230,7 +230,7 @@ void book_mark_dec (WEdit * edit, int line)
appended after each other and the last one is always the one found
by collapsed_found() i.e. last in is the one seen */
static inline struct collapsed_lines *double_collapsed (WEdit * edit, struct collapsed_lines *p)
static inline struct collapsed_lines *double_collapse (WEdit * edit, struct collapsed_lines *p)
{
(void) edit;
@ -241,7 +241,7 @@ static inline struct collapsed_lines *double_collapsed (WEdit * edit, struct col
}
/* returns the first collapsed region on or before this line */
struct collapsed_lines *collapsed_find (WEdit * edit, int start_line)
struct collapsed_lines *collapse_find (WEdit * edit, int start_line)
{
struct collapsed_lines *p;
if (!edit->collapsed) {
@ -257,11 +257,11 @@ struct collapsed_lines *collapsed_find (WEdit * edit, int start_line)
if (p->next) {
if (p->next->start_line > start_line) {
edit->collapsed = p;
return double_collapsed (edit, p);
return double_collapse (edit, p);
}
} else {
edit->collapsed = p;
return double_collapsed (edit, p);
return double_collapse (edit, p);
}
}
}
@ -273,11 +273,11 @@ struct collapsed_lines *collapsed_find (WEdit * edit, int start_line)
if (p->next) {
if (p->next->start_line > start_line) {
edit->collapsed = p;
return double_collapsed (edit, p);
return double_collapse (edit, p);
}
} else {
edit->collapsed = p;
return double_collapsed (edit, p);
return double_collapse (edit, p);
}
}
}
@ -287,12 +287,13 @@ struct collapsed_lines *collapsed_find (WEdit * edit, int start_line)
/* insert a collapsed at this line */
void
collapsed_insert (WEdit *edit,
collapse_insert (WEdit *edit,
const unsigned long start_line,
const unsigned long end_line, int state)
{
struct collapsed_lines *p, *q;
p = collapsed_find (edit, start_line);
mc_log("collapse_insert: %ld, %ld\n", start_line, end_line);
p = collapse_find (edit, start_line);
if (p->start_line == start_line) {
/* already exists */
}
@ -317,7 +318,7 @@ collapsed_insert (WEdit *edit,
* return start_line, end_line if found region
*
*/
int collapsed_query (WEdit * edit, const unsigned long line,
int collapse_query (WEdit * edit, const unsigned long line,
unsigned long *start_line,
unsigned long *end_line,
int *state)
@ -330,7 +331,7 @@ int collapsed_query (WEdit * edit, const unsigned long line,
if (!edit->collapsed)
return 0;
for (p = collapsed_find (edit, line); p; p = p->prev) {
for (p = collapse_find (edit, line); p; p = p->prev) {
if (p->start_line != line)
return 0;
*start_line = p->start_line;

View File

@ -2667,6 +2667,22 @@ edit_execute_cmd (WEdit *edit, int command, int char_for_insertion)
edit_mark_cmd (edit, 1);
break;
case CK_Toggle_Line_Status:
option_line_status ^= 1;
if ( option_line_status ) {
option_line_status_width = LINE_STATUS_WIDTH;
} else {
option_line_status_width = 0;
}
edit->force |= REDRAW_PAGE;
break;
case CK_Add_Collapse_Region:
if ( edit->mark1 != edit->mark2 ) {
collapse_insert (edit, edit->curs_line, edit->curs_line + 10, 1);
}
break;
case CK_Toggle_Bookmark:
book_mark_clear (edit, edit->curs_line, BOOK_MARK_FOUND_COLOR);
if (book_mark_query_color (edit, edit->curs_line, BOOK_MARK_COLOR))

View File

@ -239,11 +239,11 @@ void book_mark_flush (WEdit * edit, int c);
void book_mark_inc (WEdit * edit, int line);
void book_mark_dec (WEdit * edit, int line);
struct collapsed_lines *collapsed_find (WEdit * edit, int start_line);
void collapsed_insert (WEdit *edit,
struct collapsed_lines *collapse_find (WEdit * edit, int start_line);
void collapse_insert (WEdit *edit,
const unsigned long start_line,
const unsigned long end_line, int state);
int collapsed_query (WEdit * edit, const unsigned long line,
int collapse_query (WEdit * edit, const unsigned long line,
unsigned long *start_line,
unsigned long *end_line,
int *state);

View File

@ -101,6 +101,8 @@
#define CK_User_Menu 425
#define CK_Find_Definition 426
#define CK_Add_Collapse_Region 428
/* application control */
#define CK_Save_Desktop 451
#define CK_New_Window 452
@ -112,6 +114,7 @@
#define CK_Maximize 458
#define CK_Toggle_Syntax 480
#define CK_Toggle_Line_Status 490
/* macro */
#define CK_Begin_Record_Macro 501

View File

@ -348,6 +348,9 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
int i;
int utf8lag = 0;
unsigned long sl,el;
int stat;
edit_get_syntax_color (edit, b - 1, &color);
q = edit_move_forward3 (edit, b, start_col - edit->start_col, 0);
start_col_real = (col =
@ -365,6 +368,9 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
if (book_mark_query_color (edit, cur_line, BOOK_MARK_COLOR)){
g_snprintf (line_stat, 2, "*");
}
if (collapse_query (edit, cur_line, &sl, &el, &stat)){
g_snprintf (line_stat, 2, "+");
}
}
if (col + 16 > -edit->start_col) {
eval_marks (edit, &m1, &m2);

View File

@ -114,6 +114,7 @@ static const edit_key_map_type common_key_map[] = {
{ ALT ('-'), CK_Load_Prev_File },
{ ALT ('='), CK_Load_Next_File },
{ ALT (KEY_BACKSPACE), CK_Delete_Word_Left },
{ ALT ('n'), CK_Toggle_Line_Status },
{ XCTRL ('k'), CK_Delete_To_Line_End },
{ XCTRL ('l'), CK_Refresh },
@ -124,6 +125,7 @@ static const edit_key_map_type common_key_map[] = {
{ XCTRL ('q'), CK_Insert_Literal },
{ XCTRL ('a'), CK_Execute_Macro },
{ XCTRL ('r'), CK_Begin_End_Macro },
{ XCTRL ('e'), CK_Add_Collapse_Region },
{ KEY_F (1), CK_Help },
{ KEY_F (2), CK_Save },