Kaydet (Commit) 8c510a56 authored tarafından Nick Treleaven's avatar Nick Treleaven

Fix empty white box glitch with tag autocompletion, also improves typing response efficiency

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@414 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 038a9a3b
2006-06-05 Nick Treleaven <nick.treleaven@btinternet.com> 2006-06-05 Nick Treleaven <nick.treleaven@btinternet.com>
* doc/geany.docbook: Added save current file behaviour when building. * doc/geany.docbook: Added save current file behaviour when building.
* src/sci_cb.c: Fix empty white box glitch with tag autocompletion,
also improves typing response efficiency.
2006-06-05 Enrico Troeger <enrico.troeger@uvena.de> 2006-06-05 Enrico Troeger <enrico.troeger@uvena.de>
......
...@@ -398,7 +398,6 @@ gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos) ...@@ -398,7 +398,6 @@ gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos)
gint line_start = sci_get_position_from_line(sci, line); gint line_start = sci_get_position_from_line(sci, line);
gint line_len = sci_get_line_length(sci, line); gint line_len = sci_get_line_length(sci, line);
gint line_pos = pos - line_start - 1; gint line_pos = pos - line_start - 1;
gint i = 0;
gint current = pos - line_start; gint current = pos - line_start;
gint rootlen; gint rootlen;
gint startword = current, lexer = SSM(sci, SCI_GETLEXER, 0, 0); gint startword = current, lexer = SSM(sci, SCI_GETLEXER, 0, 0);
...@@ -407,14 +406,15 @@ gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos) ...@@ -407,14 +406,15 @@ gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos)
gchar *root; gchar *root;
const GPtrArray *tags; const GPtrArray *tags;
sci_get_line(sci, line, linebuf);
//if (lexer != SCLEX_CPP && lexer != SCLEX_HTML && lexer != SCLEX_PASCAL) return FALSE; //if (lexer != SCLEX_CPP && lexer != SCLEX_HTML && lexer != SCLEX_PASCAL) return FALSE;
if (lexer == SCLEX_HTML && style == SCE_H_DEFAULT) return FALSE; if (lexer == SCLEX_HTML && style == SCE_H_DEFAULT) return FALSE;
if (lexer == SCLEX_CPP && (style == SCE_C_COMMENT || if (lexer == SCLEX_CPP && (style == SCE_C_COMMENT ||
style == SCE_C_COMMENTLINE || style == SCE_C_COMMENTDOC)) return FALSE; style == SCE_C_COMMENTLINE || style == SCE_C_COMMENTDOC)) return FALSE;
while ((startword > 0) && (strchr(GEANY_WORDCHARS, linebuf[startword - 1]) || strchr(GEANY_WORDCHARS, linebuf[startword - 1]))) sci_get_line(sci, line, linebuf);
// find the start of the current word
while ((startword > 0) && (strchr(GEANY_WORDCHARS, linebuf[startword - 1])))
startword--; startword--;
linebuf[current] = '\0'; linebuf[current] = '\0';
root = linebuf + startword; root = linebuf + startword;
...@@ -440,11 +440,13 @@ gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos) ...@@ -440,11 +440,13 @@ gboolean sci_cb_start_auto_complete(ScintillaObject *sci, gint pos)
} }
else else
{ // C and C++ tag autocompletion { // C and C++ tag autocompletion
while (! g_ascii_isspace(linebuf[line_pos - i])) i++; gint i = 0;
while ((line_pos - i >= 0) && ! g_ascii_isspace(linebuf[line_pos - i])) i++;
if (i < 4) return FALSE; // go home if typed less than 4 chars if (i < 4) return FALSE; // go home if typed less than 4 chars
tags = tm_workspace_find(root, tm_tag_max_t, NULL, TRUE); tags = tm_workspace_find(root, tm_tag_max_t, NULL, TRUE);
if (NULL != tags) if (NULL != tags && tags->len > 0)
{ {
GString *words = g_string_sized_new(150); GString *words = g_string_sized_new(150);
TMTag *tag; TMTag *tag;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment