2020-05-05 22:50:23 +00:00
|
|
|
//! Tests for the Grid.
|
2017-10-13 03:01:28 +00:00
|
|
|
|
2020-11-05 04:45:14 +00:00
|
|
|
use super::*;
|
|
|
|
|
|
|
|
use crate::term::cell::Cell;
|
2019-03-13 18:55:18 +00:00
|
|
|
|
|
|
|
impl GridCell for usize {
|
|
|
|
fn is_empty(&self) -> bool {
|
2019-07-10 21:17:20 +00:00
|
|
|
*self == 0
|
2019-03-13 18:55:18 +00:00
|
|
|
}
|
|
|
|
|
2020-11-05 04:45:14 +00:00
|
|
|
fn reset(&mut self, template: &Self) {
|
|
|
|
*self = *template;
|
|
|
|
}
|
|
|
|
|
2020-01-09 23:06:41 +00:00
|
|
|
fn flags(&self) -> &Flags {
|
|
|
|
unimplemented!();
|
2019-03-13 18:55:18 +00:00
|
|
|
}
|
|
|
|
|
2020-01-09 23:06:41 +00:00
|
|
|
fn flags_mut(&mut self) -> &mut Flags {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
2019-03-13 18:55:18 +00:00
|
|
|
}
|
2017-10-13 03:01:28 +00:00
|
|
|
|
2020-03-07 22:17:38 +00:00
|
|
|
#[test]
|
|
|
|
fn grid_clamp_buffer_point() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<usize>::new(Line(10), Column(10), 1_000);
|
2020-03-07 22:17:38 +00:00
|
|
|
grid.display_offset = 5;
|
|
|
|
|
|
|
|
let point = grid.clamp_buffer_to_visible(Point::new(10, Column(3)));
|
|
|
|
assert_eq!(point, Point::new(Line(4), Column(3)));
|
|
|
|
|
|
|
|
let point = grid.clamp_buffer_to_visible(Point::new(15, Column(3)));
|
|
|
|
assert_eq!(point, Point::new(Line(0), Column(0)));
|
|
|
|
|
|
|
|
let point = grid.clamp_buffer_to_visible(Point::new(4, Column(3)));
|
|
|
|
assert_eq!(point, Point::new(Line(9), Column(9)));
|
|
|
|
|
|
|
|
grid.display_offset = 0;
|
|
|
|
|
|
|
|
let point = grid.clamp_buffer_to_visible(Point::new(4, Column(3)));
|
|
|
|
assert_eq!(point, Point::new(Line(5), Column(3)));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn visible_to_buffer() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<usize>::new(Line(10), Column(10), 1_000);
|
2020-03-07 22:17:38 +00:00
|
|
|
grid.display_offset = 5;
|
|
|
|
|
|
|
|
let point = grid.visible_to_buffer(Point::new(Line(4), Column(3)));
|
|
|
|
assert_eq!(point, Point::new(10, Column(3)));
|
|
|
|
|
|
|
|
grid.display_offset = 0;
|
|
|
|
|
|
|
|
let point = grid.visible_to_buffer(Point::new(Line(5), Column(3)));
|
|
|
|
assert_eq!(point, Point::new(4, Column(3)));
|
|
|
|
}
|
|
|
|
|
2020-07-15 21:27:32 +00:00
|
|
|
// Scroll up moves lines upward.
|
2017-10-13 03:01:28 +00:00
|
|
|
#[test]
|
|
|
|
fn scroll_up() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<usize>::new(Line(10), Column(1), 0);
|
2017-10-13 03:01:28 +00:00
|
|
|
for i in 0..10 {
|
|
|
|
grid[Line(i)][Column(0)] = i;
|
|
|
|
}
|
|
|
|
|
2020-11-05 04:45:14 +00:00
|
|
|
grid.scroll_up::<usize>(&(Line(0)..Line(10)), Line(2));
|
2017-10-13 03:01:28 +00:00
|
|
|
|
2018-05-19 18:18:37 +00:00
|
|
|
assert_eq!(grid[Line(0)][Column(0)], 2);
|
|
|
|
assert_eq!(grid[Line(0)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(1)][Column(0)], 3);
|
|
|
|
assert_eq!(grid[Line(1)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(2)][Column(0)], 4);
|
|
|
|
assert_eq!(grid[Line(2)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(3)][Column(0)], 5);
|
|
|
|
assert_eq!(grid[Line(3)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(4)][Column(0)], 6);
|
|
|
|
assert_eq!(grid[Line(4)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(5)][Column(0)], 7);
|
|
|
|
assert_eq!(grid[Line(5)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(6)][Column(0)], 8);
|
|
|
|
assert_eq!(grid[Line(6)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(7)][Column(0)], 9);
|
|
|
|
assert_eq!(grid[Line(7)].occ, 1);
|
2020-05-05 22:50:23 +00:00
|
|
|
assert_eq!(grid[Line(8)][Column(0)], 0); // was 0.
|
2018-05-19 18:18:37 +00:00
|
|
|
assert_eq!(grid[Line(8)].occ, 0);
|
2020-05-05 22:50:23 +00:00
|
|
|
assert_eq!(grid[Line(9)][Column(0)], 0); // was 1.
|
2018-05-19 18:18:37 +00:00
|
|
|
assert_eq!(grid[Line(9)].occ, 0);
|
2017-10-13 03:01:28 +00:00
|
|
|
}
|
|
|
|
|
2020-07-15 21:27:32 +00:00
|
|
|
// Scroll down moves lines downward.
|
2017-10-13 03:01:28 +00:00
|
|
|
#[test]
|
|
|
|
fn scroll_down() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<usize>::new(Line(10), Column(1), 0);
|
2017-10-13 03:01:28 +00:00
|
|
|
for i in 0..10 {
|
|
|
|
grid[Line(i)][Column(0)] = i;
|
|
|
|
}
|
|
|
|
|
2020-11-05 04:45:14 +00:00
|
|
|
grid.scroll_down::<usize>(&(Line(0)..Line(10)), Line(2));
|
2017-10-13 03:01:28 +00:00
|
|
|
|
2020-05-05 22:50:23 +00:00
|
|
|
assert_eq!(grid[Line(0)][Column(0)], 0); // was 8.
|
2018-05-19 18:18:37 +00:00
|
|
|
assert_eq!(grid[Line(0)].occ, 0);
|
2020-05-05 22:50:23 +00:00
|
|
|
assert_eq!(grid[Line(1)][Column(0)], 0); // was 9.
|
2018-05-19 18:18:37 +00:00
|
|
|
assert_eq!(grid[Line(1)].occ, 0);
|
|
|
|
assert_eq!(grid[Line(2)][Column(0)], 0);
|
|
|
|
assert_eq!(grid[Line(2)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(3)][Column(0)], 1);
|
|
|
|
assert_eq!(grid[Line(3)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(4)][Column(0)], 2);
|
|
|
|
assert_eq!(grid[Line(4)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(5)][Column(0)], 3);
|
|
|
|
assert_eq!(grid[Line(5)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(6)][Column(0)], 4);
|
|
|
|
assert_eq!(grid[Line(6)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(7)][Column(0)], 5);
|
|
|
|
assert_eq!(grid[Line(7)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(8)][Column(0)], 6);
|
|
|
|
assert_eq!(grid[Line(8)].occ, 1);
|
|
|
|
assert_eq!(grid[Line(9)][Column(0)], 7);
|
|
|
|
assert_eq!(grid[Line(9)].occ, 1);
|
2017-10-13 03:01:28 +00:00
|
|
|
}
|
|
|
|
|
2020-05-05 22:50:23 +00:00
|
|
|
// Test that GridIterator works.
|
2017-10-13 03:01:28 +00:00
|
|
|
#[test]
|
|
|
|
fn test_iter() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<usize>::new(Line(5), Column(5), 0);
|
2017-10-13 03:01:28 +00:00
|
|
|
for i in 0..5 {
|
|
|
|
for j in 0..5 {
|
2019-03-30 16:48:36 +00:00
|
|
|
grid[Line(i)][Column(j)] = i * 5 + j;
|
2017-10-13 03:01:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-30 16:48:36 +00:00
|
|
|
let mut iter = grid.iter_from(Point { line: 4, col: Column(0) });
|
2017-10-13 03:01:28 +00:00
|
|
|
|
|
|
|
assert_eq!(None, iter.prev());
|
|
|
|
assert_eq!(Some(&1), iter.next());
|
2019-08-01 15:37:01 +00:00
|
|
|
assert_eq!(Column(1), iter.point().col);
|
|
|
|
assert_eq!(4, iter.point().line);
|
2017-10-13 03:01:28 +00:00
|
|
|
|
|
|
|
assert_eq!(Some(&2), iter.next());
|
|
|
|
assert_eq!(Some(&3), iter.next());
|
|
|
|
assert_eq!(Some(&4), iter.next());
|
|
|
|
|
2020-05-05 22:50:23 +00:00
|
|
|
// Test line-wrapping.
|
2017-10-13 03:01:28 +00:00
|
|
|
assert_eq!(Some(&5), iter.next());
|
2019-08-01 15:37:01 +00:00
|
|
|
assert_eq!(Column(0), iter.point().col);
|
|
|
|
assert_eq!(3, iter.point().line);
|
2017-10-13 03:01:28 +00:00
|
|
|
|
|
|
|
assert_eq!(Some(&4), iter.prev());
|
2019-08-01 15:37:01 +00:00
|
|
|
assert_eq!(Column(4), iter.point().col);
|
|
|
|
assert_eq!(4, iter.point().line);
|
|
|
|
|
2020-05-05 22:50:23 +00:00
|
|
|
// Make sure iter.cell() returns the current iterator position.
|
2019-08-01 15:37:01 +00:00
|
|
|
assert_eq!(&4, iter.cell());
|
2017-10-13 03:01:28 +00:00
|
|
|
|
2020-05-05 22:50:23 +00:00
|
|
|
// Test that iter ends at end of grid.
|
2019-03-30 16:48:36 +00:00
|
|
|
let mut final_iter = grid.iter_from(Point { line: 0, col: Column(4) });
|
2017-10-13 03:01:28 +00:00
|
|
|
assert_eq!(None, final_iter.next());
|
|
|
|
assert_eq!(Some(&23), final_iter.prev());
|
|
|
|
}
|
2019-03-13 18:55:18 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn shrink_reflow() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<Cell>::new(Line(1), Column(5), 2);
|
2019-03-13 18:55:18 +00:00
|
|
|
grid[Line(0)][Column(0)] = cell('1');
|
|
|
|
grid[Line(0)][Column(1)] = cell('2');
|
|
|
|
grid[Line(0)][Column(2)] = cell('3');
|
|
|
|
grid[Line(0)][Column(3)] = cell('4');
|
|
|
|
grid[Line(0)][Column(4)] = cell('5');
|
|
|
|
|
2020-05-30 20:45:44 +00:00
|
|
|
grid.resize(true, Line(1), Column(2));
|
2019-03-13 18:55:18 +00:00
|
|
|
|
2020-07-09 21:45:22 +00:00
|
|
|
assert_eq!(grid.total_lines(), 3);
|
2019-03-13 18:55:18 +00:00
|
|
|
|
|
|
|
assert_eq!(grid[2].len(), 2);
|
|
|
|
assert_eq!(grid[2][Column(0)], cell('1'));
|
|
|
|
assert_eq!(grid[2][Column(1)], wrap_cell('2'));
|
|
|
|
|
|
|
|
assert_eq!(grid[1].len(), 2);
|
|
|
|
assert_eq!(grid[1][Column(0)], cell('3'));
|
|
|
|
assert_eq!(grid[1][Column(1)], wrap_cell('4'));
|
|
|
|
|
|
|
|
assert_eq!(grid[0].len(), 2);
|
|
|
|
assert_eq!(grid[0][Column(0)], cell('5'));
|
|
|
|
assert_eq!(grid[0][Column(1)], Cell::default());
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn shrink_reflow_twice() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<Cell>::new(Line(1), Column(5), 2);
|
2019-03-13 18:55:18 +00:00
|
|
|
grid[Line(0)][Column(0)] = cell('1');
|
|
|
|
grid[Line(0)][Column(1)] = cell('2');
|
|
|
|
grid[Line(0)][Column(2)] = cell('3');
|
|
|
|
grid[Line(0)][Column(3)] = cell('4');
|
|
|
|
grid[Line(0)][Column(4)] = cell('5');
|
|
|
|
|
2020-05-30 20:45:44 +00:00
|
|
|
grid.resize(true, Line(1), Column(4));
|
|
|
|
grid.resize(true, Line(1), Column(2));
|
2019-03-13 18:55:18 +00:00
|
|
|
|
2020-07-09 21:45:22 +00:00
|
|
|
assert_eq!(grid.total_lines(), 3);
|
2019-03-13 18:55:18 +00:00
|
|
|
|
|
|
|
assert_eq!(grid[2].len(), 2);
|
|
|
|
assert_eq!(grid[2][Column(0)], cell('1'));
|
|
|
|
assert_eq!(grid[2][Column(1)], wrap_cell('2'));
|
|
|
|
|
|
|
|
assert_eq!(grid[1].len(), 2);
|
|
|
|
assert_eq!(grid[1][Column(0)], cell('3'));
|
|
|
|
assert_eq!(grid[1][Column(1)], wrap_cell('4'));
|
|
|
|
|
|
|
|
assert_eq!(grid[0].len(), 2);
|
|
|
|
assert_eq!(grid[0][Column(0)], cell('5'));
|
|
|
|
assert_eq!(grid[0][Column(1)], Cell::default());
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn shrink_reflow_empty_cell_inside_line() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<Cell>::new(Line(1), Column(5), 3);
|
2019-03-13 18:55:18 +00:00
|
|
|
grid[Line(0)][Column(0)] = cell('1');
|
|
|
|
grid[Line(0)][Column(1)] = Cell::default();
|
|
|
|
grid[Line(0)][Column(2)] = cell('3');
|
|
|
|
grid[Line(0)][Column(3)] = cell('4');
|
|
|
|
grid[Line(0)][Column(4)] = Cell::default();
|
|
|
|
|
2020-05-30 20:45:44 +00:00
|
|
|
grid.resize(true, Line(1), Column(2));
|
2019-03-13 18:55:18 +00:00
|
|
|
|
2020-07-09 21:45:22 +00:00
|
|
|
assert_eq!(grid.total_lines(), 2);
|
2019-03-13 18:55:18 +00:00
|
|
|
|
|
|
|
assert_eq!(grid[1].len(), 2);
|
|
|
|
assert_eq!(grid[1][Column(0)], cell('1'));
|
|
|
|
assert_eq!(grid[1][Column(1)], wrap_cell(' '));
|
|
|
|
|
|
|
|
assert_eq!(grid[0].len(), 2);
|
|
|
|
assert_eq!(grid[0][Column(0)], cell('3'));
|
|
|
|
assert_eq!(grid[0][Column(1)], cell('4'));
|
|
|
|
|
2020-05-30 20:45:44 +00:00
|
|
|
grid.resize(true, Line(1), Column(1));
|
2019-03-13 18:55:18 +00:00
|
|
|
|
2020-07-09 21:45:22 +00:00
|
|
|
assert_eq!(grid.total_lines(), 4);
|
2019-03-13 18:55:18 +00:00
|
|
|
|
|
|
|
assert_eq!(grid[3].len(), 1);
|
|
|
|
assert_eq!(grid[3][Column(0)], wrap_cell('1'));
|
|
|
|
|
|
|
|
assert_eq!(grid[2].len(), 1);
|
|
|
|
assert_eq!(grid[2][Column(0)], wrap_cell(' '));
|
|
|
|
|
|
|
|
assert_eq!(grid[1].len(), 1);
|
|
|
|
assert_eq!(grid[1][Column(0)], wrap_cell('3'));
|
|
|
|
|
|
|
|
assert_eq!(grid[0].len(), 1);
|
|
|
|
assert_eq!(grid[0][Column(0)], cell('4'));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn grow_reflow() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<Cell>::new(Line(2), Column(2), 0);
|
2019-03-13 18:55:18 +00:00
|
|
|
grid[Line(0)][Column(0)] = cell('1');
|
|
|
|
grid[Line(0)][Column(1)] = wrap_cell('2');
|
|
|
|
grid[Line(1)][Column(0)] = cell('3');
|
|
|
|
grid[Line(1)][Column(1)] = Cell::default();
|
|
|
|
|
2020-05-30 20:45:44 +00:00
|
|
|
grid.resize(true, Line(2), Column(3));
|
2019-03-13 18:55:18 +00:00
|
|
|
|
2020-07-09 21:45:22 +00:00
|
|
|
assert_eq!(grid.total_lines(), 2);
|
2019-03-13 18:55:18 +00:00
|
|
|
|
|
|
|
assert_eq!(grid[1].len(), 3);
|
|
|
|
assert_eq!(grid[1][Column(0)], cell('1'));
|
|
|
|
assert_eq!(grid[1][Column(1)], cell('2'));
|
|
|
|
assert_eq!(grid[1][Column(2)], cell('3'));
|
|
|
|
|
2020-05-05 22:50:23 +00:00
|
|
|
// Make sure rest of grid is empty.
|
2019-03-13 18:55:18 +00:00
|
|
|
assert_eq!(grid[0].len(), 3);
|
|
|
|
assert_eq!(grid[0][Column(0)], Cell::default());
|
|
|
|
assert_eq!(grid[0][Column(1)], Cell::default());
|
|
|
|
assert_eq!(grid[0][Column(2)], Cell::default());
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn grow_reflow_multiline() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<Cell>::new(Line(3), Column(2), 0);
|
2019-03-13 18:55:18 +00:00
|
|
|
grid[Line(0)][Column(0)] = cell('1');
|
|
|
|
grid[Line(0)][Column(1)] = wrap_cell('2');
|
|
|
|
grid[Line(1)][Column(0)] = cell('3');
|
|
|
|
grid[Line(1)][Column(1)] = wrap_cell('4');
|
|
|
|
grid[Line(2)][Column(0)] = cell('5');
|
|
|
|
grid[Line(2)][Column(1)] = cell('6');
|
|
|
|
|
2020-05-30 20:45:44 +00:00
|
|
|
grid.resize(true, Line(3), Column(6));
|
2019-03-13 18:55:18 +00:00
|
|
|
|
2020-07-09 21:45:22 +00:00
|
|
|
assert_eq!(grid.total_lines(), 3);
|
2019-03-13 18:55:18 +00:00
|
|
|
|
|
|
|
assert_eq!(grid[2].len(), 6);
|
|
|
|
assert_eq!(grid[2][Column(0)], cell('1'));
|
|
|
|
assert_eq!(grid[2][Column(1)], cell('2'));
|
|
|
|
assert_eq!(grid[2][Column(2)], cell('3'));
|
|
|
|
assert_eq!(grid[2][Column(3)], cell('4'));
|
|
|
|
assert_eq!(grid[2][Column(4)], cell('5'));
|
|
|
|
assert_eq!(grid[2][Column(5)], cell('6'));
|
|
|
|
|
2020-05-05 22:50:23 +00:00
|
|
|
// Make sure rest of grid is empty.
|
2019-03-13 18:55:18 +00:00
|
|
|
for r in 0..2 {
|
|
|
|
assert_eq!(grid[r].len(), 6);
|
|
|
|
for c in 0..6 {
|
|
|
|
assert_eq!(grid[r][Column(c)], Cell::default());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-23 23:29:01 +00:00
|
|
|
#[test]
|
|
|
|
fn grow_reflow_disabled() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<Cell>::new(Line(2), Column(2), 0);
|
2019-06-23 23:29:01 +00:00
|
|
|
grid[Line(0)][Column(0)] = cell('1');
|
|
|
|
grid[Line(0)][Column(1)] = wrap_cell('2');
|
|
|
|
grid[Line(1)][Column(0)] = cell('3');
|
|
|
|
grid[Line(1)][Column(1)] = Cell::default();
|
|
|
|
|
2020-05-30 20:45:44 +00:00
|
|
|
grid.resize(false, Line(2), Column(3));
|
2019-06-23 23:29:01 +00:00
|
|
|
|
2020-07-09 21:45:22 +00:00
|
|
|
assert_eq!(grid.total_lines(), 2);
|
2019-06-23 23:29:01 +00:00
|
|
|
|
|
|
|
assert_eq!(grid[1].len(), 3);
|
|
|
|
assert_eq!(grid[1][Column(0)], cell('1'));
|
|
|
|
assert_eq!(grid[1][Column(1)], wrap_cell('2'));
|
|
|
|
assert_eq!(grid[1][Column(2)], Cell::default());
|
|
|
|
|
|
|
|
assert_eq!(grid[0].len(), 3);
|
|
|
|
assert_eq!(grid[0][Column(0)], cell('3'));
|
|
|
|
assert_eq!(grid[0][Column(1)], Cell::default());
|
|
|
|
assert_eq!(grid[0][Column(2)], Cell::default());
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn shrink_reflow_disabled() {
|
2020-11-05 04:45:14 +00:00
|
|
|
let mut grid = Grid::<Cell>::new(Line(1), Column(5), 2);
|
2019-06-23 23:29:01 +00:00
|
|
|
grid[Line(0)][Column(0)] = cell('1');
|
|
|
|
grid[Line(0)][Column(1)] = cell('2');
|
|
|
|
grid[Line(0)][Column(2)] = cell('3');
|
|
|
|
grid[Line(0)][Column(3)] = cell('4');
|
|
|
|
grid[Line(0)][Column(4)] = cell('5');
|
|
|
|
|
2020-05-30 20:45:44 +00:00
|
|
|
grid.resize(false, Line(1), Column(2));
|
2019-06-23 23:29:01 +00:00
|
|
|
|
2020-07-09 21:45:22 +00:00
|
|
|
assert_eq!(grid.total_lines(), 1);
|
2019-06-23 23:29:01 +00:00
|
|
|
|
|
|
|
assert_eq!(grid[0].len(), 2);
|
|
|
|
assert_eq!(grid[0][Column(0)], cell('1'));
|
|
|
|
assert_eq!(grid[0][Column(1)], cell('2'));
|
|
|
|
}
|
|
|
|
|
2021-01-01 05:07:39 +00:00
|
|
|
// https://github.com/rust-lang/rust-clippy/pull/6375
|
|
|
|
#[allow(clippy::all)]
|
2019-03-13 18:55:18 +00:00
|
|
|
fn cell(c: char) -> Cell {
|
|
|
|
let mut cell = Cell::default();
|
|
|
|
cell.c = c;
|
|
|
|
cell
|
|
|
|
}
|
|
|
|
|
|
|
|
fn wrap_cell(c: char) -> Cell {
|
|
|
|
let mut cell = cell(c);
|
|
|
|
cell.flags.insert(Flags::WRAPLINE);
|
|
|
|
cell
|
|
|
|
}
|