[gtk/matthiasc/for-master: 4/4] node-editor: Don't insert hyphens
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 4/4] node-editor: Don't insert hyphens
- Date: Sat, 3 Oct 2020 13:47:56 +0000 (UTC)
commit 459bd948dba68c512372e32ef91e6ff187a23004
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Oct 3 09:46:38 2020 -0400
node-editor: Don't insert hyphens
This can be a bit confusing in multi-line strings.
demos/node-editor/node-editor-window.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/demos/node-editor/node-editor-window.c b/demos/node-editor/node-editor-window.c
index f67331b323..73cf2b06ec 100644
--- a/demos/node-editor/node-editor-window.c
+++ b/demos/node-editor/node-editor-window.c
@@ -171,6 +171,8 @@ text_changed (GtkTextBuffer *buffer,
GskRenderNode *node;
char *text;
GBytes *bytes;
+ GtkTextIter iter;
+ GtkTextIter start, end;
g_array_remove_range (self->errors, 0, self->errors->len);
text = get_current_text (self->text_buffer);
@@ -208,8 +210,6 @@ text_changed (GtkTextBuffer *buffer,
gtk_picture_set_paintable (GTK_PICTURE (self->picture), NULL);
}
- GtkTextIter iter;
-
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
while (!gtk_text_iter_is_end (&iter))
@@ -272,6 +272,10 @@ text_changed (GtkTextBuffer *buffer,
gtk_text_iter_forward_char (&iter);
}
+
+ gtk_text_buffer_get_bounds (self->text_buffer, &start, &end);
+ gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens",
+ &start, &end);
}
static gboolean
@@ -898,6 +902,11 @@ node_editor_window_init (NodeEditorWindow *self)
"name", "number",
"foreground-rgba", &(GdkRGBA) { 0.8, 0.52, 0.43, 1},
NULL));
+ gtk_text_tag_table_add (self->tag_table,
+ g_object_new (GTK_TYPE_TEXT_TAG,
+ "name", "no-hyphens",
+ "insert-hyphens", FALSE,
+ NULL));
self->text_buffer = gtk_text_buffer_new (self->tag_table);
g_signal_connect (self->text_buffer, "changed", G_CALLBACK (text_changed), self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]