Handle the case where a query matches at point with zero width.

- The command sequence [M-x phi-search-backward RET ^ RET] will not
  move the cursor to the previous BOL but stay when it is currently at
  BOL.

- The command sequence [M-x phi-replace RET $ RET blah RET ] will
  properly add the string "blah" to all EOLs, where previously EOLs
  preceding a blank line were missed out.  [Fixes zk-phi/phi-search#2]
Move some variable definitions above to suppress warnings.
Merge pull request #2 from knu/zero-width-match

A problem with zero-width matches