Closed lacygoill closed 7 years ago
Thanks for reporting this. I'll examine your suggestion thoroughly as soon as I can.
I think the proper way to fix this is to let s:N = 0
as part of the initialization of the script's status, which amounts to having an empty completion chain. When a completion chain is empty, s:next_method()
just returns an empty string.
This is fixed in the current master the way I have outlined above. Feel free to reopen this if necessary.
Bug hunters like you help making this plugin better and better. Thanks!
Hello,
If I hit
C-x C-p C-l
at the end of this line:I have the following error:
The bug occurs when you type a key to move backward OR forward in the chain, without having invoked a method in the chain at least once before.
Initially, I thought the solution was to initialize
s:N
incycle()
, exactly as it was defined incomplete()
. But then, I realized that it wasn't a good idea to let the user calls:next_method()
, without having entered the chain at least once.If they've never entered the chain, they have no position inside it. So, there's no reference point on which base our relative motion in the chain. IOW, it doesn't make sense to try and support this weird / edge case.
Maybe the best solution is to prevent
s:next_method()
to be called when the user never invoked a method in the chain.How do we know whether they invoked a method? If they did, the
mucomplete#complete()
function was invoked at least once. It it was, it must have created the variables:N
. Besides,s:N
is only created insidemucomplete#complete()
, nowhere else. It means there's an equivalence between the existence of this variable and the user having invoked a method at least once.So, to fix this bug, inside
mucomplete#cycle()
we could test the existence ofs:N
before invokings:next_method()
.