Use Scintilla's buffer directly for parsing tags
This commit is contained in:
parent
6ceb5ac164
commit
ea51c487d3
@ -2250,21 +2250,19 @@ gint document_replace_all(GeanyDocument *doc, const gchar *find_text, const gcha
|
|||||||
|
|
||||||
static gboolean update_tags_from_buffer(GeanyDocument *doc)
|
static gboolean update_tags_from_buffer(GeanyDocument *doc)
|
||||||
{
|
{
|
||||||
gboolean result;
|
guchar *buffer_ptr;
|
||||||
#if 0
|
gsize len;
|
||||||
/* old code */
|
|
||||||
result = tm_source_file_update(doc->tm_file, TRUE, FALSE, TRUE);
|
|
||||||
#else
|
|
||||||
gsize len = sci_get_length(doc->editor->sci) + 1;
|
|
||||||
gchar *text = g_malloc(len);
|
|
||||||
|
|
||||||
/* we copy the whole text into memory instead using a direct char pointer from
|
len = sci_get_length(doc->editor->sci);
|
||||||
* Scintilla because tm_source_file_buffer_update() does modify the string slightly */
|
|
||||||
sci_get_text(doc->editor->sci, len, text);
|
/* gets a direct character pointer from Scintilla.
|
||||||
result = tm_source_file_buffer_update(doc->tm_file, (guchar*) text, len, TRUE);
|
* this is OK because tm_source_file_buffer_update() does not modify the
|
||||||
g_free(text);
|
* buffer, it only requires that buffer doesn't change while it's running,
|
||||||
#endif
|
* which it won't since it runs in this thread (ie. synchronously).
|
||||||
return result;
|
* see tagmanager/read.c:bufferOpen */
|
||||||
|
buffer_ptr = (guchar *) scintilla_send_message(doc->editor->sci, SCI_GETCHARACTERPOINTER, 0, 0);
|
||||||
|
|
||||||
|
return tm_source_file_buffer_update(doc->tm_file, buffer_ptr, len, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user