Пример #1
0
static void view_unregister_indent_func(TEXT_BUFFER_VIEW_REC *view,
					INDENT_FUNC indent_func)
{
	if (view->default_indent_func == indent_func)
		view->default_indent_func = NULL;

	/* recreate cache so it won't contain references
	   to the indent function */
	view_reset_cache(view);
	view->cache = textbuffer_cache_get(view->siblings, view->width);
}
Пример #2
0
/* Remove all lines from buffer. */
void textbuffer_view_remove_all_lines(TEXT_BUFFER_VIEW_REC *view)
{
	g_return_if_fail(view != NULL);

	textbuffer_remove_all_lines(view->buffer);

	g_hash_table_foreach_remove(view->bookmarks,
				    (GHRFunc) g_free_true, NULL);

	view_reset_cache(view);
	textbuffer_view_clear(view);
	g_slist_foreach(view->siblings, (GFunc) textbuffer_view_clear, NULL);
}
Пример #3
0
static void view_unregister_indent_func(TEXT_BUFFER_VIEW_REC *view,
					INDENT_FUNC indent_func)
{
        INDENT_FUNC func;
	LINE_REC *line;
        const unsigned char *text, *tmp;

	if (view->default_indent_func == indent_func)
		view->default_indent_func = NULL;

	/* recreate cache so it won't contain references
	   to the indent function */
	view_reset_cache(view);
	view->cache = textbuffer_cache_get(view->siblings, view->width);

        /* remove all references to the indent function from buffer */
	line = view->buffer->first_line;
	while (line != NULL) {
		text = line->text;

		for (text = line->text;; text++) {
			if (*text != '\0')
				continue;

                        text++;
			if (*text == LINE_CMD_EOL)
				break;

			if (*text == LINE_CMD_INDENT_FUNC) {
				text++;
				memcpy(&func, text, sizeof(INDENT_FUNC));
				if (func == indent_func)
                                        memset(&func, 0, sizeof(INDENT_FUNC));
				text += sizeof(INDENT_FUNC);
			} else if (*text == LINE_CMD_CONTINUE) {
				memcpy(&tmp, text+1, sizeof(char *));
				text = tmp-1;
			}
		}

		line = line->next;
	}
}