提交 b68f601f 编写于 作者: E Eugene Pankov

remove whitespace from selection's end (fixes #327)

上级 c2a40b2c
......@@ -230,6 +230,18 @@ export class HTermFrontend extends Frontend {
this.contentUpdated.next()
return ret
}
const _expandSelection = screen.expandSelection.bind(screen)
screen.expandSelection = (selection) => {
// Drop whitespace at the end of selection
let range = selection.getRangeAt(0)
if (range.endOffset > 0 && range.endContainer.nodeType === 3 && range.endContainer.textContent !== '') {
while (/[\s\S]+\s$/.test(range.endContainer.textContent.substr(0,range.endOffset))) {
range.setEnd(range.endContainer, range.endOffset - 1)
}
}
_expandSelection(selection)
}
}
const _measureCharacterSize = this.term.scrollPort_.measureCharacterSize.bind(this.term.scrollPort_)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册