chjj / blessed

A high-level terminal interface library for node.js.
Other
11.2k stars 528 forks source link

Emojis break boxes [bug] #422

Open Kycermann opened 2 years ago

Kycermann commented 2 years ago

Emojis seem to have double (?) the width of normal characters. This isn't accounted for in a box when using .pushLine.

β”‚Test 🐒                        β”‚
β”‚                              β”‚ 
β”‚                              β”‚                                                
β”‚                              β”‚                                                
asnewman commented 2 years ago

@Kycermann some emojis have two character lengths. You can see this by doing "🐒".length (output would be 2)

Kycermann commented 2 years ago

That's true but they shouldn't distort the Blessed boxes they're in and at the moment they do

p0ut commented 1 year ago

@Kycermann This bug has been finally patched in a fork by kenan. here

Kycermann commented 1 year ago

@p0ut awesome, seems like here doesn't have a link though

p0ut commented 1 year ago

@Kycermann Apologies, https://github.com/kenan238/reblessed

p0ut commented 1 year ago

@Kycermann So just a quick update so I don't mislead you, both myself and kenan are looking into the emoji issue. It is caused by the library not being able to detect the width of emoji's. Initially, we managed to 'semi-patch' such characters, however it still occurs on certain emoji's.

It seems that most character ranges are hard coded. We are doing our best to try to find a sufficient fix for this and I will keep you updated here.

Kycermann commented 1 year ago

@p0ut cheers, I appreciate it!