From 57c7e6af4703cd4040da36baa36bd3f47a166e14 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 11 Aug 2021 15:19:12 -0700 Subject: [PATCH] add more characters --- src/browser/renderer/BoxAndBlockCharacters.ts | 147 ++++++++++-------- src/common/CoreTerminal.ts | 7 +- 2 files changed, 84 insertions(+), 70 deletions(-) diff --git a/src/browser/renderer/BoxAndBlockCharacters.ts b/src/browser/renderer/BoxAndBlockCharacters.ts index de8a349c..b57a9c56 100644 --- a/src/browser/renderer/BoxAndBlockCharacters.ts +++ b/src/browser/renderer/BoxAndBlockCharacters.ts @@ -232,76 +232,85 @@ export const enum RIGHT { const MOVE = 'M'; const TO = 'L'; -const BOLD = '!'; +const THICK = '!'; + +const yAxis = `${MOVE}${CENTER.TOP} ${TO}${CENTER.BOTTOM}`; +const xAxis = `${MOVE}${LEFT.MIDDLE} ${TO}${RIGHT.MIDDLE}`; +const bottomYAxisFromBottom = `${MOVE}${CENTER.BOTTOM} ${TO}${CENTER.MIDDLE}`; +const bottomYAxisFromMiddle = `${MOVE}${CENTER.MIDDLE} ${TO}${CENTER.BOTTOM}`; +const topYAxisFromTop = `${MOVE}${CENTER.TOP} ${TO}${CENTER.MIDDLE}`; +const topYAxisFromMiddle = `${MOVE}${CENTER.TOP} ${TO}${CENTER.MIDDLE}`; +const rightMiddleXAxis = `${MOVE}${CENTER.MIDDLE} ${TO}${RIGHT.MIDDLE}`; +const leftMiddleXAxis = `${MOVE}${CENTER.MIDDLE} ${TO}${LEFT.MIDDLE}`; export const chars: { [index: string]: string } = { - '━': `${MOVE}${LEFT.MIDDLE} ${TO}${RIGHT.MIDDLE}`, - '│': `${MOVE}${CENTER.TOP} ${TO}${CENTER.BOTTOM}`, - '┃': `${MOVE}${CENTER.TOP} ${TO}${CENTER.BOTTOM}${BOLD}`, - '┌': `${MOVE}${CENTER.BOTTOM} ${TO}${CENTER.MIDDLE} ${TO}${RIGHT.MIDDLE}`, - '┍': `${MOVE}${CENTER.BOTTOM} ${TO}${CENTER.MIDDLE} ${TO}${RIGHT.MIDDLE}${BOLD}`, - '┎': `${MOVE}${CENTER.BOTTOM} ${TO}${CENTER.MIDDLE}${BOLD} ${TO}${RIGHT.MIDDLE}`, - '┏': `${MOVE}${CENTER.BOTTOM} ${TO}${CENTER.MIDDLE}${BOLD} ${TO}${RIGHT.MIDDLE}${BOLD}`, - '┐': `${MOVE}${CENTER.BOTTOM} ${TO}${CENTER.MIDDLE} ${TO}${LEFT.MIDDLE}`, - '┑': `${MOVE}${CENTER.BOTTOM} ${TO}${CENTER.MIDDLE} ${TO}${LEFT.MIDDLE}${BOLD}`, - '┒': `${MOVE}${CENTER.BOTTOM} ${TO}${CENTER.MIDDLE}${BOLD} ${TO}${LEFT.MIDDLE}`, - '┓': `${MOVE}${CENTER.BOTTOM} ${TO}${CENTER.MIDDLE}${BOLD} ${TO}${LEFT.MIDDLE}${BOLD}` - // '└': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┕': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┖': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┗': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┘': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┙': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┚': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┛': `${MOVE}${} ${TO}${} ${TO}${}`, - // '├': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┝': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┞': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┟': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┠': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┡': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┢': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┣': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┤': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┥': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┦': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┧': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┨': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┩': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┪': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┫': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┬': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┭': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┮': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┯': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┰': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┱': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┲': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┳': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┴': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┵': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┶': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┷': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┸': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┹': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┺': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┻': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┼': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┽': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┾': `${MOVE}${} ${TO}${} ${TO}${}`, - // '┿': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╀': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╁': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╂': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╃': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╄': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╅': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╆': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╇': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╈': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╉': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╊': `${MOVE}${} ${TO}${} ${TO}${}`, - // '╋': `${MOVE}${} ${TO}${} ${TO}${}`, + '━': `${xAxis}`, + '│': `${yAxis}`, + '┃': `${yAxis}${THICK}`, + '┌': `${bottomYAxisFromBottom} ${TO}${RIGHT.MIDDLE}`, + '┍': `${bottomYAxisFromBottom} ${TO}${RIGHT.MIDDLE}${THICK}`, + '┎': `${bottomYAxisFromBottom}${THICK} ${TO}${RIGHT.MIDDLE}`, + '┏': `${bottomYAxisFromBottom}${THICK} ${TO}${RIGHT.MIDDLE}${THICK}`, + '┐': `${bottomYAxisFromBottom} ${TO}${LEFT.MIDDLE}`, + '┑': `${bottomYAxisFromBottom} ${TO}${LEFT.MIDDLE}${THICK}`, + '┒': `${bottomYAxisFromBottom}${THICK} ${TO}${LEFT.MIDDLE}`, + '┓': `${bottomYAxisFromBottom}${THICK} ${TO}${LEFT.MIDDLE}${THICK}`, + '└': `${topYAxisFromTop} ${TO}${RIGHT.MIDDLE}`, + '┕': `${topYAxisFromTop} ${TO}${RIGHT.MIDDLE}${THICK}`, + '┖': `${topYAxisFromTop}${THICK} ${TO}${RIGHT.MIDDLE}`, + '┗': `${topYAxisFromTop}${THICK} ${TO}${RIGHT.MIDDLE}${THICK}`, + '┘': `${topYAxisFromTop} ${TO}${LEFT.MIDDLE}`, + '┙': `${topYAxisFromTop} ${TO}${LEFT.MIDDLE}${THICK}`, + '┚': `${topYAxisFromTop}${THICK} ${TO}${LEFT.MIDDLE}`, + '┛': `${topYAxisFromTop}${THICK} ${TO}${LEFT.MIDDLE}${THICK}`, + '├': `${yAxis} ${rightMiddleXAxis}`, + '┝': `${yAxis} ${rightMiddleXAxis}${THICK}`, + '┞': `${topYAxisFromTop}${THICK} ${bottomYAxisFromMiddle} ${rightMiddleXAxis}`, + '┟': `${bottomYAxisFromBottom}${THICK} ${topYAxisFromMiddle} ${rightMiddleXAxis}${THICK}`, + '┠': `${yAxis}${THICK} ${rightMiddleXAxis}`, + '┡': `${bottomYAxisFromBottom} ${topYAxisFromMiddle}${THICK} ${rightMiddleXAxis}${THICK}`, + '┢': `${bottomYAxisFromBottom}${THICK} ${topYAxisFromMiddle} ${rightMiddleXAxis}${THICK}`, + '┣': `${yAxis}${THICK} ${rightMiddleXAxis}${THICK}`, + '┤': `${yAxis} ${leftMiddleXAxis}`, + '┥': `${yAxis} ${leftMiddleXAxis}${THICK}`, + '┦': `${topYAxisFromTop}${THICK} ${bottomYAxisFromMiddle} ${leftMiddleXAxis}`, + '┧': `${bottomYAxisFromBottom}${THICK} ${topYAxisFromMiddle} ${leftMiddleXAxis}${THICK}`, + '┨': `${yAxis}${THICK} ${leftMiddleXAxis}`, + '┩': `${bottomYAxisFromBottom} ${topYAxisFromMiddle}${THICK} ${leftMiddleXAxis}${THICK}`, + '┪': `${bottomYAxisFromBottom}${THICK} ${topYAxisFromMiddle} ${leftMiddleXAxis}${THICK}`, + '┫': `${yAxis}${THICK} ${leftMiddleXAxis}${THICK}`, + '┬': `${bottomYAxisFromBottom} ${xAxis}`, + '┭': `${bottomYAxisFromBottom} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}`, + '┮': `${bottomYAxisFromBottom} ${leftMiddleXAxis} ${rightMiddleXAxis}${THICK}`, + '┯': `${bottomYAxisFromBottom} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}${THICK}`, + '┰': `${bottomYAxisFromBottom}${THICK} ${xAxis}`, + '┱': `${bottomYAxisFromBottom}${THICK} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}`, + '┲': `${bottomYAxisFromBottom} ${leftMiddleXAxis} ${rightMiddleXAxis}${THICK}`, + '┳': `${bottomYAxisFromBottom}${THICK} ${xAxis}${THICK}`, + '┴': `${topYAxisFromTop} ${xAxis}`, + '┵': `${topYAxisFromTop} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}`, + '┶': `${topYAxisFromTop} ${leftMiddleXAxis} ${rightMiddleXAxis}${THICK}`, + '┷': `${topYAxisFromTop} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}${THICK}`, + '┸': `${topYAxisFromTop}${THICK} ${xAxis}`, + '┹': `${topYAxisFromTop}${THICK} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}`, + '┺': `${topYAxisFromTop} ${leftMiddleXAxis} ${rightMiddleXAxis}${THICK}`, + '┻': `${topYAxisFromTop}${THICK} ${xAxis}${THICK}`, + '┼': `${yAxis} ${xAxis}`, + '┽': `${yAxis} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}`, + '┾': `${yAxis} ${leftMiddleXAxis} ${rightMiddleXAxis}${THICK}`, + '┿': `${yAxis} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}${THICK}`, + '╀': `${yAxis}${THICK} ${xAxis}`, + '╁': `${yAxis}${THICK} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}`, + '╂': `${yAxis} ${leftMiddleXAxis} ${rightMiddleXAxis}${THICK}`, + '╃': `${yAxis}${THICK} ${xAxis}${THICK}`, + '╄': `${yAxis} ${xAxis}`, + '╅': `${yAxis} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}`, + '╆': `${yAxis} ${leftMiddleXAxis} ${rightMiddleXAxis}${THICK}`, + '╇': `${yAxis} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}${THICK}`, + '╈': `${yAxis}${THICK} ${xAxis}`, + '╉': `${yAxis}${THICK} ${leftMiddleXAxis}${THICK} ${rightMiddleXAxis}`, + '╊': `${yAxis} ${leftMiddleXAxis} ${rightMiddleXAxis}${THICK}`, + '╋': `${yAxis}${THICK} ${xAxis}${THICK}` // '╌': `${MOVE}${} ${TO}${} ${TO}${}`, // '╍': `${MOVE}${} ${TO}${} ${TO}${}`, // '╎': `${MOVE}${} ${TO}${} ${TO}${}`, @@ -372,7 +381,7 @@ export function draw(ctx: CanvasRenderingContext2D, c: string, xOffset: number, } const numX = Number.parseFloat(coords[0].toString()) || Number.parseInt(coords[0].toString()); const numY = Number.parseFloat(coords[1].toString()) || Number.parseInt(coords[1].toString()); - if (instruction.endsWith(BOLD)) { + if (instruction.endsWith(THICK)) { ctx.lineWidth = lineWidth * 2; } else { ctx.lineWidth = lineWidth; diff --git a/src/common/CoreTerminal.ts b/src/common/CoreTerminal.ts index 32341d8d..7c3f0e03 100644 --- a/src/common/CoreTerminal.ts +++ b/src/common/CoreTerminal.ts @@ -149,7 +149,12 @@ export abstract class CoreTerminal extends Disposable implements ICoreTerminal { // this.write('▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇'); this.write('━━│┃\r\n'); this.write(' ━━│┃┌┍┎┏\r\n'); - this.write(' ━━│┃┌┐┍┑┎┒┏┓'); + this.write(' ━━│┃┌┐┍┑┎┒┏┓\r\n'); + this.write(' └┘┕┙┖┚┗┛\r\n'); + this.write('├┝┞┟┠┡┢┣┤┥┦┧┨┩┪┫┬┭┮┯┰┱┲┳┴┵┶┷┸┹┺┻┼┽┾┿╀╁╂╃╄╅╆╇╈╉╊╋╌╍╎╏═║╒╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡╢╣╤╥╦╧╨╩╪╫╬╭╮╯╰╱╲╳╴╵╶╷╸╹╺╻╼╽╾╿\r\n'); + this.write('├ ┝ ┞ ┟ ┠ ┡ ┢ ┣ ┤ ┥ ┦ ┧ ┨ ┩ ┪ ┫ ┬ ┭ ┮ ┯ ┰ ┱ ┲ ┳ ┴ ┵ ┶ ┷ ┸ ┹ ┺ ┻\r\n'); + this.write('┼ ┽ ┾ ┿ ╀ ╁ ╂ ╃ ╄ ╅ ╆ ╇ ╈ ╉ ╊ ╋\r\n'); + this.write('╌ ╍ ╎ ╏ ═ ║ ╒ ╓ ╔ ╕ ╖ ╗ ╘ ╙ ╚ ╛ ╜ ╝ ╞ ╟ ╠ ╡ ╢ ╣ ╤ ╥ ╦ ╧ ╨ ╩ ╪ ╫ ╬ ╭ ╮ ╯ ╰ ╱ ╲ ╳ ╴ ╵ ╶ ╷ ╸ ╹ ╺ ╻ ╼ ╽ ╾ ╿\r\n'); }, 1000); }