On Saturday, May 18, 2013 3:21:15 PM UTC+4, Bram Moolenaar wrote: > Troydm (?) wrote: > > > > > v7-3-768 commit introduced following check for InsertEnter autocommand > > > event execution e.g. calling check_cursor_col() > > > > > > http://pastebin.com/tShmNDDz > > > > > > However after this commit some of my plugins that heavily rely on > > InsertEnter > > > stopped working namely because some of those plugins change cursor > > > position on autocommand event thus making those changes obsolete and > > > cursor position not changing > > > > > > As i see this is a bug however i'm not sure if it's a bug or expected > > > behavior > > > > > > The way to fix this is to save cursor position only after autocommand > > > event is executed e.g. moving following line > > > > > > pos_T save_cursor = curwin->w_cursor; > > > > > > after this call > > > > > > apply_autocmds(EVENT_INSERTENTER, NULL, NULL, FALSE, curbuf); > > > > > > So is this a bug or not? > > > > The documentation says that the InsertEnter autocommand must not move > > the cursor: > > > > InsertEnter Just before starting Insert mode. Also for > > Replace mode and Virtual Replace mode. The > > |v:insertmode| variable indicates the mode. > > Be careful not to move the cursor or do > > anything else that the user does not expect. > > > > Why do you want to move the cursor, what is it for? > > > > -- > > User: I'm having problems with my text editor. > > Help desk: Which editor are you using? > > User: I don't know, but it's version VI (pronounced: 6). > > Help desk: Oh, then you should upgrade to version VIM (pronounced: 994). > > > > /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ > > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ > > \\\ an exciting new programming language -- http://www.Zimbu.org /// > > \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Well for example one of my plugins includes bash shell emulation inside a vim buffer, it's called shellasync.vim and it's source code is at https://github.com/troydm/shellasync.vim, it uses InsertEnter to check if user went into insert mode while his cursor was on prefix of shell e.g. '$' symbol and if it does it just automaticly moves cursor on 3rd col instead. For a user of my plugin (atleast for me) this is an expected behaviour -- -- You received this message from the "vim_dev" 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 --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
