Skip to content

Commit

Permalink
fix(plugins/plugin-bash-like): wide shell output may not properly lin…
Browse files Browse the repository at this point in the history
…e wrap

Fixes kubernetes-sigs#6530
  • Loading branch information
starpit committed Jan 11, 2021
1 parent 4e2ad5d commit 18ab6a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 12 additions & 5 deletions plugins/plugin-bash-like/src/pty/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,20 @@ function sameStyle(cell1: IBufferCell, cell2: IBufferCell): boolean {
*
*/
function squashRow(row: IBufferLine, previous: IBufferCell, current: IBufferCell, cells: XtermResponseCell[]) {
row.getCell(0, previous)
let runningSquash = createCell(previous)
cells.push(runningSquash)
let runningSquash: XtermResponseCell

row.getCell(0, previous) // this copies the first cell into `previous`
if (cells[cells.length - 1] && sameStyle(previous, current)) {
runningSquash = cells[cells.length - 1]
runningSquash.innerText += previous.getChars()
} else {
runningSquash = createCell(previous)
cells.push(runningSquash)
}

for (let idx = 1; idx < row.length; idx++) {
row.getCell(idx - 1, previous)
row.getCell(idx, current)
row.getCell(idx - 1, previous) // previous now holds cells[idx-1]
row.getCell(idx, current) // current now holds cells[idx]

if (sameStyle(previous, current)) {
// same decoration from one cell to the next
Expand Down
1 change: 1 addition & 0 deletions plugins/plugin-bash-like/web/scss/xterm.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ body[kui-theme-style] .kui--tab-content {
}
.xterm-terminated .xterm-rows > div {
white-space: pre-wrap;
word-break: break-all;
height: auto; /* min-height and height: see https://github.com/IBM/kui/issues/1630 */
}
/*.xterm-terminated.error .xterm-rows > div {
Expand Down

0 comments on commit 18ab6a1

Please sign in to comment.