//! Text object, visual selection, indentation and paste contracts. mod support; use notescraft_vim::Mode; #[test] fn word_paragraph_and_delimited_objects() { support::check( &[ ("o|ne two", "diw", "| two"), ("one t|wo", "diw", "one| "), ("o|ne two", "daw", "|two"), ("one t|wo", "daw", "on|e"), ("é|é two", "diw", "| two"), ("o|ne,two next", "diW", "| next"), ("o|ne,two next", "daW", "|next"), ("o|ne two", "ciwX", "|X two"), ("o|ne two", "cawX", "|Xtwo"), ("o|ne two", "gUiw", "|ONE two"), ("O|NE two", "guiw", "|one two"), ("o|Ne two", "g~iw", "|OnE two"), ("|one\ntwo\n\nthree", "dip", "|\nthree"), ("|one\ntwo\n\nthree", "dap", "|three"), ("one\n\n|two\nthree", "dip", "one\n|"), ("(|abc)", "di(", "(|)"), ("(|abc)", "di)", "(|)"), ("(|abc)", "dib", "(|)"), ("x (a|bc) y", "da(", "x | y"), ("x (a|bc) y", "da)", "x | y"), ("x (a|bc) y", "dab", "x | y"), ("[|abc]", "di[", "[|]"), ("x [a|bc] y", "da[", "x | y"), ("{|abc}", "di{", "{|}"), ("{|abc}", "diB", "{|}"), ("x {a|bc} y", "da{", "x | y"), ("x {a|bc} y", "daB", "x | y"), ("\"|abc\"", "di\"", "\"|\""), ("x \"a|bc\" y", "da\"", "x |y"), ("'|abc'", "di'", "'|'"), ("x 'a|bc' y", "da'", "x |y"), ("`|abc`", "di`", "`|`"), ("x `a|bc` y", "da`", "x |y"), ("(é|猫🙂)", "di(", "(|)"), ("[é|猫🙂]", "da[", "|"), ("\"é|猫🙂\"", "ci\"α", "\"|α\""), ("(|a(b)c)", "di(", "(|)"), ("(a(|b)c)", "di(", "(a(|)c)"), ("|abc", "di(", "|abc"), ("|abc", "di\"", "|abc"), ], Mode::Normal, ); } #[test] fn visual_operators_and_indentation() { support::check( &[ ("|abc", "vd", "|bc"), ("|abc", "vld", "|c"), ("ab|c", "vhd", "|a"), ("|abc", "vlcX", "|Xc"), ("|abc", "vx", "|bc"), ("|é猫🙂", "vld", "|🙂"), ("|abc\ndef", "Vd", "|def"), ("|a\nb\nc", "Vjd", "|c"), ("|a\nb", "VcX", "|X\nb"), ("|aBc", "vl~", "|Abc"), ("|abc", "vlU", "|ABc"), ("|ABC", "vlu", "|abC"), ("o|ne two", "viwd", "| two"), ("(|abc)", "vi(d", "(|)"), ("|abc\ndef", ">>", " |abc\ndef"), (" |abc\ndef", "<<", "|abc\ndef"), ("|a\nb\nc", "2>>", " |a\n b\nc"), (" |a\n b\nc", "2<<", "|a\nb\nc"), ("|a\nb\nc", ">j", " |a\n b\nc"), (" |a\n b\nc", ">", " |é猫"), ], Mode::Normal, ); } #[test] fn yanks_pastes_and_register_prefixes() { support::check( &[ ("|abc", "ylp", "a|abc"), ("|abc", "ylP", "|aabc"), ("|abc", "2ylp", "aa|bbc"), ("|abc", "yl2p", "aa|abc"), ("|abc\ndef", "yyp", "abc\n|abc\ndef"), ("|abc\ndef", "yyP", "|abc\nabc\ndef"), ("|abc\ndef", "Yp", "abc\n|abc\ndef"), ("|é猫🙂", "ylp", "é|é猫🙂"), ("|abc", "xp", "b|ac"), ("|abc", "xP", "|abc"), ("|one two", "ywp", "oone| ne two"), ("|abc", "\"ayl\"ap", "a|abc"), ("|abc", "\"ayl\"aP", "|aabc"), ("|abc", "\"ax\"aP", "|abc"), ("|abc", "ylx\"0P", "|abc"), ("|abc", "yl\"_xP", "|abc"), ("|abc", "\"_xp", "|bc"), ("|abc", "\"_x\"_p", "|bc"), ("|abc", "p", "|abc"), ("|abc", "P", "|abc"), ("|abc", "vlyp", "aa|bbc"), ("|abc\ndef", "Vyp", "abc\n|abc\ndef"), ("|abc", "\"aylxx\"aP", "|ac"), ], Mode::Normal, ); }