mirror of https://github.com/adamdruppe/arsd.git
paste chunk unnecessary on most systems and harmful
This commit is contained in:
parent
738148b861
commit
444eaa9759
31
terminal.d
31
terminal.d
|
@ -4146,6 +4146,37 @@ class LineGetter {
|
||||||
f ~= item;
|
f ~= item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/+
|
||||||
|
// if it is excessively long, let's trim it down by trying to
|
||||||
|
// group common sub-sequences together.
|
||||||
|
if(f.length > terminal.height * 3 / 4) {
|
||||||
|
import std.algorithm;
|
||||||
|
f.sort();
|
||||||
|
|
||||||
|
// see how many can be saved by just keeping going until there is
|
||||||
|
// no more common prefix. then commit that and keep on down the list.
|
||||||
|
// since it is sorted, if there is a commonality, it should appear quickly
|
||||||
|
string[] n;
|
||||||
|
string commonality = f[0];
|
||||||
|
size_t idx = 1;
|
||||||
|
while(idx < f.length) {
|
||||||
|
auto c = commonPrefix(commonality, f[idx]);
|
||||||
|
if(c.length > cursorPosition - start) {
|
||||||
|
commonality = c;
|
||||||
|
} else {
|
||||||
|
n ~= commonality;
|
||||||
|
commonality = f[idx];
|
||||||
|
}
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
if(commonality.length)
|
||||||
|
n ~= commonality;
|
||||||
|
|
||||||
|
if(n.length)
|
||||||
|
f = n;
|
||||||
|
}
|
||||||
|
+/
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,11 @@ class TerminalEmulator {
|
||||||
if(bracketedPasteMode)
|
if(bracketedPasteMode)
|
||||||
sendToApplication("\033[200~");
|
sendToApplication("\033[200~");
|
||||||
|
|
||||||
|
version(use_libssh2)
|
||||||
enum MAX_PASTE_CHUNK = 4000;
|
enum MAX_PASTE_CHUNK = 4000;
|
||||||
|
else
|
||||||
|
enum MAX_PASTE_CHUNK = 1024 * 1024 * 10;
|
||||||
|
|
||||||
if(data.length > MAX_PASTE_CHUNK) {
|
if(data.length > MAX_PASTE_CHUNK) {
|
||||||
// need to chunk it in order to receive echos, etc,
|
// need to chunk it in order to receive echos, etc,
|
||||||
// to avoid deadlocks
|
// to avoid deadlocks
|
||||||
|
|
Loading…
Reference in New Issue