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 E94 on selecting a file when there is only one help window #503

Merged
merged 1 commit into from
Feb 8, 2019

Conversation

mnishz
Copy link

@mnishz mnishz commented Feb 8, 2019

Summary

Fix E94 on selecting a file when there is only one help window.

How to recreate

  1. vim -c 'help | only'
  2. :CtrlPMRUFiles or another CtrlP command
  3. Select any file
  4. E94 occurs

Cause

#444 has changed the behavior when the current buffer type is 'help' so that s:openfile() would always use 'b' command. This works well for :CtrlPBufTag, but doesn't work for other commands like :CtrlPMRUFiles.

let cmd =
  \ md == 't' || s:splitwin == 1 ? ( useb ? 'tab sb' : 'tabe' ) :
  \ md == 'h' || s:splitwin == 2 ? ( useb ? 'sb' : 'new' ) :
  \ md == 'v' || s:splitwin == 3 ? ( useb ? 'vert sb' : 'vne' ) :
  \ &bt == 'help' ? 'b' :
  \ call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e'])

Fix

Use 'b' only if the current buffer type is 'help' and the opening file is the help file itself. Otherwise, use ctrlp#normcmd() function as before. (ctrlp#normcmd() looks for a available normal window to open the file and assumes that a window for 'help' is not available, so, #444 (#437) occurs.)

I also found that md == 't' <c-t>, md == 'h' <c-x> and md == 'v' <c-v> doesn't work for :CtrlPBufTag. So I created l:openmyself to set l:useb correctly.

Validation

@mattn mattn merged commit 2e773fd into ctrlpvim:master Feb 8, 2019
@mattn
Copy link
Member

mattn commented Feb 8, 2019

Thank you

@mnishz mnishz deleted the fix_E94_on_help_window branch February 9, 2019 02:40
@mnishz
Copy link
Author

mnishz commented Feb 9, 2019

Thank you for merging!

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