Repository: alacritty/alacritty
File: alacritty_terminal/src/term/mod.rs (Rust)

Code before:
                            // Invert cursor if static background is close to the cell's
                            // background.
                            CellRgb::Rgb(col) if col.contrast(cell.bg) < MIN_CURSOR_CONTRAST => {
                                cell.bg
                            },
                            _ => self.cursor.text_color.color(cell.fg, cell.bg),
                        };
                    }

                    return Some(cell);
                } else {
                    // Handle cursor.
                    self.cursor.rendered = true;

                    let buffer_point = self.grid.visible_to_buffer(self.cursor.point);
                    let cell = Indexed {
                        inner: self.grid[buffer_point.line][buffer_point.col],
                        column: self.cursor.point.col,
                        line: self.cursor.point.line,
                    };

                    let mut cell = RenderableCell::new(self, cell);
                    cell.inner = RenderableCellContent::Cursor(self.cursor.key);

                    // Only apply static color if it isn't close to the cell's current
                    // background or refers to cell colors.
                    match self.cursor.cursor_color {
                        CellRgb::Rgb(color) if color.contrast(cell.bg) < MIN_CURSOR_CONTRAST => (),
                        _ => cell.fg = self.cursor.cursor_color.color(cell.fg, cell.bg),
                    }

                    return Some(cell);
                }
            } else {
                let cell = self.inner.next()?;
                let cell = RenderableCell::new(self, cell);

                if !cell.is_empty() {
                    return Some(cell);
                }
            }
        }
    }
}

pub mod mode {
    use bitflags::bitflags;

    bitflags! {
        pub struct TermMode: u32 {
            const NONE                = 0;

Review comment (suggestion):
The latter part is already implied by `static`.

Maybe something like this is more clear:

```suggestion
                    // Apply cursor color, or invert the cursor if it has a fixed background close to the cell's background.
```

I'm not sure which of these I like more. The one describes the purpose of this block better, but describes something that isn't done, while the other isn't entirely clear

Code after:
                            // Apply cursor color, or invert the cursor if it has a fixed background
                            // close to the cell's background.
                            CellRgb::Rgb(col) if col.contrast(cell.bg) < MIN_CURSOR_CONTRAST => {
                                cell.bg
                            },
                            _ => self.cursor.text_color.color(cell.fg, cell.bg),
                        };
                    }

                    return Some(cell);
                } else {
                    // Handle cursor.
                    self.cursor.rendered = true;

                    let buffer_point = self.grid.visible_to_buffer(self.cursor.point);
                    let cell = Indexed {
                        inner: self.grid[buffer_point.line][buffer_point.col],
                        column: self.cursor.point.col,
                        line: self.cursor.point.line,
                    };

                    let mut cell = RenderableCell::new(self, cell);
                    cell.inner = RenderableCellContent::Cursor(self.cursor.key);

                    // Apply cursor color, or invert the cursor if it has a fixed background close
                    // to the cell's background.
                    match self.cursor.cursor_color {
                        CellRgb::Rgb(color) if color.contrast(cell.bg) < MIN_CURSOR_CONTRAST => (),
                        _ => cell.fg = self.cursor.cursor_color.color(cell.fg, cell.bg),
                    }

                    return Some(cell);
                }
            } else {
                let cell = self.inner.next()?;
                let cell = RenderableCell::new(self, cell);

                if !cell.is_empty() {
                    return Some(cell);
                }
            }
        }
    }
}

pub mod mode {
    use bitflags::bitflags;

    bitflags! {
        pub struct TermMode: u32 {
            const NONE                = 0;