gcmt / taboo.vim

Few utilities for pretty tabs
MIT License
259 stars 35 forks source link

Strange artifacts in tabline names #22

Closed languitar closed 5 years ago

languitar commented 7 years ago

From time to time I see strange artifacts in the tabline for the tab names like the following one: 2017-11-13t13 25 07 01 00

tsiemens commented 6 years ago

I see this deterministically when airline is also enabled (with let g:taboo_tabline = 0)

I can only assume that something in airline is grabbing the string, and doesn't parse out the highlights properly.

Maybe one option would be to add a new flag to turn off tabline highlighting, or to automatically disable them if taboo_tabline is 0

languitar commented 6 years ago

@chrisbra do you have an idea about this issue?

chrisbra commented 6 years ago

When does that happen? Also in such a case, what is the output of eval'ing the result of the tabline setting? And also what vim versions?

Am 16.10.2018 um 19:44 schrieb Johannes Wienke notifications@github.com:

@chrisbra do you have an idea about this issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

tsiemens commented 6 years ago

To reproduce for me, on (VIM - Vi IMproved 8.1, Included patches: 1-146) Ensure that 'vim-airline/vim-airline' is installed at the current version of master as of today. These are the relevant configs I have in my vimrc.

"Airline
set encoding=utf-8 " Necessary to show Unicode glyphs
set nocompatible   " Disable vi-compatibility
set laststatus=2   " Always show the statusline
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts=1
let g:airline_theme = "badwolf"
" Taboo
" Disable Taboo's re-write of the tabline, because airline is doing that.
" We just want it for renaming tabs (only visible when there are multiple tabs)
let g:taboo_tabline = 0

Open vim, and create two different tabs. Don't rename the tabs. In one of the tabs, open a file, and make some change to it, but do not save the file. Examine the tabline on the left side. It will resemble the above shot, with foo.txt%#TabModifiedSelected#*%#TabLineSel# as the tab title for tab with the modified file.

If you switch tabs to focus on the other tab you have open, it will change to foo.txt%#TabModified#*%#TabLine#

Tabline settings (hopefully this is what you meant).

:let g:taboo_tabline
g:taboo_tabline       #0
:let g:taboo_tab_format
g:taboo_tab_format      %f%m
:let g:airline#extensions#tabline#enabled
g:airline#extensions#tabline#enabled #1
chrisbra commented 6 years ago

I see what is going on. If you have airline enabled, the tabline setting will be set to %!airline#extensions#tabline#get(). This function dynamically builds the tabline string to be used by Vim and will eventually call %{airline#extensions#tabline#title(1)} to get the title per tabpage. airline#extensions#tabline#title() basically calls TabooTabTitle() for the given tab page. Unfortunately, this function returns highlighting groups for modified buffers like this: vimrc.old%#TabModifiedSelected#*%#TabLineSel#, which I believe will be interpreted by Vim literally, since this comes from a %{...} expression evaluation and I believe the result is taken literally as the string to be displayed, without evaluating the highlighting groups (in contrast to what is used by e.g. a %! expression, where the result is evaluated again and highlighting groups will be set correctly).

So I think, this needs to be fixed by taboo, to prevent returning additional highlighting groups in the TabooTitle() function (perhaps by using an additional parameter, which would need an adjustment on airline as well).

betterphp commented 5 years ago

Could this function be modified to just return an empty string if g:taboo_tabline is 0? Basically as @chrisbra said but use g:taboo_tabline instead of adding a flag to the function so it can be solved without having to edit airline too.

gcmt commented 5 years ago

Should be solved