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

Fix util echo function: ensure l:msg is a list after split() #1498

Merged
merged 1 commit into from
Oct 13, 2017

Conversation

Kaycell
Copy link
Contributor

@Kaycell Kaycell commented Oct 6, 2017

There was a bug on GoBuild with vim74. The variable l:msg in util echo function is a string even after calling split() that causes a crash on the map() call.
Issue #1483

@bhcleek
Copy link
Collaborator

bhcleek commented Oct 7, 2017

@Kleww thank you for the contributation. #1483 was filed against an old version of Vim. What is the lowest version of Vim where you've seen l:msg be a string instead of list?

@Kaycell
Copy link
Contributor Author

Kaycell commented Oct 7, 2017

I have seen this bug on this vim version:

VIM - Vi IMproved 7.4
Included patches: 1-488, 576
Extra patches: 8.0.0322, 8.0.0056

I know it's a bit old but I'm stuck with it at work... I didn't encounter any problem on last vim version.
I am not an expert at all in vimL but currently:

function! s:echo(msg, hi)
 let l:msg = a:msg
    if type(l:msg) != type([])
    let l:msg = split(l:msg, "\n")
endif

If a:msg is a string l:msg will be a string then a list (which old vim version doesn't allow), isn't this could be error-prone ?

@arp242
Copy link
Contributor

arp242 commented Oct 13, 2017

Thanks, seems to work well 👍

I would strongly recommend updating to a newer Vim version though. You should be able to just install it to ~/vim or some such, don't need root permissions (./configure --prefix=$HOME/vim). This is what I used to do when I was stuck on some ancient CentOS box years ago :-)

@arp242 arp242 merged commit 863008a into fatih:master Oct 13, 2017
@Kaycell Kaycell deleted the fix-util-echo-function branch October 13, 2017 08:41
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 this pull request may close these issues.

3 participants