Make Version Diff plugin set the indent type for diffs based on the

current file's indent type.
Add editor_set_indent_type() to the API.
Note: uses editor.h plugindata.h include.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3194 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-11-08 13:32:55 +00:00
parent 1f1cbd4523
commit 12e29d7ebd
5 changed files with 23 additions and 5 deletions

View File

@ -1,7 +1,12 @@
2008-11-08 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/editor.c:
* src/editor.c, doc/geany.txt, doc/geany.html:
Make Ctrl-click go to matching brace if there's no current word.
* plugins/vcdiff.c, src/editor.c, src/plugindata.h, src/plugins.c:
Make Version Diff plugin set the indent type for diffs based on the
current file's indent type.
Add editor_set_indent_type() to the API.
Note: uses editor.h plugindata.h include.
2008-11-07 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -279,6 +279,9 @@ static void show_output(const gchar *std_output, const gchar *utf8_name_prefix,
}
if (text)
{
GeanyIndentType indent_type =
p_document->get_current()->editor->indent_type;
doc = p_document->find_by_filename(filename);
if (doc == NULL)
{
@ -293,6 +296,7 @@ static void show_output(const gchar *std_output, const gchar *utf8_name_prefix,
gtk_notebook_set_current_page(book, page);
p_document->set_text_changed(doc, FALSE);
}
p_editor->set_indent_type(doc->editor, indent_type);
p_document->set_encoding(doc,
force_encoding ? force_encoding : detect_enc);

View File

@ -3818,7 +3818,9 @@ void editor_set_line_wrapping(GeanyEditor *editor, gboolean wrap)
}
/* Also sets indent width, tab width. */
/** Set the indent type for @a editor.
* @param editor Editor.
* @param type Indent type. */
void editor_set_indent_type(GeanyEditor *editor, GeanyIndentType type)
{
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);

View File

@ -35,13 +35,16 @@
#ifndef PLUGINDATA_H
#define PLUGINDATA_H
#include "editor.h" /* GeanyIndentType */
/* Note: We use enum instead of 'static const gint' to allow its use in global variable
* initializing, otherwise we get errors like:
* error: initializer element is not constant */
enum {
/** The Application Programming Interface (API) version, incremented
* whenever any plugin data types are modified or appended to. */
GEANY_API_VERSION = 105,
GEANY_API_VERSION = 106,
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered. */
@ -476,12 +479,15 @@ typedef struct EditorFuncs
const struct GeanyIndentPrefs* (*get_indent_prefs)(struct GeanyEditor *editor);
struct _ScintillaObject* (*create_widget)(struct GeanyEditor *editor);
/* Remember to convert any GeanyDocument or ScintillaObject pointers in any
* appended functions to GeanyEditor pointers. */
void (*set_indicator_full) (struct GeanyEditor *editor, gint indic, gint start, gint end);
void (*set_indicator_on_line_full) (struct GeanyEditor *editor, gint indic, gint line);
void (*clear_indicators_full) (struct GeanyEditor *editor, gint indic);
void (*set_indent_type)(struct GeanyEditor *editor, GeanyIndentType type);
/* Remember to convert any GeanyDocument or ScintillaObject pointers in any
* appended functions to GeanyEditor pointers. */
}
EditorFuncs;

View File

@ -138,6 +138,7 @@ static EditorFuncs editor_funcs = {
&editor_set_indicator_full,
&editor_set_indicator_on_line_full,
&editor_clear_indicators_full,
&editor_set_indent_type
};
static ScintillaFuncs sci_funcs = {