Erik de Castro Lopo wrote:
> Jiri,
>
> I've applied this patch to my own tree and I'm not sure its working
> as it should.
>
> When I have a document open (with default tabs width set to 4) and I use
> your menu item to set the document to 8 I expect the indent to switch
> from 4 to 8 but that doesn't happen.
>
> Did my cherry picking of this patch miss out something that was in one
> of the other patches?
Hmm, for some reason your code expected "_8" while on my machine I
was getting "4". The attached patch handles both variants.
Cheers,
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
=== modified file 'src/callbacks.c'
--- src/callbacks.c 2010-08-06 03:12:45 +0000
+++ src/callbacks.c 2010-08-08 02:36:59 +0000
@@ -2338,6 +2338,7 @@
{
GeanyDocument *doc;
const gchar *label;
+ int width;
if (ignore_callback || ! gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem)))
return;
@@ -2346,9 +2347,21 @@
g_return_if_fail(doc != NULL);
label = ui_menu_item_get_text(menuitem);
- /* the labels are of the form _1, _2, ... */
- g_return_if_fail(label && strlen(label) == 2 && label[1] >= '1' && label[1] <= '8');
-
- editor_set_indent(doc->editor, doc->editor->indent_type, label[1] - '0');
+
+ g_return_if_fail(label);
+ if (strlen(label) == 2)
+ {
+ /* the labels are of the form _1, _2, ... */
+ width = label[1] - '0' ;
+ }
+ else
+ {
+ /* the labels contain just the numbers as a string. */
+ width = label[0] - '0' ;
+ }
+
+ g_return_if_fail (width >= 1 && width <= 8);
+
+ editor_set_indent(doc->editor, doc->editor->indent_type, width);
}
_______________________________________________
Geany-devel mailing list
[email protected]
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel