Benjamin R. Haskell wrote: > On Fri, 9 Jul 2010, Bram Moolenaar wrote: > > > Matt Wozniski wrote: > > > > > On Thu, Jul 8, 2010 at 5:55 PM, Benjamin R. Haskell wrote: > > > > On Thu, 8 Jul 2010, Bram Moolenaar wrote: > > > >> I'll make it so that synstack() works when on the character just > > > >> after the end of the line. It was already working for an empty > > > >> line, thus should also work when just after the last character. > > > > > > > > Would it make sense to have it work on any character past the end > > > > of the line? I don't use 'virtualedit', but it seems like it'd > > > > make sense to treat the situation similarly. > > > > > > I agree that that would be better. At the very least, it definitely > > > should be returning a list, though - even if you don't want to make > > > all characters after EOL give back the same list, they should at > > > least give back an empty list. > > > > No, if you give an invalid argument it doesn't return a list. If you > > want a List, make sure you always pass a valid argument. > > What will it return for the character just past the end of the line? > > Returning the same as the last character just seems wrong (since there > aren't any syntax items there). (So I assume that's not the planned > change.) > > But if the plan is to return an empty list, it seems weird to not return > an empty list for every character position past the end of the line. > (How is EOL+1 any more 'valid' an argument to synstack() than EOL+29?) > Or is the goal to just return a list for any column position that could > be returned by col()?
At the character just after the end of the line it returns the syntax state at that position. It's always a bit tricky if this is just before, at or after the line break. Note getting back a List means the arguments are wrong. This also happens if the line number is out of range. I don't think making an exception for when the column number is out of range is useful. -- Experience is what you get when you don't get what you want. /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php