node-editor: Don't insert hyphens

This can be a bit confusing in multi-line strings.
This commit is contained in:
Matthias Clasen 2020-10-03 09:46:38 -04:00
parent cef1cd19ff
commit 5640208f31

View File

@ -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);