Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing spaces in tabline #1631

Closed
IngoMeyer441 opened this issue Jan 9, 2018 · 31 comments · Fixed by #1660
Closed

Missing spaces in tabline #1631

IngoMeyer441 opened this issue Jan 9, 2018 · 31 comments · Fixed by #1660

Comments

@IngoMeyer441
Copy link
Contributor

environment

  • vim: 8.0 patches 1-1401
  • vim-airline: current master (9a2ed35)
  • OS: Debian testing
  • Have you reproduced with a minimal vimrc: yes (see issue text)
  • What is your airline configuration: ???
    if you are using terminal:
  • terminal: xfce4-terminal with tmux
  • $TERM variable: tmux-256color
  • color configuration (:set t_Co?): no
    if you are using Neovim:
  • does it happen in Vim: ???

Since commits ab49a1c and 02816a3 I have noticed missing white space in the tabline. With this minimal vimrc

set nocompatible
set runtimepath+=~/.vim/dein/repos/github.com/Shougo/dein.vim
if dein#load_state(expand('~/.vim/dein'))
  call dein#begin(expand('~/.vim/dein'))
  call dein#add('Shougo/dein.vim')
  call dein#add('vim-airline/vim-airline')
  call dein#end()
  call dein#save_state()
endif

let g:airline#extensions#tabline#enabled = 1

filetype plugin indent on
syntax enable
set background=dark

I get the following tabline with a missing space at the beginning of the first buffer name:
wrong_buffer_line

If powerline symbols are activated addtionally with

let g:airline_powerline_fonts = 1

each buffer name has a missing white space:
wrong_buffer_line_powerline

@chrisbra
Copy link
Member

chrisbra commented Jan 9, 2018

I have been trying to get rid of the double whitespaces in front of the buffer names in the tabline.

I get the following tabline with a missing space at the beginning of the first buffer name:
wrong_buffer_line

That is okay. There is a single whitespace before .bashrc

The second one doesn't have a space in front of the name. But I would see this as acceptable.

You can check the tabline using :echo eval(&tabline[2:]) for what is being printed (to either the statusline or the tabline).

@IngoMeyer441
Copy link
Contributor Author

image
Ah ok, I never realized that there is a double space without powerline fonts since I always use a patched powerline font. Is it perhaps a better solution to only remove the space if powerline fonts are deactivated?

@chrisbra
Copy link
Member

Is it perhaps a better solution to only remove the space if powerline fonts are deactivated?

I can add that check as well.

@kirjavascript
Copy link

kirjavascript commented Jan 17, 2018

I think these changes also now cause an issue with the filenames jumping about when you traverse buffers

gif

a temporary workaround appears to be;

let g:airline#extensions#tabline#left_sep = "\ue0b0 "
let g:airline#extensions#tabline#left_alt_sep = "\ue0b1"

@plexigras
Copy link

and with let g:airline#extensions#tabline#alt_sep = 1 i get

a>b c instead of <a>b c


and with let g:airline#extensions#tabline#left_alt_sep = '' i get

a>b c instead of a>bc

@andreyorst
Copy link

Before update:
screenshot_20180118_174935
1


After update:
2
This looks ok, but not with single file:
3

NORMAL, [tabs] and [buffers] are look normally

@gkapfham
Copy link

gkapfham commented Jan 31, 2018

Hello @IngoHeimbach and others who have reported this issue — thanks for doing so as I have noticed the same problem. Also, many thanks to @chrisbra for developing this pluging as I use it very regularly in Neovim and Vim. I wanted to chime in and note that I am seeing exactly the same issue that @andreyorst shared in the screenshots. The spacing in NVIM v0.2.3-dev looks correct for multiple files but does not look correct (i.e., tight spacing on the left) for a single file.

The only data point that I can add to the discussion is that the file that I open first never has enough spacing on the left regardless of how many buffers I open. Finally, it may be usesful to point out that I am using this plugin with the Devicons plugin and a patched font. Also, I took the advice of @kirjavascript and adding the following lines to my Neovim configuration file:

let g:airline#extensions#tabline#left_sep = "  "
let g:airline#extensions#tabline#left_alt_sep = "  "

Please note that I do not use the triangles in my Airline and thus only needed the spaces. Okay, I hope that this helps! Of course, please let me know if you need more details to resolve this matter. Again, thanks to everyone involved in the development and improvement of this plugin.

@andreyorst
Copy link

The spacing correct for multiple files but does not look correct for a single file.

@gkapfham I must admit, that thiss issue is only about buffers. Tabs works fine. Though when you open a new tab, top line switches to display tabs instead of buffers on tle left side. If you working with single tab, top line shows buffers. And no matter how many buffers are in top line, the spacing is whong.
Buffers:
screenshot_20180131_103520
Tabs:
screenshot_20180131_104158

P.S.: can someone explain me what this 1 at the begining of the tab name mean ( 1 blah2>)? I can't get it since I started to use this plugin. Because in original tabs there is no such thing as I remember.

@tcbbd
Copy link

tcbbd commented Jan 31, 2018

@andreyorst the number means how many windows (i.e. panes) that tab contains

@tcbbd
Copy link

tcbbd commented Jan 31, 2018

change this line

let space= (pgroup == group ? s:spc : '')

to

if get(g:, 'airline_powerline_fonts', 0)
  let space = s:spc
else
  let space= (pgroup == group ? s:spc : '')
endif

will make it look better.

@algmyr
Copy link

algmyr commented Jan 31, 2018

@tcbbd This seems to work quite well with powerline font, with no difference without powerline font. Seems fit for a PR to me.

@slabua
Copy link

slabua commented Jan 31, 2018

Not really. That change would yes add an initial space in front of the first buffer name, but somehow, also in front of the second one.

Before the change:
image

After the change:
image

@andreyorst
Copy link

@slabua not sure how you got this extra space.
screenshot_20180131_170034
Maybe it is related to Devicons plugin?

@slabua
Copy link

slabua commented Jan 31, 2018

@andreyorst in this previous picture of yours, before the change,
image
an initial space is missing before the first buffer and also before the second buffer,
whilst in my red picture, the only missing space is at the very beginning.
Was yours a picture from latest master or some previous commit?

EDIT:
I realised I had set

let g:airline#extensions#tabline#left_sep = "\ue0b0"
let g:airline#extensions#tabline#left_alt_sep = "\ue0b1"

Will test again and report below.

@andreyorst
Copy link

Was yours a picture from latest master or some previous commit

Screenshot represents solution from #1631 (comment) and I also removed workaround from #1631 (comment)

@slabua
Copy link

slabua commented Jan 31, 2018

@andreyorst yup I had forgotten to remove that workaround.
I can confirm that the change works fine for powerline fonts enabled.

@erfanio
Copy link
Contributor

erfanio commented Feb 9, 2018

Just setup a new machine, this drove me crazy because I thought there was problem with my powerline fonts.
Thanks for the fix
Since no one has submitted a pull request, I went ahead and made one.

@gkapfham
Copy link

Hello @IngoHeimbach and @erfanio! First, thanks for raising this issue as I was also experiencing this problem on a regular basis. Second, thanks to @erfanio for developing the fix and @chrisbra for merging it. Finally, I am writing to confirm that I am no longer seeing the problem that was initially reported — the fix is working correctly for me. Thanks everyone!

@shuhaowu
Copy link

I'm still seeing this issue, with the default settings with tabline=1 and the minimalist theme. I'm running the latest master as well:

image

Also furthermore what's the meaning of left_sep/right_sep/left_alt_sep/right_alt_sep? I want to highlight the current buffer with something like buf1 <currentbuffer> buf2, but I can't figure out how they work.

@ghost
Copy link

ghost commented Apr 13, 2018

@shuhaowu Can also confirm the issue still exists. Checked buffers.vim in autoload/airline/extensions/tabline and saw that @erfanio's PR is there, which indicates that vim-airline is already up-to-date. However, first buffer's name is still missing a leading whitespace. All tabline-related configs are pretty much default:

let g:airline_powerline_fonts = 0
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#tab_min_count = 2
let g:airline#extensions#tabline#buffer_min_count = 2

@chrisbra Should the issue be re-opened?

@slabua
Copy link

slabua commented Apr 13, 2018

What I have seen is that with powerline fonts enabled, there is a single space before each buffer, whilst with powerline fonts disabled, there is no space before the first buffer and a single space before each subsequent buffer.
Not sure this is the expected behaviour, but this is what I am reproducing.

@chrisbra
Copy link
Member

IIRC this is expected behaviour.

@ghost
Copy link

ghost commented Apr 13, 2018

What a pity... Now I can't unsee it & my OCD is tingling like crazy...
If someone else has a fix for this then it would be awesome.

@chrisbra
Copy link
Member

What a pity... Now I can't unsee it & my OCD is tingling like crazy...

I don't understand what you are talking about. What exactly is the problem?

@algmyr
Copy link

algmyr commented Apr 13, 2018

Lack of leading space I presume.

@ghost
Copy link

ghost commented Apr 13, 2018

@chrisbra It's what @slabua described before.

@slabua
Copy link

slabua commented Apr 13, 2018

@khoacao96 in other words you'd like to also have a leading space in front of the first buffer when not using powerline fonts?

@ghost
Copy link

ghost commented Apr 14, 2018

@slabua Yes, exactly. I mean, when not using powerline fonts, there's a space in front of all the buffer names, except for the first buffer. Why not make it consistent?

@chrisbra
Copy link
Member

I'll have a look.

@chrisbra
Copy link
Member

I think this should be fixed now with the last commit

@ghost
Copy link

ghost commented Apr 15, 2018

@chrisbra Can confirm the issue is fixed. Thank you!

YCbCr pushed a commit to YCbCr/vim-airline that referenced this issue May 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.