ExcelLikeVim icon indicating copy to clipboard operation
ExcelLikeVim copied to clipboard

Undo does not work

Open michaelfresco opened this issue 7 years ago • 13 comments

What a cool plugin!

I think that u does not work properly. When I delete a row with dd and then press u you'd expect it to undo the most recent delete. Is undo not implemented yet? Or do I really miss something basic here.

Cheers

michaelfresco avatar Feb 24 '18 09:02 michaelfresco

Thanks for telling!

Sorry, as you guess, the undo feature hasn't been implemented yet.

I'm thinking to implement, though I haven't come up with the solution of how to do it because excel application does not have the undo feature for the action invoked by VBA function.

It may be the solution that when a function invoked, putting the reverse function of it to a stack and calling a function from the stack when doing undo. But it seems complex..

For now, I will modify the README to note that undo feature is missing.

kjnh10 avatar Feb 24 '18 11:02 kjnh10

This makes me sad. Even ctrl+z doesn't undo which makes this awesome tool pretty much unusable. \sigh\

BenKettlewell avatar Mar 15 '19 22:03 BenKettlewell

Yeah, I was enjoying this tool right up to the point that I deleted a line by accident and wasn't even able to use the default mouse click undo or ctrl-z. Really needs a solution in order to be usable. When I'm editing things in vim I'm used to deleting stuff all the time and then just pressing 'u'.

CaptNapalm avatar Apr 05 '19 16:04 CaptNapalm

@CaptNapalm Sorry for reply.

The fundamental modification seems difficult to me as I explained above. Sorry.

My work around is ・save file frequently ・'dd' saves the line to a kind of regisiter, so you can recover the line by pushing 'p' key.

kjnh10 avatar Apr 26 '19 10:04 kjnh10

Regarding 'dd' followed by 'p' to recover a value from a "register". I ran into a possible bug which can be reproduced by:

  1. Type 'dd' to delete a row,
  2. type 'O' to open a line above,
  3. type 'p' to paste the line in the newly opened row. This resulted in a debug window in which I click 'End' and
  4. subsequently do 'p' again.

This results in the following text being pasted (which did not occur in my spreadsheet):

タウン   MPM入力の進行 全体ワークフロー作成 たたき台完成     ########   7                     8/20/2015    

analyticd avatar Nov 19 '19 05:11 analyticd

@analyticd Thanks for bug reporting. Much appreciated.

I maybe fixed the bug in the hotfixes/yank_paste branch. (not released yet) Could you check out it and test it?

kjnh10 avatar Nov 20 '19 16:11 kjnh10

@kjnh10 I checked out the hotfixes/yank_paste branch and tested. You seem to have fixed the paste of Japanese text issue.

Possibly an important thing for you to know is that when I first start up a spreadsheet when vimx is enabled as an add-in and I press say, 'j', I get a message about reopening the registry.(not sure the suffix here sorry) and then a pop up dialog that has a message: 'couldn't get newkey'. If I click 'ok' in that dialog then I can proceed.

For some reason 'dd' doesn't seem to work for me, and thus 'y' yank has no effect subsequently, in 2.3.4 or in the hotfixes/yank_paste branch. If I do the same in visual mode (line or cell wise), i.e., visual - d - y, it works.

If you navigate to a new cell and then do 'y' it still pastes to the same location it was prior. I realize this is probably a shortcoming of the feature and something you may implement later.

analyticd avatar Nov 21 '19 20:11 analyticd

strange...

Does 'dd' delete lines and but not put the line to register? Or even not delete?

could you open VB Editor and execute manually 'n_dd' sub in 'vimize' module? At first, I want to know this sub fails or keystroke 'dd' fails to connect to 'n_dd' sub.

Anyway thanks for investigating.

kjnh10 avatar Nov 22 '19 03:11 kjnh10

Ok, I navigated to a cell using vimx navigation, entered a number in a cell and left my cursor there. On the Developer tab I then created a macro (using 'Macros' button) and typed 'vimize.n_dd' and then ran it. It succeeded in deleting the row. So that is good. I subsequently tried to do the same with 'dd' but it pauses for a while (I know because if I try to navigate using vimx keys they don't response for the second or so) and then does nothing. So at least you know more now.

For now, as I said earlier, at least visual mode allows similar functionality. More often than not I'd use visual mode anyway because it isn't common that I'd delete a whole row in Excel (unless I can subsequently paste it via 'y'), but rather only a cell. 'y' after a visual mode deletion works well by the way.

Once you figure out undo, this will be really great. It is already really useful.

analyticd avatar Nov 24 '19 20:11 analyticd

Thanks,

I have few more questions. (1): 'gg' works as jumping to first row. (this is to confirm to continuous key stroke (not single key )is working) (2): paste is via 'p' not 'y'? or are you using costomize file (configure.bas)?ll

Regarding undo feature, this seems difficult to implement as I described on top of this therad....

kjnh10 avatar Nov 25 '19 16:11 kjnh10

  1. 'gg' does not work
  2. Sorry I wasn't clear. 'y' to copy and 'p' to paste work fine.

Re undo: yes I saw that you said that, I was just offering encouragement to undertake the task (unless it is too much of course).

In your use of vimx, how do you workaround not having undo? If you share this information, perhaps we can adopt similar approach to mitigate undo issues.

analyticd avatar Nov 25 '19 19:11 analyticd

I also just hit the Undo issue about 5 minutes into my test.

I understand that it might be difficult to implement u as Undo if Excel doesn't expose this on the VBA side but why does Ctrl+Z not work anymore with ExcelLikeVim enabled?

snth avatar Apr 30 '24 10:04 snth