SF.net SVN: geany:[2966] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Wed Sep 17 18:05:27 UTC 2008
Revision: 2966
http://geany.svn.sourceforge.net/geany/?rev=2966&view=rev
Author: eht16
Date: 2008-09-17 18:05:27 +0000 (Wed, 17 Sep 2008)
Log Message:
-----------
Replace the usage of the old Scintilla indicator API by the new modern API and remove old hacks (patch by Jason Oster, thanks).
Add new sci_indic_clear() function to the plugin API.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
trunk/src/highlighting.c
trunk/src/plugindata.h
trunk/src/plugins.c
trunk/src/sciwrappers.c
trunk/src/sciwrappers.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-09-17 18:03:52 UTC (rev 2965)
+++ trunk/ChangeLog 2008-09-17 18:05:27 UTC (rev 2966)
@@ -11,6 +11,11 @@
Rename sci_find_bracematch() into sci_find_matching_brace().
* src/main.c:
Display SVN revision number in version information if available.
+ * src/editor.c, src/highlighting.c, src/plugindata.h, src/plugins.c,
+ src/sciwrappers.c, src/sciwrappers.h:
+ Replace the usage of the old Scintilla indicator API by the new
+ modern API and remove old hacks (patch by Jason Oster, thanks).
+ Add new sci_indic_clear() function to the plugin API.
2008-09-17 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-09-17 18:03:52 UTC (rev 2965)
+++ trunk/src/editor.c 2008-09-17 18:05:27 UTC (rev 2966)
@@ -1467,13 +1467,6 @@
lexer = SSM(sci, SCI_GETLEXER, 0, 0);
style = SSM(sci, SCI_GETSTYLEAT, pos - 2, 0);
- /** TODO if we use other indicators in the future, we should adjust this code, currently
- * it works only for the third indicator (INDIC2_MASK) */
- if (style & INDIC2_MASK)
- { /* remove the indicator bit from the style */
- style &= 0x0000000f;
- }
-
/* don't autocomplete in comments and strings */
if (!force && !is_code_style(lexer, style))
return FALSE;
@@ -3277,10 +3270,8 @@
last_pos = sci_get_length(editor->sci);
if (last_pos > 0)
- {
- sci_start_styling(editor->sci, 0, INDIC2_MASK);
- sci_set_styling(editor->sci, last_pos, 0);
- }
+ sci_indic_clear(editor->sci, 0, last_pos);
+
sci_marker_delete_all(editor->sci, 0); /* remove the yellow error line marker */
}
@@ -3337,17 +3328,11 @@
**/
void editor_set_indicator(GeanyEditor *editor, gint start, gint end)
{
- gint current_mask;
-
if (editor == NULL || start >= end)
return;
- current_mask = sci_get_style_at(editor->sci, start);
- current_mask &= INDICS_MASK;
- current_mask |= INDIC2_MASK;
-
- sci_start_styling(editor->sci, start, INDIC2_MASK);
- sci_set_styling(editor->sci, end - start, current_mask);
+ sci_set_indic(editor->sci, 0);
+ sci_indic_fill(editor->sci, start, end - start);
}
Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c 2008-09-17 18:03:52 UTC (rev 2965)
+++ trunk/src/highlighting.c 2008-09-17 18:05:27 UTC (rev 2966)
@@ -459,10 +459,8 @@
SSM(sci, SCI_SETWRAPSTARTINDENT, common_style_set.styling[GCS_LINE_WRAP_INDENT].foreground, 0);
/* indicator settings */
- SSM(sci, SCI_INDICSETSTYLE, 2, INDIC_SQUIGGLE);
- /* why? if I let this out, the indicator remains green with PHP */
+ SSM(sci, SCI_INDICSETSTYLE, 0, INDIC_SQUIGGLE);
SSM(sci, SCI_INDICSETFORE, 0, invert(0x0000ff));
- SSM(sci, SCI_INDICSETFORE, 2, invert(0x0000ff));
/* define marker symbols
* 0 -> line marker */
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2008-09-17 18:03:52 UTC (rev 2965)
+++ trunk/src/plugindata.h 2008-09-17 18:05:27 UTC (rev 2966)
@@ -41,7 +41,7 @@
enum {
/** The Application Programming Interface (API) version, incremented
* whenever any plugin data types are modified or appended to. */
- GEANY_API_VERSION = 93,
+ GEANY_API_VERSION = 94,
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered. */
@@ -275,6 +275,7 @@
gint (*get_current_line) (struct _ScintillaObject *sci);
gboolean (*has_selection) (struct _ScintillaObject *sci);
gint (*get_tab_width) (struct _ScintillaObject *sci);
+ gint (*indic_clear) (struct _ScintillaObject *sci, gint start, gint end);
}
ScintillaFuncs;
Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c 2008-09-17 18:03:52 UTC (rev 2965)
+++ trunk/src/plugins.c 2008-09-17 18:05:27 UTC (rev 2966)
@@ -154,7 +154,8 @@
&sci_get_char_at,
&sci_get_current_line,
&sci_has_selection,
- &sci_get_tab_width
+ &sci_get_tab_width,
+ &sci_indic_clear
};
static TemplateFuncs template_funcs = {
Modified: trunk/src/sciwrappers.c
===================================================================
--- trunk/src/sciwrappers.c 2008-09-17 18:03:52 UTC (rev 2965)
+++ trunk/src/sciwrappers.c 2008-09-17 18:05:27 UTC (rev 2966)
@@ -1010,6 +1010,26 @@
SSM(sci, SCI_STARTSTYLING, pos, mask);
}
+gint sci_get_indic(ScintillaObject *sci)
+{
+ return SSM(sci, SCI_GETINDICATORCURRENT, 0, 0);
+}
+
+void sci_set_indic(ScintillaObject *sci, gint indic)
+{
+ SSM(sci, SCI_SETINDICATORCURRENT, indic, 0);
+}
+
+void sci_indic_fill(ScintillaObject *sci, gint pos, gint len)
+{
+ SSM(sci, SCI_INDICATORFILLRANGE, pos, len);
+}
+
+void sci_indic_clear(ScintillaObject *sci, gint pos, gint len)
+{
+ SSM(sci, SCI_INDICATORCLEARRANGE, pos, len);
+}
+
void sci_select_all(ScintillaObject *sci)
{
SSM(sci, SCI_SELECTALL, 0, 0);
Modified: trunk/src/sciwrappers.h
===================================================================
--- trunk/src/sciwrappers.h 2008-09-17 18:03:52 UTC (rev 2965)
+++ trunk/src/sciwrappers.h 2008-09-17 18:05:27 UTC (rev 2966)
@@ -161,6 +161,12 @@
void sci_set_styling (ScintillaObject * sci, gint len, gint style);
void sci_start_styling (ScintillaObject * sci, gint pos, gint mask);
+
+gint sci_get_indic (ScintillaObject * sci);
+void sci_set_indic (ScintillaObject * sci, gint indic);
+void sci_indic_fill (ScintillaObject * sci, gint pos, gint len);
+void sci_indic_clear (ScintillaObject * sci, gint pos, gint len);
+
void sci_select_all (ScintillaObject * sci);
gint sci_get_line_indent_position(ScintillaObject * sci, gint line);
void sci_set_line_indentation (ScintillaObject * sci, gint line, gint indent);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list