@@ -20,6 +20,8 @@ export interface GhosttyCellRange {
2020const DEFAULT_SELECTION_BACKGROUND = "rgba(72, 122, 191, 0.35)" ;
2121const POWERLINE_SOLID_RIGHT = "\ue0b0" ;
2222const POWERLINE_SOLID_LEFT = "\ue0b2" ;
23+ const POWERLINE_ROUND_RIGHT = "\ue0b4" ;
24+ const POWERLINE_ROUND_LEFT = "\ue0b6" ;
2325
2426function cssColor ( color : GhosttyColor ) : string {
2527 return `rgb(${ color . r } , ${ color . g } , ${ color . b } )` ;
@@ -36,25 +38,44 @@ function sameTextStyle(left: GhosttyCell, right: GhosttyCell): boolean {
3638}
3739
3840function isSolidPowerlineSeparator ( text : string ) : boolean {
39- return text === POWERLINE_SOLID_RIGHT || text === POWERLINE_SOLID_LEFT ;
41+ return (
42+ text === POWERLINE_SOLID_RIGHT ||
43+ text === POWERLINE_SOLID_LEFT ||
44+ text === POWERLINE_ROUND_RIGHT ||
45+ text === POWERLINE_ROUND_LEFT
46+ ) ;
4047}
4148
4249// Fallback fonts inset or scale these private-use glyphs, leaving a gap where
43- // the separator should meet the next cell. Fill the triangle from the cell's
44- // own edges instead, as native terminals do.
50+ // the separator should meet the next cell. Fill the triangle or half-ellipse
51+ // from the cell's own edges instead, as native terminals do.
4552function fillSolidPowerlineSeparator (
4653 context : CanvasRenderingContext2D ,
4754 text : string ,
4855 left : number ,
4956 top : number ,
5057 width : number ,
5158 height : number ,
59+ seamOverlap : number ,
5260) : void {
5361 const right = left + width ;
62+ const middle = top + height / 2 ;
63+ if ( text === POWERLINE_ROUND_RIGHT || text === POWERLINE_ROUND_LEFT ) {
64+ const [ base , start , inward ] =
65+ text === POWERLINE_ROUND_RIGHT ? [ left , - Math . PI / 2 , - 1 ] : [ right , Math . PI / 2 , 1 ] ;
66+ context . beginPath ( ) ;
67+ context . ellipse ( base , middle , width , height / 2 , 0 , start , start + Math . PI ) ;
68+ context . closePath ( ) ;
69+ // Overlap the segment this cap closes so anti-aliasing at a fractional
70+ // cell edge does not leave a hairline seam.
71+ context . rect ( Math . min ( base , base + inward * seamOverlap ) , top , seamOverlap , height ) ;
72+ context . fill ( ) ;
73+ return ;
74+ }
5475 const [ base , point ] = text === POWERLINE_SOLID_RIGHT ? [ left , right ] : [ right , left ] ;
5576 context . beginPath ( ) ;
5677 context . moveTo ( base , top ) ;
57- context . lineTo ( point , top + height / 2 ) ;
78+ context . lineTo ( point , middle ) ;
5879 context . lineTo ( base , top + height ) ;
5980 context . closePath ( ) ;
6081 context . fill ( ) ;
@@ -234,6 +255,7 @@ export function renderGhosttySnapshot(options: {
234255 top ,
235256 metrics . width ,
236257 height ,
258+ 1 ,
237259 ) ;
238260 }
239261 runStart += 1 ;
@@ -311,7 +333,7 @@ export function renderGhosttySnapshot(options: {
311333 if ( cell ?. text ) {
312334 context . fillStyle = cssColor ( snapshot . background ) ;
313335 if ( isSolidPowerlineSeparator ( cell . text ) ) {
314- fillSolidPowerlineSeparator ( context , cell . text , left , top , metrics . width , height ) ;
336+ fillSolidPowerlineSeparator ( context , cell . text , left , top , metrics . width , height , 0 ) ;
315337 } else {
316338 context . font = fontForCell ( cell , fontSize , fontFamily ) ;
317339 context . fillText ( cell . text , left , top + metrics . baseline , metrics . width ) ;
0 commit comments