@@ -137,7 +137,7 @@ impl Buffer {
138 /// Returns a Buffer with all cells initialized with the attributes of the given Cell
138 /// Returns a Buffer with all cells initialized with the attributes of the given Cell
139 pub fn filled(area: Rect, cell: &Cell) -> Buffer {
139 pub fn filled(area: Rect, cell: &Cell) -> Buffer {
140− let size = area.area() as usize;
140+ let size = area.area();
141 let mut content = Vec::with_capacity(size);
141 let mut content = Vec::with_capacity(size);
142 for _ in 0..size {
142 for _ in 0..size {
143 content.push(cell.clone());
143 content.push(cell.clone());
@@ -239,7 +239,7 @@ impl Buffer {
240 self.area
240 self.area
242− ((y - self.area.y) * self.area.width + (x - self.area.x)) as usize
242+ ((y - self.area.y) as usize) * (self.area.width as usize) + ((x - self.area.x) as usize)
245 /// Returns the index in the Vec<Cell> for the given global (x, y) coordinates,
245 /// Returns the index in the Vec<Cell> for the given global (x, y) coordinates,
@@ -278,8 +278,8 @@ impl Buffer {
278 self.content.len()
278 self.content.len()
281− self.area.x + i as u16 % self.area.width,
281+ (self.area.x as usize + (i % self.area.width as usize)) as u16,
282− self.area.y + i as u16 / self.area.width,
282+ (self.area.y as usize + (i / self.area.width as usize)) as u16,
@@ -480,7 +480,7 @@ impl Buffer {
480 /// Resize the buffer so that the mapped area matches the given area and that the buffer
480 /// Resize the buffer so that the mapped area matches the given area and that the buffer
481 /// length is equal to area.width * area.height
481 /// length is equal to area.width * area.height
482 pub fn resize(&mut self, area: Rect) {
482 pub fn resize(&mut self, area: Rect) {
483− let length = area.area() as usize;
483+ let length = area.area();
484 if self.content.len() > length {
484 if self.content.len() > length {
485 self.content.truncate(length);
485 self.content.truncate(length);
@@ -587,8 +587,8 @@ impl Buffer {
587 let mut to_skip: usize = 0;
587 let mut to_skip: usize = 0;
588 for (i, (current, previous)) in next_buffer.iter().zip(previous_buffer.iter()).enumerate() {
588 for (i, (current, previous)) in next_buffer.iter().zip(previous_buffer.iter()).enumerate() {
589 if (current != previous || invalidated > 0) && to_skip == 0 {
589 if (current != previous || invalidated > 0) && to_skip == 0 {
590− let x = i as u16 % width;
590+ let x = (i % width as usize) as u16;
591− let y = i as u16 / width;
591+ let y = (i / width as usize) as u16;
592 updates.push((x, y, &next_buffer[i]));
592 updates.push((x, y, &next_buffer[i]));