Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
e01e9c9
start on #130406
meganrogge Aug 9, 2021
3b3ef09
keep working
meganrogge Aug 9, 2021
3b8218e
work with Daniel
meganrogge Aug 10, 2021
ee759e2
line up vertically
meganrogge Aug 10, 2021
12980fb
start from scratch, some progress
meganrogge Aug 11, 2021
db845a6
make a bunch of progress
meganrogge Aug 11, 2021
57c7e6a
add more characters
meganrogge Aug 11, 2021
927a142
add more
meganrogge Aug 11, 2021
46cb378
more working
meganrogge Aug 11, 2021
d13afa1
get things to work
meganrogge Aug 12, 2021
9104385
convert a bunch of them
meganrogge Aug 12, 2021
07513c9
more
meganrogge Aug 12, 2021
6b7b279
refactor
meganrogge Aug 13, 2021
263e5b9
Improve testing characters and use fake terminal for demo
Tyriar Aug 13, 2021
f83ebdb
Refactors and implementing new shapes
Tyriar Aug 13, 2021
7549f0e
Clean up
Tyriar Aug 13, 2021
7344d62
clean up
meganrogge Aug 16, 2021
323317b
Merge branch 'master' into merogge/pixelPerfect
meganrogge Aug 16, 2021
62aa91a
clean up
meganrogge Aug 16, 2021
63dcd6e
Merge branch 'merogge/pixelPerfect' of https://github.com/meganrogge/…
meganrogge Aug 16, 2021
3aace14
Merge branch 'master' into merogge/pixelPerfect
Tyriar Aug 17, 2021
2b3c763
Clean up mixed weight characters
Tyriar Aug 17, 2021
f43ae16
Implement curved lines
Tyriar Aug 17, 2021
fd25ee0
Add some doc comments
Tyriar Aug 17, 2021
9269e91
Make bold triple normal weight so 1 dpr = 3px bold
Tyriar Aug 17, 2021
bcfbbb4
Correct horizontal dash and a mixed weight char
Tyriar Aug 17, 2021
ca88476
Improve spacing of dash characters
Tyriar Aug 17, 2021
9fb1ce1
Add setting, clean up drawing, fix true color
Tyriar Aug 18, 2021
86a30dc
Clean up usage of instruction/definition
Tyriar Aug 18, 2021
e5d66d6
Fix offset of block elements
Tyriar Aug 18, 2021
0aaa20f
Start of webgl integration
Tyriar Aug 18, 2021
fe7f28a
Fix block elements on webgl, scale block elements to cell
Tyriar Aug 18, 2021
da09281
Support shade char with patterns
Tyriar Aug 18, 2021
011026a
Get webgl glyphs scaling to cell size, invalidate on option change
Tyriar Aug 18, 2021
54ce017
Add test custom glyph button to demo
Tyriar Aug 18, 2021
158dcb0
Remove custom glyph tests
Tyriar Aug 19, 2021
3be9784
Rename setting customGlyphs
Tyriar Aug 19, 2021
24cbedb
Fix custom glyphs when using transparency
Tyriar Aug 19, 2021
338d94d
Fix webgl alignment issues
Tyriar Aug 19, 2021
ca4c9c3
Merge branch 'master' into merogge/pixelPerfect
Tyriar Aug 19, 2021
1a75416
Add missing block elements (include all 0x2580-0x259F)
Tyriar Aug 19, 2021
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
53 changes: 38 additions & 15 deletions demo/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,17 @@ function createTerminal(): void {
// Set terminal size again to set the specific dimensions on the demo
updateTerminalSize();

fetch('/terminals?cols=' + term.cols + '&rows=' + term.rows, {method: 'POST'}).then((res) => {
res.text().then((processId) => {
pid = processId;
socketURL += processId;
socket = new WebSocket(socketURL);
socket.onopen = runRealTerminal;
socket.onclose = runFakeTerminal;
socket.onerror = runFakeTerminal;
});
});
// fetch('/terminals?cols=' + term.cols + '&rows=' + term.rows, {method: 'POST'}).then((res) => {
// res.text().then((processId) => {
// pid = processId;
// socketURL += processId;
Comment thread
Tyriar marked this conversation as resolved.
Outdated
// socket = new WebSocket(socketURL);
// socket.onopen = runRealTerminal;
// socket.onclose = runFakeTerminal;
// socket.onerror = runFakeTerminal;
// });
// });
runFakeTerminal();
}, 0);
}

Expand All @@ -246,11 +247,33 @@ function runFakeTerminal(): void {
term.write('\r\n$ ');
};

term.writeln('Welcome to xterm.js');
term.writeln('This is a local terminal emulation, without a real terminal in the back-end.');
term.writeln('Type some keys and commands to play around.');
term.writeln('');
term.prompt();
// term.writeln('Welcome to xterm.js');
// term.writeln('This is a local terminal emulation, without a real terminal in the back-end.');
// term.writeln('Type some keys and commands to play around.');
// term.writeln('');
// term.prompt();

term.write('Box styles: ┎┰┒┍┯┑╓╥╖╒╤╕ ┏┳┓┌┲┓┌┬┐┏┱┐\n\r');
term.write('┌─┬─┐ ┏━┳━┓ ╔═╦═╗ ┠╂┨┝┿┥╟╫╢╞╪╡ ┡╇┩├╊┫┢╈┪┣╉┤\n\r');
term.write('│ │ │ ┃ ┃ ┃ ║ ║ ║ ┖┸┚┕┷┙╙╨╜╘╧╛ └┴┘└┺┛┗┻┛┗┹┘\n\r');
term.write('├─┼─┤ ┣━╋━┫ ╠═╬═╣ ┏┱┐┌┲┓┌┬┐┌┬┐ ┏┳┓┌┮┓┌┬┐┏┭┐\n\r');
term.write('│ │ │ ┃ ┃ ┃ ║ ║ ║ ┡╃┤├╄┩├╆┪┢╅┤ ┞╀┦├┾┫┟╁┧┣┽┤\n\r');
term.write('└─┴─┘ ┗━┻━┛ ╚═╩═╝ └┴┘└┴┘└┺┛┗┹┘ └┴┘└┶┛┗┻┛┗┵┘\n\r');
term.write('\n\r');
term.write('Other:\n\r');
term.write('╭─╮ ╲ ╱ ╷╻╎╏┆┇┊┋ ╺╾╴ ╌╌╌ ┄┄┄ ┈┈┈\n\r');
term.write('│ │ ╳ ╽╿╎╏┆┇┊┋ ╶╼╸ ╍╍╍ ┅┅┅ ┉┉┉\n\r');
term.write('╰─╯ ╱ ╲ ╹╵╎╏┆┇┊┋\n\r');
term.write('\n\r');
term.write('All box drawing characters:\n\r');
term.write('─ ━ │ ┃ ┄ ┅ ┆ ┇ ┈ ┉ ┊ ┋ ┌ ┍ ┎ ┏\n\r');
term.write('┐ ┑ ┒ ┓ └ ┕ ┖ ┗ ┘ ┙ ┚ ┛ ├ ┝ ┞ ┟\n\r');
term.write('┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┬ ┭ ┮ ┯\n\r');
term.write('┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻ ┼ ┽ ┾ ┿\n\r');
term.write('╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋ ╌ ╍ ╎ ╏\n\r');
term.write('═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟\n\r');
term.write('╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ ╭ ╮ ╯\n\r');
term.write('╰ ╱ ╲ ╳ ╴ ╵ ╶ ╷ ╸ ╹ ╺ ╻ ╼ ╽ ╾ ╿\n\r');

term.onKey((e: { key: string, domEvent: KeyboardEvent }) => {
const ev = e.domEvent;
Expand Down
55 changes: 46 additions & 9 deletions src/browser/renderer/BaseRenderLayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { IBufferService, IOptionsService } from 'common/services/Services';
import { throwIfFalsy } from 'browser/renderer/RendererUtils';
import { channels, color, rgba } from 'browser/Color';
import { removeElementFromParent } from 'browser/Dom';
import { boxCharacters, boxDrawingBoxes, drawBoxChar } from 'browser/renderer/BoxAndBlockCharacters';

export abstract class BaseRenderLayer implements IRenderLayer {
private _canvas: HTMLCanvasElement;
Expand Down Expand Up @@ -259,10 +260,13 @@ export abstract class BaseRenderLayer implements IRenderLayer {
this._ctx.font = this._getFont(false, false);
this._ctx.textBaseline = 'ideographic';
this._clipRow(y);
this._ctx.fillText(
cell.getChars(),
x * this._scaledCellWidth + this._scaledCharLeft,
y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight);
// TODO: fix
if (!this._drawBoxChar(cell, x, y)) {
this._ctx.fillText(
cell.getChars(),
x * this._scaledCellWidth + this._scaledCharLeft,
y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight);
}
}

/**
Expand Down Expand Up @@ -373,14 +377,47 @@ export abstract class BaseRenderLayer implements IRenderLayer {
if (cell.isDim()) {
this._ctx.globalAlpha = DIM_OPACITY;
}
// Draw the character
this._ctx.fillText(
cell.getChars(),
x * this._scaledCellWidth + this._scaledCharLeft,
y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight);
if (!this._drawBoxChar(cell, x, y)) {
// Draw the character
this._ctx.fillText(
cell.getChars(),
x * this._scaledCellWidth + this._scaledCharLeft,
y * this._scaledCellHeight + this._scaledCharTop + this._scaledCharHeight);
}
this._ctx.restore();
}

private _drawBoxChar(cell: ICellData, x: number, y: number): boolean {
const char = cell.getChars();

const boxes = boxDrawingBoxes[char];
if (boxes) {
this._ctx.strokeStyle = this._ctx.fillStyle;
const xOffset = x * this._scaledCellWidth + this._scaledCharLeft;
const yOffset = y * this._scaledCellHeight + this._scaledCharTop;
for (let i = 0; i < boxes.length; i++) {
const box = boxes[i];
const xEighth = this._scaledCellWidth / 8;
const yEighth = this._scaledCellHeight / 8;
this._ctx.fillRect(
xOffset,
yOffset,
box.w * xEighth,
box.h * yEighth);
}
return true;
}

const lineSegments = boxCharacters[char];
if (!lineSegments) {
return false;
}
this._ctx.strokeStyle = this._ctx.fillStyle;
drawBoxChar(this._ctx, char, x * this._scaledCellWidth, y * this._scaledCellHeight, this._scaledCellWidth, this._scaledCellHeight);
return true;
}


/**
* Clips a row to ensure no pixels will be drawn outside the cells in the row.
* @param y The row to clip.
Expand Down
Loading