sdgui: trim selection text

Just like sdtui does.
This commit is contained in:
Přemysl Eric Janouch 2021-10-20 11:19:25 +02:00
parent 6158f6e3b5
commit ec89870a32
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 3 additions and 1 deletions

View File

@ -129,7 +129,9 @@ on_selection_received (G_GNUC_UNUSED GtkClipboard *clipboard, const gchar *text,
if (!text) if (!text)
return; 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, g_signal_emit_by_name (g.entry,
"move-cursor", GTK_MOVEMENT_BUFFER_ENDS, 1, FALSE); "move-cursor", GTK_MOVEMENT_BUFFER_ENDS, 1, FALSE);
} }