diff options
| author | Aram Drevekenin <aram@poor.dev> | 2022-03-09 11:04:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-09 11:04:07 +0100 |
| commit | 95e512c36d6d3058d408e814930a5d235dc4e3fc (patch) | |
| tree | 45f3eb000bce4d82552744c3fc2f639bd76f8a42 /zellij-server/src/panes/unit/grid_tests.rs | |
| parent | docs(changelog): breaking change in list-session (diff) | |
| download | sl0ppij-95e512c36d6d3058d408e814930a5d235dc4e3fc.tar.gz sl0ppij-95e512c36d6d3058d408e814930a5d235dc4e3fc.tar.xz sl0ppij-95e512c36d6d3058d408e814930a5d235dc4e3fc.zip | |
fix(compatibility): replace wide characters under cursor properly (#1196)
* fix(compatibility): replace wide characters under cursor properly
* style(fmt): rustfmt
Diffstat (limited to 'zellij-server/src/panes/unit/grid_tests.rs')
| -rw-r--r-- | zellij-server/src/panes/unit/grid_tests.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/zellij-server/src/panes/unit/grid_tests.rs b/zellij-server/src/panes/unit/grid_tests.rs index c6ae8c0c..e4b15503 100644 --- a/zellij-server/src/panes/unit/grid_tests.rs +++ b/zellij-server/src/panes/unit/grid_tests.rs @@ -1560,3 +1560,45 @@ pub fn fzf_fullscreen() { } assert_snapshot!(format!("{:?}", grid)); } + +#[test] +pub fn replace_multiple_wide_characters_under_cursor() { + // this test makes sure that if we replace a wide character with a non-wide character, it + // properly pads the excess width in the proper place (either before the replaced non-wide + // character if the cursor was "in the middle" of the wide character, or after the character if + // it was "in the beginning" of the wide character) + let mut vte_parser = vte::Parser::new(); + let mut grid = Grid::new( + 51, + 112, + Palette::default(), + Rc::new(RefCell::new(LinkHandler::new())), + ); + let fixture_name = "replace_multiple_wide_characters"; + let content = read_fixture(fixture_name); + for byte in content { + vte_parser.advance(&mut grid, byte); + } + assert_snapshot!(format!("{:?}", grid)); +} + +#[test] +pub fn replace_non_wide_characters_with_wide_characters() { + // this test makes sure that if we replace a wide character with a non-wide character, it + // properly pads the excess width in the proper place (either before the replaced non-wide + // character if the cursor was "in the middle" of the wide character, or after the character if + // it was "in the beginning" of the wide character) + let mut vte_parser = vte::Parser::new(); + let mut grid = Grid::new( + 51, + 112, + Palette::default(), + Rc::new(RefCell::new(LinkHandler::new())), + ); + let fixture_name = "replace_non_wide_characters_with_wide_characters"; + let content = read_fixture(fixture_name); + for byte in content { + vte_parser.advance(&mut grid, byte); + } + assert_snapshot!(format!("{:?}", grid)); +} |
