Revision: 2751
http://geany.svn.sourceforge.net/geany/?rev=2751&view=rev
Author: ntrel
Date: 2008-07-03 10:21:29 -0700 (Thu, 03 Jul 2008)
Log Message:
-----------
Ensure all opened documents are colourised before being drawn
(should happen anyway in document_set_filetype(), but just in case).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/document.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-07-03 17:13:34 UTC (rev 2750)
+++ trunk/ChangeLog 2008-07-03 17:21:29 UTC (rev 2751)
@@ -11,6 +11,9 @@
* src/editor.c:
Fix possible segfault for XML tag completion when no '<' brace could
be found.
+ * src/document.c:
+ Ensure all opened documents are colourised before being drawn
+ (should happen anyway in document_set_filetype(), but just in case).
2008-07-03 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2008-07-03 17:13:34 UTC (rev 2750)
+++ trunk/src/document.c 2008-07-03 17:21:29 UTC (rev 2751)
@@ -1010,6 +1010,7 @@
/* add the text to the ScintillaObject */
sci_set_readonly(doc->sci, FALSE); /* to allow replacing text */
sci_set_text(doc->sci, filedata.data); /* NULL terminated data */
+ queue_colourise(doc); /* Ensure the document gets colourised. */
/* detect & set line endings */
editor_mode = utils_get_line_endings(filedata.data, filedata.len);
@@ -1049,9 +1050,6 @@
{ /* reloading */
document_undo_clear(doc);
- /* Ensure the document gets colourised.
- * (The text could have changed without typenames changing.) */
- queue_colourise(doc);
use_ft = ft;
}
/* update taglist, typedef keywords and build menu if necessary */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2750
http://geany.svn.sourceforge.net/geany/?rev=2750&view=rev
Author: ntrel
Date: 2008-07-03 10:13:34 -0700 (Thu, 03 Jul 2008)
Log Message:
-----------
Fix possible segfault for XML tag completion when no '<' brace could
be found.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-07-03 17:04:12 UTC (rev 2749)
+++ trunk/ChangeLog 2008-07-03 17:13:34 UTC (rev 2750)
@@ -8,6 +8,9 @@
* src/keybindings.c:
Avoid flickering the menu bar when 'Override Geany keybindings'
Terminal pref is set.
+ * src/editor.c:
+ Fix possible segfault for XML tag completion when no '<' brace could
+ be found.
2008-07-03 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-07-03 17:04:12 UTC (rev 2749)
+++ trunk/src/editor.c 2008-07-03 17:13:34 UTC (rev 2750)
@@ -1731,7 +1731,7 @@
{
/* ignore tag */
}
- else if (*str_found != '\0')
+ else if (NZV(str_found))
{
insert_closing_tag(doc, pos, ch, str_found);
result = TRUE;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 2748
http://geany.svn.sourceforge.net/geany/?rev=2748&view=rev
Author: eht16
Date: 2008-07-03 08:20:44 -0700 (Thu, 03 Jul 2008)
Log Message:
-----------
Move the checks for HTML entity completion into an own function to increase readability.
Remove workaround for a wrong styling on last character and replace it with proper style reading (patch by Jason Oster, thanks).
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/editor.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-07-03 14:39:49 UTC (rev 2747)
+++ trunk/ChangeLog 2008-07-03 15:20:44 UTC (rev 2748)
@@ -17,6 +17,11 @@
(closes #2007288).
* src/symbols.c:
Load "ignore_tags" file before generating global tags file.
+ * src/editor.c:
+ Move the checks for HTML entity completion into an own function
+ to increase readability.
+ Remove workaround for a wrong styling on last character and replace
+ it with proper style reading (patch by Jason Oster, thanks).
2008-07-02 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c 2008-07-03 14:39:49 UTC (rev 2747)
+++ trunk/src/editor.c 2008-07-03 15:20:44 UTC (rev 2748)
@@ -1257,7 +1257,7 @@
static gboolean
-autocomplete_tags(GeanyDocument *doc, gchar *root, gsize rootlen)
+autocomplete_tags(GeanyDocument *doc, const gchar *root, gsize rootlen)
{ /* PHP, LaTeX, C, C++, D and Java tag autocompletion */
TMTagAttrType attrs[] = { tm_tag_attr_name_t, 0 };
const GPtrArray *tags;
@@ -1285,6 +1285,27 @@
}
+/* Check whether to use entity autocompletion:
+ * - always in a HTML file except when inside embedded JavaScript, Python, ASP, ...
+ * - in a PHP file only when we are outside of <? ?> */
+static gboolean autocomplete_check_for_html(gint ft_id, gint style)
+{
+ /* use entity completion when style is not JavaScript, ASP, Python, PHP, ...
+ * (everything after SCE_HJ_START is for embedded scripting languages) */
+ if (ft_id == GEANY_FILETYPES_HTML && style < SCE_HJ_START)
+ return TRUE;
+
+ if (ft_id == GEANY_FILETYPES_PHP)
+ {
+ /* use entity completion when style is outside of PHP styles */
+ if (style < SCE_HPHP_DEFAULT || style > SCE_HPHP_OPERATOR)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
gboolean editor_start_auto_complete(GeanyDocument *doc, gint pos, gboolean force)
{
gint line, line_start, line_len, line_pos, current, rootlen, startword, lexer, style, prev_style;
@@ -1309,8 +1330,15 @@
startword = current;
lexer = SSM(sci, SCI_GETLEXER, 0, 0);
prev_style = SSM(sci, SCI_GETSTYLEAT, pos - 2, 0);
- style = SSM(sci, SCI_GETSTYLEAT, pos, 0);
+ /* If we are at the last character of the document, style is always 0 because it has not yet
+ * been styled (styling is first done in SCN_UPDATEUI, not yet in SCN_CHARADDED),
+ * so we use the style of the last character. */
+ if (pos >= SSM(sci, SCI_GETLENGTH, 0, 0))
+ style = prev_style;
+ else
+ style = SSM(sci, SCI_GETSTYLEAT, pos, 0);
+
/* don't autocomplete in comments and strings */
if (!force && is_comment(lexer, prev_style, style))
return FALSE;
@@ -1331,12 +1359,7 @@
root = linebuf + startword;
rootlen = current - startword;
- /* entity autocompletion always in a HTML file except when inside embedded JavaScript,
- * in a PHP file only when we are outside of <? ?> */
- if ((ft->id == GEANY_FILETYPES_HTML && (style < SCE_HJ_START || style > SCE_HJ_REGEX)) ||
- (ft->id == GEANY_FILETYPES_PHP && (style < SCE_HPHP_DEFAULT || style > SCE_HPHP_OPERATOR) &&
- line != (sci_get_line_count(sci) - 1))) /* this check is a workaround for a Scintilla bug:
- * the last line in a PHP gets wrong styling */
+ if (autocomplete_check_for_html(ft->id, style))
ret = autocomplete_html(sci, root, rootlen);
else
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.