On Wed, Aug 19, 2009 at 3:40 AM, <codesite-nore...@google.com> wrote: > > > Comment #5 on issue 288 by jeffwheeler: Cursor status is not up to date > http://code.google.com/p/yi-editor/issues/detail?id=288 > > As m.niloc pointed out, this breaks the Vim implementation. Iin the cmd > mode, it never even refreshes from > the box cursor (e.g. after entering with ':').
I'm going to explain the idea of how this works, so other people can fix details like this. Consider Yi.Keymap.extractTopKeymap. It constructs the keymap that's actually going to be used. Notice that it runs startKeymap once and then repeats the topKeymap. Each mode can modify the KeymapSet. In particular, the minibuffer mode (what you call cmd mode) uses "insertKeymap" for topKeymap. (check spawnMinibufferE). So the issue you observe is because the startKeymap for vim always sets "insert" to false. So one way of fixing it would be two "startKeymaps", one for insert, one for global. Would you like to give it a shot? Now, I need to explain why there must not be any action written in a repeatable part of the keymap. (ie. why you can't put the setInsert False at the beginning of the toplevel keymap). The reason is because those keymaps are often modified by modes (or the user) by disjunction with some thing else. Then you get a keymap like this: (someEvent >> userAction) <|> (write (setInsert False >> someOtherEvent >> stdAction) The situation is that the keymap interpreter does not know whether to write "setInsert False" until it can choose which branch to take. So effectively it is delayed by 1 event. (On top of that, if the user branch is taken, setInsert will never be written) > The first option seems > strange since the keymap ought to know > whether it's in insertion mode without a config option. The view is that the keymap is just one aspect of the config. To "emulate" emacs or vim there are a number of things that have to be tuned. (Anyway, I can agree to your argument) > the latter option > seems better, although I don't > immediately see how to implement it. It is a little annoying. Whenever a new buffer is created the start actions have to be pulled out of the keymap and ran. > (Sorry I have been so quiet recently; I just moved to Chicago on Sunday, > and I'll move to my college dorm > room in Urbana on Thursday. I've only occassionally even had internet.) Wishing you the best in your new city, JP. --~--~---------~--~----~------------~-------~--~----~ Yi development mailing list yi-devel@googlegroups.com http://groups.google.com/group/yi-devel -~----------~----~----~----~------~----~------~--~---