junegunn/vader.vim

Undo Doesn't Work

flwyd opened this issue · 0 comments

flwyd commented

A single u command in a Do block seems to revert all prior commands in the Do, not just the last one. A double u returns to the initial state of the previous test case.

Contents of undo.vader:

Given (Some text):
  Lorem ipsum dolor sit amet

Do (Delete three words, then undo one):
  dwdwdwu

Expect:
  dolor sit amet


Given (A second test):
  foo bar baz

Do (Duplicate the text twice, undo once, delete a word):
  yyppudw

Expect:
  foo bar baz
  bar baz


Given (A third test):
  Apples Bananas Cherries

Do (Move the first character of each word after the second, undo twice):
  xpwxpwxpuu

Expect:
  pAples aBnanas Cherries

and undo.vimrc:

filetype off
set rtp+=~/.vim/plugged/vader.vim
filetype plugin indent on
syntax enable

Running vim -N -u /tmp/undo.vimrc '+Vader! /tmp/undo.vader' produces

Vader note: cannot print to stderr reliably/directly.  Please consider using Vim's -es/-Es option (mode=n).
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 12 2020 00:47:07)
macOS version
Included patches: 1-539
Compiled by travis@Traviss-Mac.local
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               +cursorshape       +job               +mouse_urxvt       +scrollbind        +transparency
+arabic            +dialog_con_gui    +jumplist          +mouse_xterm       +signs             +user_commands
+autocmd           +diff              +keymap            +multi_byte        +smartindent       +vartabs
+autochdir         +digraphs          +lambda            +multi_lang        -sound             +vertsplit
-autoservername    +dnd               +langmap           -mzscheme          +spell             +virtualedit
+balloon_eval      -ebcdic            +libcall           +netbeans_intg     +startuptime       +visual
+balloon_eval_term +emacs_tags        +linebreak         +num64             +statusline        +visualextra
+browse            +eval              +lispindent        +odbeditor         -sun_workshop      +viminfo
++builtin_terms    +ex_extra          +listcmds          +packages          +syntax            +vreplace
+byte_offset       +extra_search      +localmap          +path_extra        +tag_binary        +wildignore
+channel           -farsi             +lua/dyn           +perl/dyn          -tag_old_static    +wildmenu
+cindent           +file_in_path      +menu              +persistent_undo   -tag_any_white     +windows
+clientserver      +find_in_path      +mksession         +popupwin          -tcl               +writebackup
+clipboard         +float             +modify_fname      +postscript        +termguicolors     -X11
+cmdline_compl     +folding           +mouse             +printer           +terminal          -xfontset
+cmdline_hist      -footer            +mouseshape        +profile           +terminfo          +xim
+cmdline_info      +fork()            +mouse_dec         +python/dyn        +termresponse      -xpm
+comments          +fullscreen        -mouse_gpm         +python3/dyn       +textobjects       -xsmp
+conceal           -gettext           -mouse_jsbterm     +quickfix          +textprop          -xterm_clipboard
+cryptv            -hangul_input      +mouse_netterm     +reltime           +timers            -xterm_save
+cscope            +iconv             +mouse_sgr         +rightleft         +title             
+cursorbind        +insert_expand     -mouse_sysmouse    +ruby/dyn          +toolbar           
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework AppKit   -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE 

Starting Vader: 1 suite(s), 3 case(s)
  Starting Vader: /tmp/undo.vader
    (1/3) [  GIVEN] Some text
    (1/3) [     DO] Delete three words, then undo one
    (1/3) [ EXPECT] (X)
      - Expected:
          dolor sit amet
      - Got:
          Lorem ipsum dolor sit amet
    (2/3) [  GIVEN] A second test
    (2/3) [     DO] Duplicate the text twice, undo once, delete a word
    (2/3) [ EXPECT] (X)
      - Expected:
          foo bar baz
          bar baz
      - Got:
          bar baz
    (3/3) [  GIVEN] A third test
    (3/3) [     DO] Move the first character of each word after the second, undo twice
    (3/3) [ EXPECT] (X)
      - Expected:
          pAples aBnanas Cherries
      - Got:
          foo bar baz
  Success/Total: 0/3
Success/Total: 0/3 (assertions: 0/0)
Elapsed time: 0.01 sec.