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

Code before:

        // Draw hyperlink uri preview.
        if has_highlighted_hint {
            let cursor_point = vi_cursor_point.or(Some(cursor_point));
            self.draw_hyperlink_preview(config, cursor_point, display_offset);
        }

        // Frame event should be requested before swapping buffers on Wayland, since it requires
        // surface `commit`, which is done by swap buffers under the hood.
        if self.is_wayland {
            self.request_frame(scheduler);
        }

        // Clearing debug highlights from the previous frame requires full redraw.
        self.swap_buffers();

        #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
        if !self.is_wayland {
            // On X11 `swap_buffers` does not block for vsync. However the next OpenGl command
            // will block to synchronize (this is `glClear` in Alacritty), which causes a
            // permanent one frame delay.
            self.renderer.finish();
        }

        // XXX request for the rendering frame after swap buffers, so the time
        // for finishing gl operations will be accounted in to the timeout.
        if !self.is_wayland {
            self.request_frame(scheduler);
        }

        self.damage_rects.clear();

        // Append damage rects we've enqueued for the next frame.
        mem::swap(&mut self.damage_rects, &mut self.next_frame_damage_rects);
    }

    /// Update to a new configuration.
    pub fn update_config(&mut self, config: &UiConfig) {
        self.debug_damage = config.debug.highlight_damage;
        self.visual_bell.update_config(&config.bell);
        self.colors = List::from(&config.colors);
    }

    /// Update the mouse/vi mode cursor hint highlighting.
    ///
    /// This will return whether the highlighted hints changed.
    pub fn update_highlighted_hints<T>(
        &mut self,
        term: &Term<T>,
        config: &UiConfig,
        mouse: &Mouse,

Review comment (suggestion):
```suggestion
        // XXX: Request the new frame after swapping buffers, so the time to finish OpenGL operations is accounted for in the timeout.
```

Code after:

        // Draw hyperlink uri preview.
        if has_highlighted_hint {
            let cursor_point = vi_cursor_point.or(Some(cursor_point));
            self.draw_hyperlink_preview(config, cursor_point, display_offset);
        }

        // Frame event should be requested before swapping buffers on Wayland, since it requires
        // surface `commit`, which is done by swap buffers under the hood.
        if self.is_wayland {
            self.request_frame(scheduler);
        }

        // Clearing debug highlights from the previous frame requires full redraw.
        self.swap_buffers();

        #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
        if !self.is_wayland {
            // On X11 `swap_buffers` does not block for vsync. However the next OpenGl command
            // will block to synchronize (this is `glClear` in Alacritty), which causes a
            // permanent one frame delay.
            self.renderer.finish();
        }

        // XXX: Request the new frame after swapping buffers, so the
        // time to finish OpenGL operations is accounted for in the timeout.
        if !self.is_wayland {
            self.request_frame(scheduler);
        }

        self.damage_rects.clear();

        // Append damage rects we've enqueued for the next frame.
        mem::swap(&mut self.damage_rects, &mut self.next_frame_damage_rects);
    }

    /// Update to a new configuration.
    pub fn update_config(&mut self, config: &UiConfig) {
        self.debug_damage = config.debug.highlight_damage;
        self.visual_bell.update_config(&config.bell);
        self.colors = List::from(&config.colors);
    }

    /// Update the mouse/vi mode cursor hint highlighting.
    ///
    /// This will return whether the highlighted hints changed.
    pub fn update_highlighted_hints<T>(
        &mut self,
        term: &Term<T>,
        config: &UiConfig,
        mouse: &Mouse,