Add editor_get_indent_prefs() to the API.
Make editor_get_indent_prefs() return default prefs if editor is NULL. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/custom-tab-width@2861 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
2bc72a08c3
commit
a6eac00cc1
@ -6,6 +6,10 @@
|
||||
* src/editor.c:
|
||||
Remove opening-brace indent code from get_indent() as it's now in
|
||||
get_brace_indent().
|
||||
* src/plugindata.h, src/plugins.c, src/editor.c:
|
||||
Add editor_get_indent_prefs() to the API.
|
||||
Make editor_get_indent_prefs() return default prefs if editor is
|
||||
NULL.
|
||||
|
||||
|
||||
2008-08-05 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
11
src/editor.c
11
src/editor.c
@ -753,7 +753,7 @@ get_whitespace(const GeanyIndentPrefs *iprefs, gint width)
|
||||
static const GeanyIndentPrefs *
|
||||
get_default_indent_prefs(void)
|
||||
{
|
||||
/* In future this might depend on project or filetype. */
|
||||
/* In future this might depend on the current project. */
|
||||
return editor_prefs.indentation;
|
||||
}
|
||||
|
||||
@ -761,16 +761,19 @@ get_default_indent_prefs(void)
|
||||
/** Get the indentation prefs for the editor.
|
||||
* In future, the prefs might be different according to project or filetype.
|
||||
* @warning Always get a fresh result instead of keeping a pointer to it if the editor
|
||||
* settings may have changed, or if this function has been called for a different @a editor. */
|
||||
* settings may have changed, or if this function has been called for a different @a editor.
|
||||
* @param editor The editor, or @c NULL to get the default indent prefs.
|
||||
* @return The indent prefs. */
|
||||
const GeanyIndentPrefs *
|
||||
editor_get_indent_prefs(GeanyEditor *editor)
|
||||
{
|
||||
static GeanyIndentPrefs iprefs;
|
||||
|
||||
g_return_val_if_fail(editor != NULL, NULL);
|
||||
|
||||
iprefs = *get_default_indent_prefs();
|
||||
|
||||
if (!editor)
|
||||
return &iprefs;
|
||||
|
||||
iprefs.type = editor->indent_type;
|
||||
if (!editor->auto_indent)
|
||||
iprefs.auto_indent_mode = GEANY_AUTOINDENT_NONE;
|
||||
|
@ -444,6 +444,8 @@ typedef struct EditorFuncs
|
||||
void (*set_indicator) (struct GeanyEditor *editor, gint start, gint end);
|
||||
void (*set_indicator_on_line) (struct GeanyEditor *editor, gint line);
|
||||
void (*clear_indicators) (struct GeanyEditor *editor);
|
||||
|
||||
const struct GeanyIndentPrefs* (*get_indent_prefs)(struct GeanyEditor *editor);
|
||||
/* Remember to convert any GeanyDocument or ScintillaObject pointers in any
|
||||
* appended functions to GeanyEditor pointers. */
|
||||
}
|
||||
|
@ -114,7 +114,8 @@ static DocumentFuncs doc_funcs = {
|
||||
static EditorFuncs editor_funcs = {
|
||||
&editor_set_indicator,
|
||||
&editor_set_indicator_on_line,
|
||||
&editor_clear_indicators
|
||||
&editor_clear_indicators,
|
||||
&editor_get_indent_prefs
|
||||
};
|
||||
|
||||
static ScintillaFuncs sci_funcs = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user