Add sci_get_tab_width() to the API, and use it to get the correct
display tab width in the Export plugin. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2866 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
664a1d77f0
commit
b74eb47577
@ -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>
|
||||
|
@ -409,7 +409,7 @@ static void write_latex_file(GeanyDocument *doc, const gchar *filename, gboolean
|
||||
}
|
||||
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 */
|
||||
|
@ -707,6 +707,8 @@ void on_editor_notification(GtkWidget *widget, gint scn, gpointer lscn, gpointer
|
||||
}
|
||||
|
||||
|
||||
/* 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)
|
||||
|
@ -70,7 +70,9 @@ typedef struct GeanyIndentPrefs
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -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 @@ typedef struct ScintillaFuncs
|
||||
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;
|
||||
|
||||
|
@ -152,7 +152,8 @@ static ScintillaFuncs sci_funcs = {
|
||||
&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 = {
|
||||
|
@ -637,6 +637,7 @@ void sci_set_tab_width(ScintillaObject * sci, gint width)
|
||||
}
|
||||
|
||||
|
||||
/** Get display tab width. */
|
||||
gint sci_get_tab_width(ScintillaObject * sci)
|
||||
{
|
||||
return SSM(sci, SCI_GETTABWIDTH, 0, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user