summaryrefslogtreecommitdiff
path: root/src/glibext/buffercache.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-08-18 20:08:39 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-08-18 20:08:39 (GMT)
commitc5631dd09fa9981e914ec9082c6270b69a719ca4 (patch)
tree0d50b3a82f466d2b8587ad20cfb0c93b180897ee /src/glibext/buffercache.c
parente5185bf4b4b6f76f15d3ff460a9cea40a8753284 (diff)
Refreshed the rendering for newly added bookmarks.
Diffstat (limited to 'src/glibext/buffercache.c')
-rw-r--r--src/glibext/buffercache.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/glibext/buffercache.c b/src/glibext/buffercache.c
index 6f52956..169c75e 100644
--- a/src/glibext/buffercache.c
+++ b/src/glibext/buffercache.c
@@ -397,6 +397,8 @@ static GBufferLine *get_cache_info_line(cache_info *info, const GWidthTracker *t
{
result = g_buffer_line_new(g_width_tracker_count_columns(tracker));
+ g_buffer_line_add_flag(result, info->extra_flags);
+
g_object_add_toggle_ref(G_OBJECT(result), (GToggleNotify)on_line_ref_toggle, info);
if (info->count == 1)
@@ -515,6 +517,14 @@ static void g_buffer_cache_class_init(GBufferCacheClass *class)
g_cclosure_user_marshal_VOID__BOOLEAN_ULONG_ULONG,
G_TYPE_NONE, 3, G_TYPE_BOOLEAN, G_TYPE_ULONG, G_TYPE_ULONG);
+ g_signal_new("line-updated",
+ G_TYPE_BUFFER_CACHE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(GBufferCacheClass, line_updated),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__ULONG,
+ G_TYPE_NONE, 1, G_TYPE_ULONG);
+
}
@@ -761,6 +771,8 @@ gint g_buffer_cache_get_text_position(const GBufferCache *cache)
size_t g_buffer_cache_count_lines(const GBufferCache *cache)
{
+ // TODO check lock
+
return cache->used;
}
@@ -1337,6 +1349,44 @@ void g_buffer_cache_get_line_cursor(const GBufferCache *cache, size_t index, gin
* *
* Paramètres : cache = tampon de lignes à venir consulter. *
* index = indice de la ligne visée par la consultation. *
+* flag = propriété à intégrer. *
+* *
+* Description : Ajoute une propriété particulière à une ligne. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_buffer_cache_add_line_flag(GBufferCache *cache, size_t index, BufferLineFlags flag)
+{
+ cache_info *info; /* Accès direct à une ligne */
+
+ // TODO : check lock
+
+ assert(index < cache->used);
+
+ info = &cache->lines[index];
+
+ if ((info->extra_flags & flag) == 0)
+ {
+ info->extra_flags |= flag;
+
+ if (info->line != NULL)
+ g_buffer_line_add_flag(info->line, flag);
+
+ g_signal_emit_by_name(cache, "line-updated", index);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : cache = tampon de lignes à venir consulter. *
+* index = indice de la ligne visée par la consultation. *
* *
* Description : Détermine l'ensemble des propriétés attachées à une ligne. *
* *
@@ -1381,6 +1431,44 @@ BufferLineFlags g_buffer_cache_get_line_flags(const GBufferCache *cache, size_t
/******************************************************************************
* *
+* Paramètres : cache = tampon de lignes à venir consulter. *
+* index = indice de la ligne visée par la consultation. *
+* flag = propriété à supprimer. *
+* *
+* Description : Retire une propriété particulière attachée à une ligne. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_buffer_cache_remove_line_flag(GBufferCache *cache, size_t index, BufferLineFlags flag)
+{
+ cache_info *info; /* Accès direct à une ligne */
+
+ // TODO : check lock
+
+ assert(index < cache->used);
+
+ info = &cache->lines[index];
+
+ if ((info->extra_flags & flag) != 0)
+ {
+ info->extra_flags &= ~flag;
+
+ if (info->line != NULL)
+ g_buffer_line_remove_flag(info->line, flag);
+
+ g_signal_emit_by_name(cache, "line-updated", index);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : cache = tampon de lignes à consulter. *
* index = indice de la ligne recherchée. *
* *