summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/input.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/input.rs b/src/input.rs
index ff9b7b03..ff1eb796 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -240,7 +240,13 @@ impl Action {
ctx.write_to_pty(contents.into_bytes());
ctx.write_to_pty(&b"\x1b[201~"[..]);
} else {
- ctx.write_to_pty(contents.replace("\n","\r").into_bytes());
+ // In non-bracketed (ie: normal) mode, terminal applications cannot distinguish
+ // pasted data from keystrokes.
+ // In theory, we should construct the keystrokes needed to produce the data we are
+ // pasting... since that's neither practical nor sensible (and probably an impossible
+ // task to solve in a general way), we'll just replace line breaks (windows and unix
+ // style) with a singe carriage return (\r, which is what the Enter key produces).
+ ctx.write_to_pty(contents.replace("\r\n","\r").replace("\n","\r").into_bytes());
}
}
}