Skip to content
This repository has been archived by the owner on Dec 23, 2018. It is now read-only.

Commit

Permalink
Keybindings for next/previous calltip (fixes geany#1100)
Browse files Browse the repository at this point in the history
  • Loading branch information
vfaronov committed Jun 30, 2016
1 parent f9ea9c4 commit 9633450
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/geany.txt
Expand Up @@ -3368,6 +3368,14 @@ Complete word Ctrl-Space Shows the autocompleti
Show calltip Ctrl-Shift-Space Shows a calltip for the current function or
method.

Switch to previous calltip If there are multiple matching functions, shows
the calltip for the previous one (same as clicking
on the up arrow in the calltip).

Switch to next calltip If there are multiple matching functions, shows
the calltip for the next one (same as clicking on
the down arrow in the calltip).

Complete snippet Tab If you type a construct like if or for and press
this key, it will be completed with a matching
template.
Expand Down
13 changes: 13 additions & 0 deletions src/editor.c
Expand Up @@ -2062,6 +2062,19 @@ gboolean editor_show_calltip(GeanyEditor *editor, gint pos)
}


void editor_prev_calltip(void)
{
if (calltip.tag_index > 0)
calltip.tag_index -= 1;
}


void editor_next_calltip(void)
{
calltip.tag_index += 1;
}


gchar *editor_get_calltip_text(GeanyEditor *editor, const TMTag *tag)
{
GString *str;
Expand Down
4 changes: 4 additions & 0 deletions src/editor.h
Expand Up @@ -242,6 +242,10 @@ gboolean editor_complete_snippet(GeanyEditor *editor, gint pos);

gboolean editor_show_calltip(GeanyEditor *editor, gint pos);

void editor_prev_calltip(void);

void editor_next_calltip(void);

void editor_do_comment_toggle(GeanyEditor *editor);

gint editor_do_comment(GeanyEditor *editor, gint line, gboolean allow_empty_lines, gboolean toggle,
Expand Down
12 changes: 12 additions & 0 deletions src/keybindings.c
Expand Up @@ -406,6 +406,10 @@ static void init_default_kb(void)
GDK_space, GEANY_PRIMARY_MOD_MASK, "edit_autocomplete", _("Complete word"), NULL);
add_kb(group, GEANY_KEYS_EDITOR_CALLTIP, NULL,
GDK_space, GEANY_PRIMARY_MOD_MASK | GDK_SHIFT_MASK, "edit_calltip", _("Show calltip"), NULL);
add_kb(group, GEANY_KEYS_EDITOR_CALLTIP_PREV, NULL,
0, 0, "edit_calltip_prev", _("Switch to previous calltip"), NULL);
add_kb(group, GEANY_KEYS_EDITOR_CALLTIP_NEXT, NULL,
0, 0, "edit_calltip_next", _("Switch to next calltip"), NULL);
add_kb(group, GEANY_KEYS_EDITOR_WORDPARTCOMPLETION, NULL,
GDK_Tab, 0, "edit_wordpartcompletion", _("Word part completion"), NULL);
add_kb(group, GEANY_KEYS_EDITOR_MOVELINEUP, NULL,
Expand Down Expand Up @@ -2139,6 +2143,14 @@ static gboolean cb_func_editor_action(guint key_id)
case GEANY_KEYS_EDITOR_CALLTIP:
editor_show_calltip(doc->editor, -1);
break;
case GEANY_KEYS_EDITOR_CALLTIP_PREV:
editor_prev_calltip();
editor_show_calltip(doc->editor, -1);
break;
case GEANY_KEYS_EDITOR_CALLTIP_NEXT:
editor_next_calltip();
editor_show_calltip(doc->editor, -1);
break;
case GEANY_KEYS_EDITOR_CONTEXTACTION:
if (check_current_word(doc, FALSE))
on_context_action1_activate(GTK_MENU_ITEM(ui_lookup_widget(main_widgets.editor_menu,
Expand Down
2 changes: 2 additions & 0 deletions src/keybindings.h
Expand Up @@ -273,6 +273,8 @@ enum GeanyKeyBindingID
GEANY_KEYS_FORMAT_SENDTOCMD7, /**< Keybinding. */
GEANY_KEYS_FORMAT_SENDTOCMD8, /**< Keybinding. */
GEANY_KEYS_FORMAT_SENDTOCMD9, /**< Keybinding. */
GEANY_KEYS_EDITOR_CALLTIP_PREV, /**< Keybinding. */
GEANY_KEYS_EDITOR_CALLTIP_NEXT, /**< Keybinding. */
GEANY_KEYS_COUNT /* must not be used by plugins */
};

Expand Down

0 comments on commit 9633450

Please sign in to comment.