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 the error if buffer list empty #159

Closed
wants to merge 1 commit into from

Conversation

thomasding
Copy link

There is an issue that the plugin will raise an exception if there is no buffers in the buffer list.

It can be shown by opening Vim, opening a help doc, setting the help window as the only window and then calling LeaderfBuffer.

self._max_bufname_len = max((int(lfEval("strdisplaywidth('%s')"
% escQuote(getBasename(buffers[nr].name))))
for nr in mru.getMruBufnrs() if nr in buffers),
default=0)
Copy link
Owner

@Yggdroot Yggdroot May 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks in advance. But max() does not have "default" argument in python2 and python3 that version is less than 3.4.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the fix can be like this:

        self._max_bufname_len = max([int(lfEval("strdisplaywidth('%s')"
                                        % escQuote(getBasename(buffers[nr].name))))
                                    for nr in mru.getMruBufnrs() if nr in buffers] or [0])

Yggdroot added a commit that referenced this pull request May 17, 2018
@Yggdroot Yggdroot closed this May 17, 2018
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.

2 participants