misfo / jim

Vim mode for Ace (Github & Cloud9's editor)
http://misfo.github.com/jim
MIT License
65 stars 3 forks source link

Fixes for H, M, L motions #22

Closed sourrust closed 13 years ago

sourrust commented 13 years ago

H, M and L where calling an array that didn't exist.

misfo commented 13 years ago

Thanks, man. Must have goofed a refactor...

Can you write a test that demonstrates the issue in the second commit?

On Aug 29, 2011, at 6:17 PM, sourrustreply@reply.github.com wrote:

H, M and L where calling an array that didn't exist.

Reply to this email directly or view it on GitHub: https://github.com/misfo/jim/pull/22

sourrust commented 13 years ago

For when M got a decimal or when lastFullyVisibleRow returns more rows than there are lines? Or both?

sourrust commented 13 years ago

I keep getting back a no method error when testing for M

Ace: motions: M (1, 0, 1)Rerun
Died on test #1: Object [object Object] has no method 'getFirstFullyVisibleRow' - {}

My best guess is that the tests never renders ace, so there isn't a getFirstFullyVisibleRow or getLastFullyVisibleRow method.

However, both are pretty easy to replicate:

lastFullyVIsibleRow Without any changes

  1. In a javascript console type jim.adaptor.lastFullyVisibleRow()

For my case I would get back 42 when it should only be 16

decimal With changes, but minus Math.floor

  1. Delete one line so there is an odd amount of lines, 15 lines
  2. press M

You end up at the beginning line 9 instead of on the first non-blank character on line 8

misfo commented 13 years ago

We're gonna have to mock a few of those viewport-related methods on the renderer. I'll write some tests for H, M, and L (my bad, should have wrote them on the first go round) that will mock out those methods...

Thanks again for spotting these

misfo commented 13 years ago

I wrote some tests for H, M, and L and exposed @renderer to the tests: https://github.com/misfo/jim/commit/4abcb387dc81057c21704651efaeebcd18e62fa1#L1R46

So it's will be easy peasy to mock out renderer methods now. Thanks for the pull