Skip to content

Commit

Permalink
Addons: Fix Wordwrap wrong keybinding use
Browse files Browse the repository at this point in the history
Instead of hardcoding the count of previously defined keybindings in
the Addons plugin, use the already available enum counter.
  • Loading branch information
eht16 committed Dec 11, 2022
1 parent 6314f99 commit e736118
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
14 changes: 1 addition & 13 deletions addons/src/addons.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,6 @@ GeanyPlugin *geany_plugin = NULL;
GeanyData *geany_data = NULL;


/* Keybinding(s) */
enum
{
KB_FOCUS_BOOKMARK_LIST,
KB_FOCUS_TASKS,
KB_UPDATE_TASKS,
KB_XMLTAGGING,
KB_COPYFILEPATH,
KB_COUNT
};


typedef struct
{
/* general settings */
Expand Down Expand Up @@ -137,7 +125,7 @@ static gboolean ao_editor_notify_cb(GObject *object, GeanyEditor *editor,
SCNotification *nt, gpointer data)
{
ao_bookmark_list_update_marker(ao_info->bookmarklist, editor, nt);

ao_mark_editor_notify(ao_info->markword, editor, nt);

ao_color_tip_editor_notify(ao_info->colortip, editor, nt);
Expand Down
11 changes: 11 additions & 0 deletions addons/src/addons.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
#ifndef ADDONS_H
#define ADDONS_H 1

/* Keybinding(s) */
enum
{
KB_FOCUS_BOOKMARK_LIST,
KB_FOCUS_TASKS,
KB_UPDATE_TASKS,
KB_XMLTAGGING,
KB_COPYFILEPATH,
KB_COUNT
};


extern GeanyPlugin *geany_plugin;
extern GeanyData *geany_data;
Expand Down
2 changes: 1 addition & 1 deletion addons/src/ao_wrapwords.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void enclose_text_action (guint key_id)
if (sci_get_selected_text_length (sci_obj) < 2)
return;

key_id -= 4;
key_id -= KB_COUNT;
selection_end = sci_get_selection_end (sci_obj);

sci_start_undo_action (sci_obj);
Expand Down

0 comments on commit e736118

Please sign in to comment.