summaryrefslogtreecommitdiffstats
path: root/source/view.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-01-03 12:20:21 +0100
committerDave Davenport <qball@gmpclient.org>2017-01-03 12:20:21 +0100
commit30726b6c6e32c1fe9cde3fa4ea7acb68839db64c (patch)
tree87cb149f31d20efb08b61e106e3f1b27b1a10c08 /source/view.c
parent0307a149844b537cf893c5cd9132e35d839c89b8 (diff)
Fix pasting of multi-line clipboard.
Previous newline removal only removed trailing newline.
Diffstat (limited to 'source/view.c')
-rw-r--r--source/view.c7
1 files 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 );