@@ -731,6 +731,130 @@ describe "Operators", ->
731731 keydown (' escape' )
732732 expect (editor .getText ()).toBe (" 12345\n\n ABCDE" )
733733
734+ describe " in visual mode" , ->
735+ beforeEach ->
736+ editor .setText " 123456789\n abcde\n fghijklmnopq\n uvwxyz"
737+ editor .setCursorScreenPosition [1 , 1 ]
738+
739+ describe " with characterwise selection on a single line" , ->
740+ it " repeats with ." , ->
741+ keydown ' v'
742+ keydown ' 2'
743+ keydown ' l'
744+ keydown ' c'
745+ editor .insertText " ab"
746+ keydown ' escape'
747+ expect (editor .getText ()).toBe " 123456789\n aabe\n fghijklmnopq\n uvwxyz"
748+
749+ editor .setCursorScreenPosition [0 , 1 ]
750+ keydown ' .'
751+ expect (editor .getText ()).toBe " 1ab56789\n aabe\n fghijklmnopq\n uvwxyz"
752+
753+ it " repeats shortened with . near the end of the line" , ->
754+ editor .setCursorScreenPosition [0 , 2 ]
755+ keydown ' v'
756+ keydown ' 4'
757+ keydown ' l'
758+ keydown ' c'
759+ editor .insertText " ab"
760+ keydown ' escape'
761+ expect (editor .getText ()).toBe " 12ab89\n abcde\n fghijklmnopq\n uvwxyz"
762+
763+ editor .setCursorScreenPosition [1 , 3 ]
764+ keydown ' .'
765+ expect (editor .getText ()).toBe " 12ab89\n abcab\n fghijklmnopq\n uvwxyz"
766+
767+ it " repeats shortened with . near the end of the line regardless of whether motion wrapping is enabled" , ->
768+ atom .config .set (' vim-mode.wrapLeftRightMotion' , true )
769+ editor .setCursorScreenPosition [0 , 2 ]
770+ keydown ' v'
771+ keydown ' 4'
772+ keydown ' l'
773+ keydown ' c'
774+ editor .insertText " ab"
775+ keydown ' escape'
776+ expect (editor .getText ()).toBe " 12ab89\n abcde\n fghijklmnopq\n uvwxyz"
777+
778+ editor .setCursorScreenPosition [1 , 3 ]
779+ keydown ' .'
780+ # this differs from VIM, which would eat the \n before fghij...
781+ expect (editor .getText ()).toBe " 12ab89\n abcab\n fghijklmnopq\n uvwxyz"
782+
783+ describe " is repeatable with characterwise selection over multiple lines" , ->
784+ it " repeats with ." , ->
785+ keydown ' v'
786+ keydown ' j'
787+ keydown ' 3'
788+ keydown ' l'
789+ keydown ' c'
790+ editor .insertText " x"
791+ keydown ' escape'
792+ expect (editor .getText ()).toBe " 123456789\n axklmnopq\n uvwxyz"
793+
794+ editor .setCursorScreenPosition [0 , 1 ]
795+ keydown ' .'
796+ expect (editor .getText ()).toBe " 1xnopq\n uvwxyz"
797+
798+ it " repeats shortened with . near the end of the line" , ->
799+ # this behaviour is unlike VIM, see #737
800+ keydown ' v'
801+ keydown ' j'
802+ keydown ' 6'
803+ keydown ' l'
804+ keydown ' c'
805+ editor .insertText " x"
806+ keydown ' escape'
807+ expect (editor .getText ()).toBe " 123456789\n axnopq\n uvwxyz"
808+
809+ editor .setCursorScreenPosition [0 , 1 ]
810+ keydown ' .'
811+ expect (editor .getText ()).toBe " 1x\n uvwxyz"
812+
813+ describe " is repeatable with linewise selection" , ->
814+ describe " with one line selected" , ->
815+ it " repeats with ." , ->
816+ keydown ' V' , shift : true
817+ keydown ' c'
818+ editor .insertText " x"
819+ keydown ' escape'
820+ expect (editor .getText ()).toBe " 123456789\n x\n fghijklmnopq\n uvwxyz"
821+
822+ editor .setCursorScreenPosition [0 , 7 ]
823+ keydown ' .'
824+ expect (editor .getText ()).toBe " x\n x\n fghijklmnopq\n uvwxyz"
825+
826+ editor .setCursorScreenPosition [2 , 0 ]
827+ keydown ' .'
828+ expect (editor .getText ()).toBe " x\n x\n x\n uvwxyz"
829+
830+ describe " with multiple lines selected" , ->
831+ it " repeats with ." , ->
832+ keydown ' V' , shift : true
833+ keydown ' j'
834+ keydown ' c'
835+ editor .insertText " x"
836+ keydown ' escape'
837+ expect (editor .getText ()).toBe " 123456789\n x\n uvwxyz"
838+
839+ editor .setCursorScreenPosition [0 , 7 ]
840+ keydown ' .'
841+ expect (editor .getText ()).toBe " x\n uvwxyz"
842+
843+ it " repeats shortened with . near the end of the file" , ->
844+ keydown ' V' , shift : true
845+ keydown ' j'
846+ keydown ' c'
847+ editor .insertText " x"
848+ keydown ' escape'
849+ expect (editor .getText ()).toBe " 123456789\n x\n uvwxyz"
850+
851+ editor .setCursorScreenPosition [1 , 7 ]
852+ keydown ' .'
853+ expect (editor .getText ()).toBe " 123456789\n x\n "
854+
855+ xdescribe " is repeatable with block selection" , ->
856+ # there is no block selection yet
857+
734858 describe " the C keybinding" , ->
735859 beforeEach ->
736860 editor .getBuffer ().setText (" 012\n " )
0 commit comments