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

Code before:
        let ime_position = match search_state.regex() {
            Some(regex) => {
                let search_label = match search_state.direction() {
                    Direction::Right => FORWARD_SEARCH_LABEL,
                    Direction::Left => BACKWARD_SEARCH_LABEL,
                };

                let search_text = Self::format_search(regex, search_label, size_info.columns());

                // Render the search bar.
                self.draw_search(config, &search_text);

                // Draw search bar cursor.
                let line = size_info.screen_lines();
                let column = Column(search_text.chars().count() - 1);

                if self.ime.preedit().is_none() {
                    let fg = config.colors.footer_bar_foreground();
                    let shape = CursorShape::Underline;
                    let cursor = RenderableCursor::new(Point::new(line, column), shape, fg, false);
                    rects.extend(
                        cursor.rects(&size_info, config.terminal_config.cursor.thickness()),
                    );
                }

                // Compute IME position.
                Some(Point::new(line, column))
            },
            None => {
                let num_lines = self.size_info.screen_lines();
                term::point_to_viewport(display_offset, cursor_point)
                    .filter(|point| point.line < num_lines)
            },
        };

        // Handle IME.
        if self.ime.is_enabled() {
            if let Some(point) = ime_position {
                let (fg, bg) = if search_state.regex().is_some() {
                    (config.colors.footer_bar_foreground(), config.colors.footer_bar_background())
                } else {
                    (foreground_color, background_color)
                };

                self.draw_ime_preview(point, fg, bg, &mut rects, config);
            }
        }

        if self.debug_damage {
            self.highlight_damage(&mut rects);
        }

Review comment (suggestion):
```suggestion
```

Nothing being computed here.

Code after:
        let ime_position = match search_state.regex() {
            Some(regex) => {
                let search_label = match search_state.direction() {
                    Direction::Right => FORWARD_SEARCH_LABEL,
                    Direction::Left => BACKWARD_SEARCH_LABEL,
                };

                let search_text = Self::format_search(regex, search_label, size_info.columns());

                // Render the search bar.
                self.draw_search(config, &search_text);

                // Draw search bar cursor.
                let line = size_info.screen_lines();
                let column = Column(search_text.chars().count() - 1);

                // Add cursor to search bar if IME is not active.
                if self.ime.preedit().is_none() {
                    let fg = config.colors.footer_bar_foreground();
                    let shape = CursorShape::Underline;
                    let cursor = RenderableCursor::new(Point::new(line, column), shape, fg, false);
                    rects.extend(
                        cursor.rects(&size_info, config.terminal_config.cursor.thickness()),
                    );
                }

                Some(Point::new(line, column))
            },
            None => {
                let num_lines = self.size_info.screen_lines();
                term::point_to_viewport(display_offset, cursor_point)
                    .filter(|point| point.line < num_lines)
            },
        };

        // Handle IME.
        if self.ime.is_enabled() {
            if let Some(point) = ime_position {
                let (fg, bg) = if search_state.regex().is_some() {
                    (config.colors.footer_bar_foreground(), config.colors.footer_bar_background())
                } else {
                    (foreground_color, background_color)
                };

                self.draw_ime_preview(point, fg, bg, &mut rects, config);
            }
        }

        if self.debug_damage {
            self.highlight_damage(&mut rects);
        }