Ticket #1484 (show bookmark)

* add keyboard shortcuts
    * add showing bookmarks

Signed-off-by: Ilia Maslakov <il.smind@google.com>

    * show '*' for bookmarked line (if line state showed)

Signed-off-by: Ilia Maslakov <il.smind@google.com>
This commit is contained in:
Daniel Borca 2009-08-18 10:05:50 +00:00 committed by Ilia Maslakov
parent ea219adec3
commit 9f2034d376
3 changed files with 24 additions and 4 deletions

View File

@ -361,11 +361,18 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
int i;
int utf8lag = 0;
unsigned int cur_line = 0;
int book_mark = 0;
char line_stat[LINE_STATE_WIDTH + 1];
if (row > edit->num_widget_lines - EDIT_TEXT_VERTICAL_OFFSET) {
return;
}
if (book_mark_query_color(edit, edit->start_line + row, BOOK_MARK_COLOR)) {
book_mark = BOOK_MARK_COLOR;
} else if (book_mark_query_color(edit, edit->start_line + row, BOOK_MARK_FOUND_COLOR)) {
book_mark = BOOK_MARK_FOUND_COLOR;
}
end_col -= EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width;
edit_get_syntax_color (edit, b - 1, &color);
@ -384,6 +391,9 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
memset(line_stat, ' ', LINE_STATE_WIDTH);
line_stat[LINE_STATE_WIDTH] = '\0';
}
if (book_mark_query_color (edit, cur_line, BOOK_MARK_COLOR)){
g_snprintf (line_stat, 2, "*");
}
}
if (col + 16 > -edit->start_col) {
@ -424,6 +434,12 @@ edit_draw_this_line (WEdit *edit, long b, long row, long start_col,
c = edit_get_utf (edit, q, &cw);
}
/* we don't use bg for mc - fg contains both */
if (book_mark) {
p->style |= book_mark << 16;
} else {
edit_get_syntax_color (edit, q, &color);
p->style |= color << 16;
}
edit_get_syntax_color (edit, q, &color);
p->style |= color << 16;
switch (c) {

View File

@ -122,6 +122,10 @@ static const edit_key_map_type common_key_map[] = {
{ ALT (KEY_BACKSPACE), CK_Delete_Word_Left },
{ ALT ('n'), CK_Toggle_Line_State },
{ ALT ('_'), CK_Toggle_Tab_TWS },
{ ALT ('k'), CK_Toggle_Bookmark },
{ ALT ('i'), CK_Prev_Bookmark },
{ ALT ('j'), CK_Next_Bookmark },
{ ALT ('o'), CK_Flush_Bookmarks },
{ XCTRL ('k'), CK_Delete_To_Line_End },
{ XCTRL ('l'), CK_Refresh },

View File

@ -422,10 +422,10 @@ static menu_entry EditMenu[] =
{' ', N_("C&ut to clipfile S-Del"), NULL_HOTKEY, menu_xcut_cmd},
{' ', N_("&Paste from clipfile S-Ins"), NULL_HOTKEY, menu_xpaste_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("Toggle bookmar&k "), NULL_HOTKEY, menu_toggle_bookmark_cmd},
{' ', N_("&Next bookmark "), NULL_HOTKEY, menu_next_bookmark_cmd},
{' ', N_("Pre&v bookmark "), NULL_HOTKEY, menu_prev_bookmark_cmd},
{' ', N_("&Flush bookmark "), NULL_HOTKEY, menu_flush_bookmark_cmd},
{' ', N_("Toggle bookmar&k M-k"), NULL_HOTKEY, menu_toggle_bookmark_cmd},
{' ', N_("&Next bookmark M-j"), NULL_HOTKEY, menu_next_bookmark_cmd},
{' ', N_("Pre&v bookmark M-i"), NULL_HOTKEY, menu_prev_bookmark_cmd},
{' ', N_("&Flush bookmark M-o"), NULL_HOTKEY, menu_flush_bookmark_cmd},
{' ', "", NULL_HOTKEY, 0},
{' ', N_("&Undo C-u"), NULL_HOTKEY, menu_undo_cmd},
{' ', "", NULL_HOTKEY, 0},