Fix pasting of multi-line clipboard.

Previous newline removal only removed trailing newline.
This commit is contained in:
Dave Davenport 2017-01-03 12:20:21 +01:00
parent 0307a14984
commit 30726b6c6e
1 changed files with 4 additions and 3 deletions

View File

@ -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 );