Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Xterm UI may miss whitespace #8901

Merged
merged 1 commit into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/plugin-bash-like/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"module": "mdist/index.js",
"types": "mdist/index.d.ts",
"dependencies": {
"@kui-shell/xterm-helpers": "1.0.1",
"@kui-shell/xterm-helpers": "1.0.2",
"cookie": "0.4.2",
"debug": "4.3.4",
"globby": "11.0.4",
Expand Down
1 change: 1 addition & 0 deletions plugins/plugin-bash-like/src/pty/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function sameStyle(cell1: IBufferCell, cell2: IBufferCell): boolean {
cell1.isItalic() === cell2.isItalic() &&
cell1.isDim() === cell2.isDim() &&
cell1.isUnderline() === cell2.isUnderline() &&
cell1.isStrikethrough() === cell2.isStrikethrough() &&
cell1.isBlink() === cell2.isBlink() &&
cell1.isInvisible() === cell2.isInvisible()
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,19 @@ export default class XtermDom extends React.PureComponent<Props> {
// directly into the row element.
const cell = cells[0]
if (cell.classList && cell.classList.length === 0 && cell.style && Object.keys(cell.style).length === 0) {
return cell.innerText.length === 0 ? '\u00a0' : cell.innerText
const text = cell.innerText || cell.textContent || '\u00a0' // whitespace seems to be in textContent
return text
}
}

return cells.map((cell, idx) => {
const className = cell.classList ? cell.classList.join(' ') : ''
const style = cell.style || {}
const text = cell.innerText || cell.textContent || '\u00a0' // whitespace seems to be in textContent

return (
<span key={idx} className={className} style={style}>
{cell.innerText}
return cell.classList.length === 0 && !cell.style ? (
text
) : (
<span key={idx} className={cell.classList.join(' ')} style={cell.style || {}}>
{text || '\u00a0'}
</span>
)
})
Expand Down