From 30726b6c6e32c1fe9cde3fa4ea7acb68839db64c Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Tue, 3 Jan 2017 12:20:21 +0100 Subject: [PATCH] Fix pasting of multi-line clipboard. Previous newline removal only removed trailing newline. --- source/view.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/view.c b/source/view.c index 8fa5a18f..8079c976 100644 --- a/source/view.c +++ b/source/view.c @@ -840,9 +840,10 @@ static void rofi_view_paste ( RofiViewState *state, xcb_selection_notify_event_t if ( text != NULL && text[0] != '\0' ) { unsigned int dl = strlen ( text ); // Strip new line - while ( dl > 0 && text[dl] == '\n' ) { - text[dl] = '\0'; - dl--; + for ( unsigned int i = 0; i < dl; i++){ + if ( text[i] == '\n' ){ + dl = i; + } } // Insert string move cursor. textbox_insert ( state->text, state->text->cursor, text, dl );