Skip to content

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

Merged
mattn merged 1 commit intoctrlpvim:masterfrom
mnishz:fix_E94_on_help_window
Feb 8, 2019
Merged

Fix E94 on selecting a file when there is only one help window#503
mattn merged 1 commit intoctrlpvim:masterfrom
mnishz:fix_E94_on_help_window

Conversation

@mnishz
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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