gruvbox-community / gruvbox

Retro groove color scheme for Vim - community maintained edition
MIT License
801 stars 62 forks source link

Strange behavior when rendering emoji #129

Open ledhed2222 opened 4 years ago

ledhed2222 commented 4 years ago

When editing files in nvim with gruvbox where I have emojis in the file, the entire display is just...messed up? I don't know how else to describe it. Adding a video of what I mean (I had to attach it as a .zip due to github file requirements).

Screen Recording 2020-02-27 at 16.43.16.zip

Basically you'll note in this video that the first line of the shown file is line 2, and there is odd additional spacing on the lines after each line that contains emoji: 23 and 24. Other odd things happen when navigating. You'll also not that resizing my window immediately fixes the issue?

I'm really amazed that this could be caused by a colorscheme, but that's what it seems to be. I was using the OG https://github.com/morhetz/gruvbox and tried to see if this fork fixed the issue, but apparently not.

nvim -v 0.4.3 Terminal is kitty 0.16.0, though I can recreate this in MacOS Terminal I am not running gruvbox_256pallete.sh

Here's my init.vim that recreates it:

set nocompatible                                                                                                
filetype off                                                                                                    
let s:editor_root=expand($XDG_CONFIG_HOME . '/nvim')                                                            
let &rtp=&rtp . ',' . s:editor_root . '/bundle/Vundle.vim'                                                      
call vundle#begin(s:editor_root . '/bundle')                                                                    
Plugin 'VundleVim/Vundle.vim'                                                                                   
Plugin 'gruvbox-community/gruvbox'                                                                              
call vundle#end()                                                                                               
filetype plugin indent on                                                                                       
colorscheme gruvbox

Weirdly, I'm having trouble creating for you a minimal example of the kind of file with an emoji in it that causes the issue, but I see it regularly when actually working with files containing emoji. I happen to have been troubleshooting this with a small ruby script that you should be able to use as a minimal-ish example.

require "time"

RECEIVER_FILES = ["baml_n1.log", "baml_n2.log"]
SENDER_FILES = ["bot_n1.log", "bot_n2.log"]

def retrieve(files)
  files.map do |file|
    File.read(file).split("\n")
  end
end

def order(file_a, file_b)
  file_a.concat(file_b).sort_by do |line|
    Time.parse(line[0..40])
  end
end

def label(file_array, with:)
  file_array.map { |line| "#{with} #{line}" }
end

def main
  receiver = label(order(*retrieve(RECEIVER_FILES)), with: "⬅️")
  sender = label(order(*retrieve(SENDER_FILES)), with: "➡️")
  combined = order(receiver, sender)

  File.write("receiver.log", receiver.join("\n"))
  File.write("sender.log", sender.join("\n"))
  File.write("combined.log", combined.join("\n"))
end

main
ledhed2222 commented 4 years ago

I want to show some of the other bizarre behavior when navigating around the file. I promise that for this entire recording I'm in normal mode. Notice how weird copies of text are rendered as I use w to navigate through the line containing the emoji. Also, the cursor is not correctly moving to the space containing the character immediately after the emoji, clearly because the emoji is being rendered as wider than any of the other characters, for some reason.

Screen Recording 2020-02-27 at 16.56.46.zip