From 77bcb5bc538f12fcc223f2f584bbd8d0387f11a0 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Thu, 2 Aug 2012 15:35:54 -0400 Subject: Prevent expanding tabs when using the P keybinding. This change modifies the paste_uri function to change all newlines in the uri with spaces. This stops the new tab from expanding to twice it's correct height when using the P command, if pasting a link that contains any newlines (usually these would come from copying the newline out of a terminal). --- xombrero.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xombrero.c b/xombrero.c index 7b80c96..214b104 100644 --- a/xombrero.c +++ b/xombrero.c @@ -1502,6 +1502,7 @@ paste_uri(struct tab *t, struct karg *args) { GtkClipboard *clipboard, *primary; gchar *c = NULL, *p = NULL, *uri; + int i; clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); primary = gtk_clipboard_get(GDK_SELECTION_PRIMARY); @@ -1516,6 +1517,11 @@ paste_uri(struct tab *t, struct karg *args) /* UNIX try primary first */ uri = p ? p : c; #endif + /* replace all newlines with spaces */ + for (i = 0; uri[i] != '\0'; ++i) + if (uri[i] == '\n') + uri[i] = ' '; + while (*uri && isspace(*uri)) uri++; if (strlen(uri) == 0) { -- cgit 1.4.1-2-gfad0