()
| 851 | |
| 852 | #[test] |
| 853 | fn test_insert_newline_in_middle() { |
| 854 | let mut cb = MockConsole::default(); |
| 855 | cb.set_size_chars(yx(10, 40)); |
| 856 | let mut ob = OutputBuilder::new(yx(10, 40)); |
| 857 | ob = ob.refresh(linecol(0, 0), &[""], yx(0, 0)); |
| 858 | |
| 859 | cb.add_input_chars("abc"); |
| 860 | ob = ob.set_dirty(); |
| 861 | ob = ob.add(CapturedOut::Write("a".to_string())); |
| 862 | ob = ob.quick_refresh(linecol(0, 1), yx(0, 1)); |
| 863 | ob = ob.add(CapturedOut::Write("b".to_string())); |
| 864 | ob = ob.quick_refresh(linecol(0, 2), yx(0, 2)); |
| 865 | ob = ob.add(CapturedOut::Write("c".to_string())); |
| 866 | ob = ob.quick_refresh(linecol(0, 3), yx(0, 3)); |
| 867 | |
| 868 | cb.add_input_keys(&[Key::ArrowLeft]); |
| 869 | ob = ob.quick_refresh(linecol(0, 2), yx(0, 2)); |
| 870 | |
| 871 | cb.add_input_keys(&[Key::NewLine]); |
| 872 | ob = ob.refresh(linecol(1, 0), &["ab", "c"], yx(1, 0)); |
| 873 | |
| 874 | cb.add_input_keys(&[Key::ArrowUp]); |
| 875 | ob = ob.quick_refresh(linecol(0, 0), yx(0, 0)); |
| 876 | cb.add_input_keys(&[Key::ArrowRight]); |
| 877 | ob = ob.quick_refresh(linecol(0, 1), yx(0, 1)); |
| 878 | cb.add_input_keys(&[Key::ArrowRight]); |
| 879 | ob = ob.quick_refresh(linecol(0, 2), yx(0, 2)); |
| 880 | |
| 881 | cb.add_input_keys(&[Key::NewLine]); |
| 882 | ob = ob.refresh(linecol(1, 0), &["ab", "", "c"], yx(1, 0)); |
| 883 | |
| 884 | run_editor("", "ab\n\nc\n", cb, ob); |
| 885 | } |
| 886 | |
| 887 | #[test] |
| 888 | fn test_split_last_line() { |
nothing calls this directly
no test coverage detected