def test_vi_cursor_movements():
 feed = partial(_feed_cli_with_input, editing_mode=EditingMode.VI)
 (result, cli) = feed(u'\x1b\n')
 assert (result.text == u'')
 assert (cli.editing_mode == EditingMode.VI)
 (result, cli) = feed(u'hello\x1bhaX\n')
 assert (result.text == u'hellXo')
 (result, cli) = feed(u'hello\x1bIX\n')
 assert (result.text == u'Xhello')
 (result, cli) = feed(u'hello\x1bIX\n')
 assert (result.text == u'Xhello')
 (result, cli) = feed(u'hello\x1b2hiX\n')
 assert (result.text == u'heXllo')
 (result, cli) = feed(u'hello\x1b2h2liX\n')
 assert (result.text == u'hellXo')
 (result, cli) = feed(u'hello\x08\x08\n')
 assert (result.text == u'hel')
 (result, cli) = feed(u'hello\x08\x08\n')
 assert (result.text == u'hel')
 (result, cli) = feed(u'hello\x1b2hD\n')
 assert (result.text == u'he')
 (result, cli) = feed(u'hello\x1b2hrX\n')
 assert (result.text == u'heXlo')

def test_vi_cursor_movements ( ) : feed = partial ( _feed_cli_with_input , editing_mode = EditingMode . VI ) ( result , cli ) = feed ( u'\x1b\n' ) assert ( result . text == u'' ) assert ( cli . editing_mode == EditingMode . VI ) ( result , cli ) = feed ( u'hello\x1bhaX\n' ) assert ( result . text == u'hellXo' ) ( result , cli ) = feed ( u'hello\x1bIX\n' ) assert ( result . text == u'Xhello' ) ( result , cli ) = feed ( u'hello\x1bIX\n' ) assert ( result . text == u'Xhello' ) ( result , cli ) = feed ( u'hello\x1b2hiX\n' ) assert ( result . text == u'heXllo' ) ( result , cli ) = feed ( u'hello\x1b2h2liX\n' ) assert ( result . text == u'hellXo' ) ( result , cli ) = feed ( u'hello\x08\x08\n' ) assert ( result . text == u'hel' ) ( result , cli ) = feed ( u'hello\x08\x08\n' ) assert ( result . text == u'hel' ) ( result , cli ) = feed ( u'hello\x1b2hD\n' ) assert ( result . text == u'he' ) ( result , cli ) = feed ( u'hello\x1b2hrX\n' ) assert ( result . text == u'heXlo' )
test cursor movements with vi key bindings .