diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-07-01 21:25:41 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-07-01 21:25:41 -0400 |
commit | 0dee6475bd7f78ed6966b29ef248fd210e1081c2 (patch) | |
tree | e44c69f0d2e78e0cd8fec07f08c7ab1a81335e7c | |
parent | 340a4343d0755bb918b98743cbe3da9e65433d33 (diff) |
terminal: Insert newlines when copying multiple lines
-rw-r--r-- | clients/terminal.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clients/terminal.c b/clients/terminal.c index 62bb020a..504e3c25 100644 --- a/clients/terminal.c +++ b/clients/terminal.c @@ -849,7 +849,12 @@ terminal_send_selection(struct terminal *terminal, int fd) if (!attr.attr.s) continue; len = strnlen((char *) p_row[col].byte, 4); - fwrite(p_row[col].byte, 1, len, fp); + if (len > 0) + fwrite(p_row[col].byte, 1, len, fp); + if (len == 0 || col == terminal->width - 1) { + fwrite("\n", 1, 1, fp); + break; + } } } fclose(fp); |