Refactor out max_lines into its own method

Originally submitted at: https://github.com/wincent/Command-T/pull/94

(Greg: there is a slight semantic change here because 0 was previously
the smallest possible value; with this change, it's 1, but I think this
should be ok because in practice Vim won't let us make a 0-height
window.)

Signed-off-by: Greg Hurrell <greg@hurrell.net>
Remove dead code

This line has been useless since 07f1d7cb26257ace.
Use `#max`/`#min` more consistently

Rather than employing a mixture of styles (ternaries, postfix
conditionals etc), let's use `#max` and `#min` seeing as we recently set
the precedent for it when we extracted the `#max_lines` method.
Use `#each_with_index` to save a line
Use parens consistently

One call to `#match_text_for_idx` was using parens around the method
parameter list and the other was not; let's just use parens consistently
throughout.
Re-use idx rather than recalcuating it
Remove useless `else` branches

We're not going to implement looping or scrolling at this point, as
things have been working quite nicely as-is.
Disallow scrolling

We never intended to allow scrolling (see the previous commit) but it
was actually possible to make it happen with some careful staging.

Namely, you could trick Command-T into scrolling by constraining the
amount of available space by opening many splits; this didn't affect the
`#max_lines` calculation, so Command-T thought it has more room than it
actually did. Under these circumstances, you'd hit the end of the range
and be able to scroll past it to see more matches; not broken, but not
intended either.

Compare that with what happens when you change the size of your terminal
window; _that_ constraint does get picked up.

With this change, we set the desired window height and then read it back
to see what we actually got, effectively preventing scrolling because we
never put more results in the buffer than would fit on the screen.
Fix 'index out of bounds' exception

When you try to scroll past the bottom on a window where there are more
matches than displayable real estate.

Originally submitted at: https://github.com/wincent/Command-T/pull/94

(Greg: I was unable to repro this, but it doesn't hurt to have this in
there in the context of the refactoring that I'm doing in nearby commits
to prevent scrolling.)

Signed-off-by: Greg Hurrell <greg@hurrell.net>
Further robustify scroll-prevention

The old version of this code worked by inverting the order of the match
list results and then allowing the rest of the code to proceed as usual.
Now that we're trying to deal with the nuances of things like different
constraint models (external resizing vs internal pressure from splits)
things will be more robust if we recognize that the match results may be
more than we can display, and explicitly rendering things in reverse.

This gives us some nice benefits, such as better handling edge cases
like having `g:CommandTMatchWindowReverse` set in conjunction with
`g:CommandTMinHeight` and too few results to fill the height; previously
we'd show them up the top of the results window instead of the bottom,
but now we do the right thing.

Overall, the code gets simpler in some places and more complicated in
others. It would be nice to follow up later with a refactoring to clean
up this class.
Set scrolloff to 0 during match window display

So the match window isn't supposed to scroll, but in testing for recent
commits I discovered some edge cases where it could be made to scroll.
In theory those edge cases are now all sealed, but just in case they
aren't, let's turn `'scrolloff'` off.
Don't allow selection of empty lines

When `g:CommandTMinHeight` is in effect, it is possible that there are
not enough matches to fill the entire match window. Ensure that we don't
allow selection of blank/empty lines in this case.
Make type ahead find work intuitively with reversed match window

Recent refactorings inverted the sense of this method (meaning that you
would search from the bottom when the listing was reversed); this commit
makes things work as you'd expect for both possible values of
`g:CommandTMatchWindowReverse`.
doc: update AUTHORS/HISTORY sections

Add Richard Feldman to list of Authors.
Rename prev -> _prev

We needed to name our "next" method "_next" to avoid clashing with a
language keyword; for symmetry, let's prefix the "prev" method in the
same way.
Merge branch 'rtfeldman/fix-index-out-of-bounds' into next

Originally submitted at: https://github.com/wincent/Command-T/pull/94

I wasn't able to repro the issue, but in trying to do so I was able to
uncover a couple of edge cases. Specifically, we try to avoid scrolling
but it was still possible to trigger scrolling by constraining the
available space with a lot of splits; so I made changes that ensure that
we really can't scroll ever. As a bonus, also fixed the wart wherein if
you had `g:CommandTMatchWindowReverse` set to 1, and
`g:CommandTMinHeight`, and there were not enough matches to fill the
minimum height, we were showing the matches at the top of the match
window instead of the bottom.

The `MatchWindow` class has a fair bit of bit-rot at the moment and
could use a clean-up, but I've tested it fairly thoroughly in its
current state and I think it should be functionally pretty solid at
least.

* rtfeldman/fix-index-out-of-bounds:
  Rename prev -> _prev
  doc: update AUTHORS/HISTORY sections
  Make type ahead find work intuitively with reversed match window
  Don't allow selection of empty lines
  Set scrolloff to 0 during match window display
  Further robustify scroll-prevention
  Fix 'index out of bounds' exception
  Disallow scrolling
  Remove useless `else` branches
  Re-use idx rather than recalcuating it
  Use parens consistently
  Use `#each_with_index` to save a line
  Use `#max`/`#min` more consistently
  Remove dead code
  Refactor out max_lines into its own method
Add scanner based on git ls-files

Originally submitted at: https://github.com/wincent/Command-T/pull/95

This squashes two commits:

- https://github.com/pfhayes/Command-T/commit/ee0aea14775d6721f11605db2e35f4e0f4c36002
- https://github.com/pfhayes/Command-T/commit/aa061af5ecab0d7492392442ab1479de44eaf594

Signed-off-by: Greg Hurrell <greg@hurrell.net>
doc: update AUTHORS/HISTORY section

Add Patrick Hayes.
Abbreviate license header
Simplify require statements

No need to pull in "command-t/vim" as that gets pulled in from
"command-t/scanner/file_scanner".

Instead of "command-t/scanner/file_scanner", pull in
"command-t/scanner/file_scanner/find_file_scanner", which is our
superclass; as it was, we had an ordering dependency which relied on
some other file having required the superclass before we get evaluated,
which isn't good.

There's no need to pull in "open3" as the superclass is already doing
that.

Explicit is better than implicit and all that, but this is Ruby, land of
magic, and of slow require statements.