aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-10-20 11:19:25 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-10-20 11:19:47 +0200
commitec89870a324c2ba3c707a0aec2330db681283bbc (patch)
tree9e6c2dc1bcf0da043edc105dd45222c5f4c7899d
parent6158f6e3b5308c4512419873f5be62b473c76204 (diff)
downloadtdv-ec89870a324c2ba3c707a0aec2330db681283bbc.tar.gz
tdv-ec89870a324c2ba3c707a0aec2330db681283bbc.tar.xz
tdv-ec89870a324c2ba3c707a0aec2330db681283bbc.zip
sdgui: trim selection text
Just like sdtui does.
-rw-r--r--src/sdgui.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sdgui.c b/src/sdgui.c
index 0cbee8f..1310900 100644
--- a/src/sdgui.c
+++ b/src/sdgui.c
@@ -129,7 +129,9 @@ on_selection_received (G_GNUC_UNUSED GtkClipboard *clipboard, const gchar *text,
if (!text)
return;
- gtk_entry_set_text (GTK_ENTRY (g.entry), text);
+ gchar *trimmed = g_strstrip (g_strdup (text));
+ gtk_entry_set_text (GTK_ENTRY (g.entry), trimmed);
+ g_free (trimmed);
g_signal_emit_by_name (g.entry,
"move-cursor", GTK_MOVEMENT_BUFFER_ENDS, 1, FALSE);
}