@@ -201,7 +201,7 @@ where
201 for (x, y, cell) in content {
201 for (x, y, cell) in content {
202 // Move the cursor if the previous location was not (x - 1, y)
202 // Move the cursor if the previous location was not (x - 1, y)
203 if !matches!(last_pos, Some(p) if x == p.0 + 1 && y == p.1) {
203 if !matches!(last_pos, Some(p) if x == p.0 + 1 && y == p.1) {
204− map_error(queue!(self.buffer, MoveTo(x, y)))?;
204+ queue!(self.buffer, MoveTo(x, y))?;
206 last_pos = Some((x, y));
206 last_pos = Some((x, y));
207 if cell.modifier != modifier {
207 if cell.modifier != modifier {
@@ -214,12 +214,12 @@ where
215 if cell.fg != fg {
215 if cell.fg != fg {
216 let color = CColor::from(cell.fg);
216 let color = CColor::from(cell.fg);
217− map_error(queue!(self.buffer, SetForegroundColor(color)))?;
217+ queue!(self.buffer, SetForegroundColor(color))?;
218 fg = cell.fg;
218 fg = cell.fg;
220 if cell.bg != bg {
220 if cell.bg != bg {
221 let color = CColor::from(cell.bg);
221 let color = CColor::from(cell.bg);
222− map_error(queue!(self.buffer, SetBackgroundColor(color)))?;
222+ queue!(self.buffer, SetBackgroundColor(color))?;
223 bg = cell.bg;
223 bg = cell.bg;
@@ -227,7 +227,7 @@ where
227 if self.capabilities.has_extended_underlines {
227 if self.capabilities.has_extended_underlines {
228 if cell.underline_color != underline_color {
228 if cell.underline_color != underline_color {
229 let color = CColor::from(cell.underline_color);
229 let color = CColor::from(cell.underline_color);
230− map_error(queue!(self.buffer, SetUnderlineColor(color)))?;
230+ queue!(self.buffer, SetUnderlineColor(color))?;
231 underline_color = cell.underline_color;
231 underline_color = cell.underline_color;
@@ -239,24 +239,24 @@ where
240 if new_underline_style != underline_style {
240 if new_underline_style != underline_style {
241 let attr = CAttribute::from(new_underline_style);
241 let attr = CAttribute::from(new_underline_style);
242− map_error(queue!(self.buffer, SetAttribute(attr)))?;
242+ queue!(self.buffer, SetAttribute(attr))?;
243 underline_style = new_underline_style;
243 underline_style = new_underline_style;
246− map_error(queue!(self.buffer, Print(&cell.symbol)))?;
246+ queue!(self.buffer, Print(&cell.symbol))?;
249− map_error(queue!(
249+ queue!(
250 self.buffer,
250 self.buffer,
251 SetUnderlineColor(CColor::Reset),
251 SetUnderlineColor(CColor::Reset),
252 SetForegroundColor(CColor::Reset),
252 SetForegroundColor(CColor::Reset),
253 SetBackgroundColor(CColor::Reset),
253 SetBackgroundColor(CColor::Reset),
254 SetAttribute(CAttribute::Reset)
254 SetAttribute(CAttribute::Reset)
258 fn hide_cursor(&mut self) -> io::Result<()> {
258 fn hide_cursor(&mut self) -> io::Result<()> {
259− map_error(execute!(self.buffer, Hide))
259+ execute!(self.buffer, Hide)
262 fn show_cursor(&mut self, kind: CursorKind) -> io::Result<()> {
262 fn show_cursor(&mut self, kind: CursorKind) -> io::Result<()> {
@@ -266,7 +266,7 @@ where
266 CursorKind::Underline => SetCursorStyle::SteadyUnderScore,
266 CursorKind::Underline => SetCursorStyle::SteadyUnderScore,
267 CursorKind::Hidden => unreachable!(),
267 CursorKind::Hidden => unreachable!(),
269− map_error(execute!(self.buffer, Show, shape))
269+ execute!(self.buffer, Show, shape)
272 fn get_cursor(&mut self) -> io::Result<(u16, u16)> {
272 fn get_cursor(&mut self) -> io::Result<(u16, u16)> {
@@ -275,11 +275,11 @@ where
277 fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
277 fn set_cursor(&mut self, x: u16, y: u16) -> io::Result<()> {
278− map_error(execute!(self.buffer, MoveTo(x, y)))
278+ execute!(self.buffer, MoveTo(x, y))
281 fn clear(&mut self) -> io::Result<()> {
281 fn clear(&mut self) -> io::Result<()> {
282− map_error(execute!(self.buffer, Clear(ClearType::All)))
282+ execute!(self.buffer, Clear(ClearType::All))
285 fn size(&self) -> io::Result<Rect> {
285 fn size(&self) -> io::Result<Rect> {
@@ -294,10 +294,6 @@ where
297−fn map_error(error: crossterm::Result<()>) -> io::Result<()> {
298− error.map_err(|e| io::Error::new(io::ErrorKind::Other, e.to_string()))
301#[derive(Debug)]
297#[derive(Debug)]
302struct ModifierDiff {
298struct ModifierDiff {
303 pub from: Modifier,
299 pub from: Modifier,
@@ -312,48 +308,48 @@ impl ModifierDiff {
312 //use crossterm::Attribute;
308 //use crossterm::Attribute;
313 let removed = self.from - self.to;
309 let removed = self.from - self.to;
314 if removed.contains(Modifier::REVERSED) {
310 if removed.contains(Modifier::REVERSED) {
315− map_error(queue!(w, SetAttribute(CAttribute::NoReverse)))?;
311+ queue!(w, SetAttribute(CAttribute::NoReverse))?;
317 if removed.contains(Modifier::BOLD) {
313 if removed.contains(Modifier::BOLD) {
318− map_error(queue!(w, SetAttribute(CAttribute::NormalIntensity)))?;
314+ queue!(w, SetAttribute(CAttribute::NormalIntensity))?;
319 if self.to.contains(Modifier::DIM) {
315 if self.to.contains(Modifier::DIM) {
320− map_error(queue!(w, SetAttribute(CAttribute::Dim)))?;
316+ queue!(w, SetAttribute(CAttribute::Dim))?;
323 if removed.contains(Modifier::ITALIC) {
319 if removed.contains(Modifier::ITALIC) {
324− map_error(queue!(w, SetAttribute(CAttribute::NoItalic)))?;
320+ queue!(w, SetAttribute(CAttribute::NoItalic))?;
326 if removed.contains(Modifier::DIM) {
322 if removed.contains(Modifier::DIM) {
327− map_error(queue!(w, SetAttribute(CAttribute::NormalIntensity)))?;
323+ queue!(w, SetAttribute(CAttribute::NormalIntensity))?;
329 if removed.contains(Modifier::CROSSED_OUT) {
325 if removed.contains(Modifier::CROSSED_OUT) {
330− map_error(queue!(w, SetAttribute(CAttribute::NotCrossedOut)))?;
326+ queue!(w, SetAttribute(CAttribute::NotCrossedOut))?;
332 if removed.contains(Modifier::SLOW_BLINK) || removed.contains(Modifier::RAPID_BLINK) {
328 if removed.contains(Modifier::SLOW_BLINK) || removed.contains(Modifier::RAPID_BLINK) {
333− map_error(queue!(w, SetAttribute(CAttribute::NoBlink)))?;
329+ queue!(w, SetAttribute(CAttribute::NoBlink))?;
336 let added = self.to - self.from;
332 let added = self.to - self.from;
337 if added.contains(Modifier::REVERSED) {
333 if added.contains(Modifier::REVERSED) {
338− map_error(queue!(w, SetAttribute(CAttribute::Reverse)))?;
334+ queue!(w, SetAttribute(CAttribute::Reverse))?;
340 if added.contains(Modifier::BOLD) {
336 if added.contains(Modifier::BOLD) {
341− map_error(queue!(w, SetAttribute(CAttribute::Bold)))?;
337+ queue!(w, SetAttribute(CAttribute::Bold))?;
343 if added.contains(Modifier::ITALIC) {
339 if added.contains(Modifier::ITALIC) {
344− map_error(queue!(w, SetAttribute(CAttribute::Italic)))?;
340+ queue!(w, SetAttribute(CAttribute::Italic))?;
346 if added.contains(Modifier::DIM) {
342 if added.contains(Modifier::DIM) {
347− map_error(queue!(w, SetAttribute(CAttribute::Dim)))?;
343+ queue!(w, SetAttribute(CAttribute::Dim))?;
349 if added.contains(Modifier::CROSSED_OUT) {
345 if added.contains(Modifier::CROSSED_OUT) {
350− map_error(queue!(w, SetAttribute(CAttribute::CrossedOut)))?;
346+ queue!(w, SetAttribute(CAttribute::CrossedOut))?;
352 if added.contains(Modifier::SLOW_BLINK) {
348 if added.contains(Modifier::SLOW_BLINK) {
353− map_error(queue!(w, SetAttribute(CAttribute::SlowBlink)))?;
349+ queue!(w, SetAttribute(CAttribute::SlowBlink))?;
355 if added.contains(Modifier::RAPID_BLINK) {
351 if added.contains(Modifier::RAPID_BLINK) {
356− map_error(queue!(w, SetAttribute(CAttribute::RapidBlink)))?;
352+ queue!(w, SetAttribute(CAttribute::RapidBlink))?;
@@ -407,7 +403,7 @@ impl Command for SetUnderlineColor {
409 #[cfg(windows)]
405 #[cfg(windows)]
410− fn execute_winapi(&self) -> crossterm::Result<()> {
406+ fn execute_winapi(&self) -> io::Result<()> {
411 Err(std::io::Error::new(
407 Err(std::io::Error::new(
412 std::io::ErrorKind::Other,
408 std::io::ErrorKind::Other,
413 "SetUnderlineColor not supported by winapi.",
409 "SetUnderlineColor not supported by winapi.",