-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New IncDec plugin for Geany #1351
base: master
Are you sure you want to change the base?
Conversation
… decrement number at the cursor, or to the right of the cursor (on the same line). By default, typing Shift-+ will increment the next number, and typing Shift-- will decrement the next number. You can also increment and decrement number many times by typing Shift-*. The number can be at the cursor, or to the right of the cursor (on the same line). Numbers can be negative and positive, and can be in decimal or hexadecimal format (hexadecimal number start with 0x). You can customize those defaults keys on the preferences, under the Keybindings tab by setting the *IncDec* keybinding. An item *Increment or Decrement number* is also added in the Editor Popup Menu, it can be hidden by changing the Plugins Preferences.
This pull request replace previous #1337 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
I added a few minor remarks.
Additionally, could you please update the MAINTAINERS
file in the root directory?
Thanks.
@@ -72,6 +72,7 @@ GP_CHECK_VIMODE | |||
GP_CHECK_WEBHELPER | |||
GP_CHECK_WORKBENCH | |||
GP_CHECK_XMLSNIPPETS | |||
GP_CHECK_INCDEC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the rest of the list is sorted alphabetically, could you move your plugin after GP_CHECK_GITCHANGEBAR
?
{ | ||
if (plugin_data._dialog) | ||
{ | ||
gtk_widget_destroy (GTK_WIDGET (plugin_data._dialog)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and in some other places you use a space between identifier and opening braces, in other places not.
I suggest to use a consistent style.
|
||
configuration_apply(); | ||
|
||
g_signal_connect(plugin_data._menu_item_change_number, "activate", G_CALLBACK(on_change_number_x), NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and in some other places, there is mixed indentation, sometimes spaces sometimes tabs.
I suggest to use a consistent style.
|
||
g_snprintf(format_buf, sizeof(format_buf)-1, "%%0%d%c", format_length, use_hexa ? ( hexaCase == HEXA_CASE_UPPER ? 'X' : 'x' ) : 'd'); | ||
|
||
if ((buf = g_strdup_printf(format_buf, guessed_number))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gcc warns here:
incdec-plugin.c: In function 'on_change_number':
incdec-plugin.c:374:44: warning: format not a string literal, argument types not checked [-Wformat-nonliteral]
374 | if ((buf = g_strdup_printf(format_buf, guessed_number)))
| ^~~~~~~~~~
Maybe this can be fixed.
load_config(); | ||
|
||
key_group = plugin_set_key_group (geany_plugin, "incdec", KB_COUNT, on_change_number_callback); | ||
keybindings_set_item (key_group, KB_INCREMENT_NUMBER, NULL, GDK_KEY_KP_Add, GDK_SHIFT_MASK, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GDK_KEY_KP_Add is specific for the + key on the numpad, I think.
The ReadMe mentions Shift-+ and this does not work on my system (German keyboard).
I think this won't work on most keyboard layouts where +, - and * are interpreted with Shift to another key.
So, maybe just make the README (and possibly other references) more explicit.
IncDec is a plugin for Geany that provides shortcuts to increment an decrement
number at the cursor, or to the right of the cursor (on the same line).
By default, typing Shift-+ will increment the next number, and typing Shift-- will decrement the next number.
You can also increment and decrement number many times by typing Shift-*. The number can be at the cursor, or to the right of the cursor (on the same line). Numbers can be negative and positive, and can be in decimal or hexadecimal format (hexadecimal number start with 0x).
You can customize those defaults keys on the preferences, under the Keybindings tab by setting the IncDec keybinding.
An item Increment or Decrement number is also added in the Editor Popup Menu, it can be hidden by changing the Plugins Preferences.