Revision: 2866 http://geany.svn.sourceforge.net/geany/?rev=2866&view=rev Author: ntrel Date: 2008-08-08 14:46:31 +0000 (Fri, 08 Aug 2008)
Log Message: ----------- Add sci_get_tab_width() to the API, and use it to get the correct display tab width in the Export plugin.
Modified Paths: -------------- trunk/ChangeLog trunk/plugins/export.c trunk/src/editor.c trunk/src/editor.h trunk/src/plugindata.h trunk/src/plugins.c trunk/src/sciwrappers.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-08-08 14:33:23 UTC (rev 2865) +++ trunk/ChangeLog 2008-08-08 14:46:31 UTC (rev 2866) @@ -3,6 +3,10 @@ * src/printing.c: Fix using correct display tab width when the Tabs & Spaces indent type is set. + * src/sciwrappers.c, src/plugindata.h, src/plugins.c, src/editor.c, + src/editor.h, plugins/export.c: + Add sci_get_tab_width() to the API, and use it to get the correct + display tab width in the Export plugin.
2008-08-08 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/plugins/export.c =================================================================== --- trunk/plugins/export.c 2008-08-08 14:33:23 UTC (rev 2865) +++ trunk/plugins/export.c 2008-08-08 14:46:31 UTC (rev 2866) @@ -409,7 +409,7 @@ } case '\t': { - gint tab_width = p_editor->get_indent_prefs(editor)->tab_width; + gint tab_width = p_sci->get_tab_width(editor->sci); gint tab_stop = tab_width - (column % tab_width);
column += tab_stop - 1; /* -1 because we add 1 at the end of the loop */
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2008-08-08 14:33:23 UTC (rev 2865) +++ trunk/src/editor.c 2008-08-08 14:46:31 UTC (rev 2866) @@ -707,6 +707,8 @@ }
+/* Note: this is the same as sci_get_tab_width(), but is still useful when you don't have + * a scintilla pointer. */ static gint get_tab_width(const GeanyIndentPrefs *indent_prefs) { if (indent_prefs->type == GEANY_INDENT_TYPE_BOTH)
Modified: trunk/src/editor.h =================================================================== --- trunk/src/editor.h 2008-08-08 14:33:23 UTC (rev 2865) +++ trunk/src/editor.h 2008-08-08 14:46:31 UTC (rev 2866) @@ -70,7 +70,9 @@ { gint width; /**< Indent width. */ GeanyIndentType type; /**< Whether to use tabs, spaces or both to indent. */ - gint tab_width; /**< Width of a tab, when using GEANY_INDENT_TYPE_BOTH. */ + /** Width of a tab, but only when using GEANY_INDENT_TYPE_BOTH. + * To get the display tab width, use sci_get_tab_width(). */ + gint tab_width; GeanyAutoIndent auto_indent_mode; gboolean detect_type; }
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2008-08-08 14:33:23 UTC (rev 2865) +++ trunk/src/plugindata.h 2008-08-08 14:46:31 UTC (rev 2866) @@ -36,7 +36,7 @@
/* The API version should be incremented whenever any plugin data types below are * modified or appended to. */ -static const gint api_version = 84; +static const gint api_version = 85;
/* The ABI version should be incremented whenever existing fields in the plugin * data types below have to be changed or reordered. It should stay the same if fields @@ -267,6 +267,7 @@ gchar (*get_char_at) (struct _ScintillaObject *sci, gint pos); gint (*get_current_line) (struct _ScintillaObject *sci); gboolean (*can_copy) (struct _ScintillaObject *sci); + gint (*get_tab_width) (struct _ScintillaObject *sci); } ScintillaFuncs;
Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2008-08-08 14:33:23 UTC (rev 2865) +++ trunk/src/plugins.c 2008-08-08 14:46:31 UTC (rev 2866) @@ -152,7 +152,8 @@ &sci_get_style_at, &sci_get_char_at, &sci_get_current_line, - &sci_can_copy + &sci_can_copy, + &sci_get_tab_width };
static TemplateFuncs template_funcs = {
Modified: trunk/src/sciwrappers.c =================================================================== --- trunk/src/sciwrappers.c 2008-08-08 14:33:23 UTC (rev 2865) +++ trunk/src/sciwrappers.c 2008-08-08 14:46:31 UTC (rev 2866) @@ -637,6 +637,7 @@ }
+/** Get display tab width. */ gint sci_get_tab_width(ScintillaObject * sci) { return SSM(sci, SCI_GETTABWIDTH, 0, 0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.