mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-27 06:49:53 +00:00
smart copying for Windows line breaks (fixes #1558)
This commit is contained in:
parent
2e12041688
commit
fb502bc926
@ -167,15 +167,28 @@ export class XTermFrontend extends Frontend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
copySelection (): void {
|
copySelection (): void {
|
||||||
const text = this.getSelection()
|
let text = this.getSelection()
|
||||||
|
let lines = text.split('\n')
|
||||||
|
if (lines.some(x => x.length === this.xterm.cols)) {
|
||||||
|
text = ''
|
||||||
|
let lastLineWraps = false
|
||||||
|
for (let line of lines) {
|
||||||
|
if (!lastLineWraps) {
|
||||||
|
text += '\n'
|
||||||
|
}
|
||||||
|
text += line
|
||||||
|
lastLineWraps = line.length === this.xterm.cols
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (text.length < 1024 * 32) {
|
if (text.length < 1024 * 32) {
|
||||||
require('electron').remote.clipboard.write({
|
require('electron').remote.clipboard.write({
|
||||||
text: this.getSelection(),
|
text: text,
|
||||||
html: this.getSelectionAsHTML(),
|
html: this.getSelectionAsHTML(),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
require('electron').remote.clipboard.write({
|
require('electron').remote.clipboard.write({
|
||||||
text: this.getSelection(),
|
text: text,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user