Repository: alacritty/alacritty
File: alacritty/src/event.rs (Rust)

Code before:
                    display_update_pending.font =
                        Some(processor.ctx.config.font.clone().with_size(*processor.ctx.font_size));

                    // Resize to event's dimensions, since no resize event is emitted on Wayland
                    display_update_pending.dimensions = Some(PhysicalSize::new(width, height));

                    processor.ctx.size_info.dpr = scale_factor;
                    processor.ctx.terminal.dirty = true;
                },
                Event::Title(title) => processor.ctx.window.set_title(&title),
                Event::Wakeup => processor.ctx.terminal.dirty = true,
                Event::Urgent => {
                    processor.ctx.window.set_urgent(!processor.ctx.terminal.is_focused)
                },
                Event::ConfigReload(path) => {
                    processor.ctx.message_buffer.remove_target(LOG_TARGET_CONFIG);
                    processor.ctx.display_update_pending.message_buffer = Some(());

                    if let Ok(config) = config::reload_from(&path) {
                        let options = Options::new();
                        let config = options.into_config(config);

                        processor.ctx.terminal.update_config(&config);

                        // We're also reloading font on thickness change, since we update
                        // glyph cache
                        if processor.ctx.config.font != config.font
                            || processor.ctx.config.cursor.thickness != config.cursor.thickness
                        {
                            // Do not update font size if it has been changed at runtime
                            if *processor.ctx.font_size == processor.ctx.config.font.size {
                                *processor.ctx.font_size = config.font.size;
                            }

                            let font = config.font.clone().with_size(*processor.ctx.font_size);
                            processor.ctx.display_update_pending.font = Some(font);
                        }

                        *processor.ctx.config = config;

                        processor.ctx.terminal.dirty = true;
                    }
                },
                Event::Message(message) => {
                    processor.ctx.message_buffer.push(message);
                    processor.ctx.display_update_pending.message_buffer = Some(());
                    processor.ctx.terminal.dirty = true;
                },
                Event::MouseCursorDirty => processor.reset_mouse_cursor(),
                Event::Exit => (),
            },

Review comment (performance):
The phrasing here is a bit weird, the `also` suggests to me that there was a previous comment already talking about something that was reloaded, but there isn't.

```suggestion
                        // Reload font on thickness change, since we need to update glyph cache
```

Though generally it seems a bit strange to me, since we don't actually want to do half of the things in this method? It also seems a bit strange to me to reload the font just for this, it doesn't really feel right.

Code after:

                    // Push current font to update its DPR
                    display_update_pending.font =
                        Some(processor.ctx.config.font.clone().with_size(*processor.ctx.font_size));

                    // Resize to event's dimensions, since no resize event is emitted on Wayland
                    display_update_pending.dimensions = Some(PhysicalSize::new(width, height));

                    processor.ctx.size_info.dpr = scale_factor;
                    processor.ctx.terminal.dirty = true;
                },
                Event::Title(title) => processor.ctx.window.set_title(&title),
                Event::Wakeup => processor.ctx.terminal.dirty = true,
                Event::Urgent => {
                    processor.ctx.window.set_urgent(!processor.ctx.terminal.is_focused)
                },
                Event::ConfigReload(path) => Self::reload_config(&path, processor),
                Event::Message(message) => {
                    processor.ctx.message_buffer.push(message);
                    processor.ctx.display_update_pending.message_buffer = true;
                    processor.ctx.terminal.dirty = true;
                },
                Event::MouseCursorDirty => processor.reset_mouse_cursor(),
                Event::Exit => (),
            },
            GlutinEvent::RedrawRequested(_) => processor.ctx.terminal.dirty = true,
            GlutinEvent::WindowEvent { event, window_id, .. } => {
                match event {
                    WindowEvent::CloseRequested => processor.ctx.terminal.exit(),
                    WindowEvent::Resized(size) => {
                        #[cfg(windows)]
                        {
                            // Minimizing the window sends a Resize event with zero width and
                            // height. But there's no need to ever actually resize to this.
                            // Both WinPTY & ConPTY have issues when resizing down to zero size
                            // and back.
                            if size.width == 0 && size.height == 0 {
                                return;
                            }
                        }

                        processor.ctx.display_update_pending.dimensions = Some(size);
                        processor.ctx.terminal.dirty = true;
                    },
                    WindowEvent::KeyboardInput { input, is_synthetic: false, .. } => {
                        processor.key_input(input);
                        if input.state == ElementState::Pressed {
                            // Hide cursor while typing
                            if processor.ctx.config.ui_config.mouse.hide_when_typing {
                                processor.ctx.window.set_mouse_visible(false);
                            }