Revision: 4521 http://geany.svn.sourceforge.net/geany/?rev=4521&view=rev Author: frlan Date: 2010-01-12 18:44:38 +0000 (Tue, 12 Jan 2010)
Log Message: ----------- Add editor_insert_text_block() to plugin API
Modified Paths: -------------- trunk/ChangeLog trunk/plugins/geanyfunctions.h trunk/src/editor.c trunk/src/editor.h trunk/src/plugindata.h trunk/src/plugins.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2010-01-03 21:41:52 UTC (rev 4520) +++ trunk/ChangeLog 2010-01-12 18:44:38 UTC (rev 4521) @@ -1,3 +1,10 @@ +2010-01-11 Frank Lanitz <frank(at)frank(dot)uvena(dot)de> + + * plugins/geanyfunctions.h, src/editor.c, src/editor.h, + src/plugindata.h, src/plugins.c: + Add editor_insert_text_block() to plugin API. + + 2010-01-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* *.*:
Modified: trunk/plugins/geanyfunctions.h =================================================================== --- trunk/plugins/geanyfunctions.h 2010-01-03 21:41:52 UTC (rev 4520) +++ trunk/plugins/geanyfunctions.h 2010-01-12 18:44:38 UTC (rev 4521) @@ -86,6 +86,8 @@ geany_functions->p_editor->get_eol_char_len #define editor_get_eol_char \ geany_functions->p_editor->get_eol_char +#define editor_insert_text_block \ + geany_functions->p_editor->insert_text_block #define scintilla_send_message \ geany_functions->p_scintilla->send_message #define scintilla_new \
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2010-01-03 21:41:52 UTC (rev 4520) +++ trunk/src/editor.c 2010-01-12 18:44:38 UTC (rev 4521) @@ -2170,9 +2170,11 @@ sci_set_current_position(sci, pos, FALSE); }
- -/* Insert text, replacing \t tab chars with the correct indent width, and \n newline +/* TODO: Fix \t inside comment*/ +/** Insert text, replacing \t tab chars with the correct indent width, and \n newline * chars with the correct line ending string. + * @param editor The editor to operate on. + * @param insert_pos Position, where to start with inserting text block. * @param text Intended as e.g. "if (1)\n\tdo_something();" * @param cursor_index If >= 0, the index into @a text to place the cursor. * @param newline_indent_size Indentation size (in spaces) to insert for each newline; use @@ -2180,11 +2182,11 @@ * @param replace_newlines Whether to replace newlines in text or not. If * newlines have been replaced before, this should be false, to avoid multiple * replacements of newlines, which is error prone on Windows. - * @warning Make sure all \t tab chars in @a text are intended as indent widths, + * @warning Make sure all \t tab chars in @a text are intended as indent widths, * NOT any hard tabs (you get those when copying document text with the Tabs * & Spaces indent mode set). - * @note This doesn't scroll the cursor in view afterwards. */ -static void editor_insert_text_block(GeanyEditor *editor, const gchar *text, gint insert_pos, + * @note This doesn't scroll the cursor in view afterwards. **/ +void editor_insert_text_block(GeanyEditor *editor, const gchar *text, gint insert_pos, gint cursor_index, gint newline_indent_size, gboolean replace_newlines) { ScintillaObject *sci = editor->sci; @@ -2195,6 +2197,7 @@ const gchar cur_marker[] = "__GEANY_CURSOR_MARKER__";
g_return_if_fail(text); + g_return_if_fail(editor != NULL);
buf = g_string_new(text);
Modified: trunk/src/editor.h =================================================================== --- trunk/src/editor.h 2010-01-03 21:41:52 UTC (rev 4520) +++ trunk/src/editor.h 2010-01-12 18:44:38 UTC (rev 4521) @@ -277,4 +277,8 @@
gchar *editor_get_calltip_text(GeanyEditor *editor, const TMTag *tag);
+void editor_insert_text_block(GeanyEditor *editor, const gchar *text, + gint insert_pos, gint cursor_index, + gint newline_indent_size, gboolean replace_newlines); + #endif
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2010-01-03 21:41:52 UTC (rev 4520) +++ trunk/src/plugindata.h 2010-01-12 18:44:38 UTC (rev 4521) @@ -50,7 +50,7 @@ enum { /** The Application Programming Interface (API) version, incremented * whenever any plugin data types are modified or appended to. */ - GEANY_API_VERSION = 168, + GEANY_API_VERSION = 169,
/** The Application Binary Interface (ABI) version, incremented whenever * existing fields in the plugin data types have to be changed or reordered. */ @@ -563,6 +563,10 @@ const gchar* (*get_eol_char_name) (struct GeanyEditor *editor); gint (*get_eol_char_len) (struct GeanyEditor *editor); const gchar* (*get_eol_char) (struct GeanyEditor *editor); + + void (*insert_text_block) (struct GeanyEditor *editor, const gchar *text, + gint insert_pos, gint cursor_index, gint newline_indent_size, + gboolean replace_newlines); } EditorFuncs;
Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2010-01-03 21:41:52 UTC (rev 4520) +++ trunk/src/plugins.c 2010-01-12 18:44:38 UTC (rev 4521) @@ -120,7 +120,8 @@ &editor_get_word_at_pos, &editor_get_eol_char_name, &editor_get_eol_char_len, - &editor_get_eol_char + &editor_get_eol_char, + &editor_insert_text_block };
static ScintillaFuncs scintilla_funcs = {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.