jceb / vim-orgmode

Text outlining and task management for Vim based on Emacs' Org-Mode
http://www.vim.org/scripts/script.php?script_id=3642
Other
3.12k stars 267 forks source link

New Subhead Keybindings do not appear to work on the last subhead. #208

Closed stephenprater closed 8 years ago

stephenprater commented 8 years ago

Given a ORG file that looks like this where the cursor is marked by <>

* My Item
** My Other Item<>

When pressing <leader>hh to create a new subhead at the same indent level as the current line, nothing happens. <leader>hn does create a new subhead above the current line.

It works perfectly on all but the last line. Is this the expected behavior?

jceb commented 8 years ago

I can't reproduce the issue. For me both mapping produce the same result. Would you check what both mappings refer to by posting the results of :map <localleader>hh?

stephenprater commented 8 years ago

Sorry - typo in my map - I mean <localleader>hN

:map <localleader>hh #=> n \hh @<Plug>OrgNewHeadingBelowNormal :map <localleader>hN #=> n \hN @<Plug>OrgNewHeadingAboveNormal

But the hh mapping is the one that doesn't work if the cursor is on the last line.

To make sure it's not a problem with the map, I ran

execute "normal \<Plug>OrgNewHeadingBelowNormal"

And nothing happens. (AboveNormal works fine.)

I'm using Neovim, so I assume this is some difference between Vim and Neovim. Honestly, I don't expect you to fix this by any means, but if you can just kinda point me to the place to look, I'll see if I can come up with a "cross-compatible" fix.

jceb commented 8 years ago

Neovim was the important hint. I can reproduce the issue with Neovim but it works fine with Vim. Unfortunately, I don't have the time to track down the issue.

I was able to produce a nice traceback by calling <leader>cn on the last heading. There seems to be a difference in how new lines can are add in Neovim:

Error detected while processing function provider#python#Call:
line   18:
NvimError('Index out of bounds',)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/neovim/msgpack_rpc/session.py", line 177, in handler
    rv = self._request_cb(name, args)
  File "/usr/lib/python2.7/site-packages/neovim/api/common.py", line 237, in filter_request_cb
    walk(self._in, args, self, name, 'request'))
  File "/usr/lib/python2.7/site-packages/neovim/plugin/host.py", line 65, in _on_request
    rv = handler(*args)
  File "/usr/share/nvim/runtime/autoload/provider/script_host.py", line 77, in python_execute
    exec(script, self.module.__dict__)
  File "<string>", line 1, in <module>
NvimError: Index out of bounds
stephenprater commented 8 years ago

Excellent! I will look into it.

jceb commented 8 years ago

This issue is related to issue #213.

Ron89 commented 8 years ago

Issue fixed with pull request #214. I'm closing the issue.