Skip to content

Some emojis move entire line upwards when rendered at bottom of terminal #679

Closed
@ghost

Description

I noticed an issue when rendering certain emojis using SetContent. It works fine, unless the Emoji is on the bottom row of the terminal, in which case it moves the whole line upwards.

Tested in Alacritty, Kitty and xfce-terminal and it happens in all of them so I don't think it's terminal specific.

Running the code below, you would expect the bottom line to contain an emoji, then the letter T, but they will be 1 line up instead.

package main

import (
    "github.com/gdamore/tcell/v2"
    //"time"
)

func main() {
    s, err := tcell.NewScreen()
    if err != nil {
        panic(err)
    }
    s.Init()
    defStyle := tcell.StyleDefault.Background(tcell.ColorReset).Foreground(tcell.ColorReset)
    s.SetStyle(defStyle)
    
    termWidth, termHeight := s.Size()
    _, _ = termWidth, termHeight
    
    s.SetContent(4, termHeight-1, 'T', nil, defStyle)
    s.SetContent(1, termHeight-1, '🥹', []rune{' '}, defStyle)
    
    
    for {
        s.Show()
        // Poll event
        ev := s.PollEvent()
        // Process event
        switch ev := ev.(type) {
        case *tcell.EventResize:
            s.Sync()
        case *tcell.EventKey:
            if ev.Key() == tcell.KeyEscape || ev.Key() == tcell.KeyCtrlC {
                s.Fini()
                return
            }
        }
        
    }
}

This is what it looks like:
wrong

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions