aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/event.rs
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty/src/event.rs')
-rw-r--r--alacritty/src/event.rs35
1 files changed, 17 insertions, 18 deletions
diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs
index 94c9a735..88d074bb 100644
--- a/alacritty/src/event.rs
+++ b/alacritty/src/event.rs
@@ -1,4 +1,4 @@
-//! Process window events
+//! Process window events.
use std::borrow::Cow;
use std::cmp::max;
use std::env;
@@ -91,7 +91,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
fn scroll(&mut self, scroll: Scroll) {
self.terminal.scroll_display(scroll);
- // Update selection
+ // Update selection.
if self.terminal.mode().contains(TermMode::VI)
&& self.terminal.selection().as_ref().map(|s| s.is_empty()) != Some(true)
{
@@ -125,7 +125,7 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
fn update_selection(&mut self, point: Point, side: Side) {
let point = self.terminal.visible_to_buffer(point);
- // Update selection if one exists
+ // Update selection if one exists.
let vi_mode = self.terminal.mode().contains(TermMode::VI);
if let Some(selection) = self.terminal.selection_mut() {
selection.update(point, side);
@@ -306,7 +306,7 @@ pub enum ClickState {
TripleClick,
}
-/// State of the mouse
+/// State of the mouse.
#[derive(Debug)]
pub struct Mouse {
pub x: usize,
@@ -346,7 +346,7 @@ impl Default for Mouse {
}
}
-/// The event processor
+/// The event processor.
///
/// Stores some state from received events and dispatches actions when they are
/// triggered.
@@ -364,10 +364,9 @@ pub struct Processor<N> {
}
impl<N: Notify + OnResize> Processor<N> {
- /// Create a new event processor
+ /// Create a new event processor.
///
- /// Takes a writer which is expected to be hooked up to the write end of a
- /// pty.
+ /// Takes a writer which is expected to be hooked up to the write end of a PTY.
pub fn new(
notifier: N,
message_buffer: MessageBuffer,
@@ -528,11 +527,11 @@ impl<N: Notify + OnResize> Processor<N> {
}
});
- // Write ref tests to disk
+ // Write ref tests to disk.
self.write_ref_test_results(&terminal.lock());
}
- /// Handle events from glutin
+ /// Handle events from glutin.
///
/// Doesn't take self mutably due to borrow checking.
fn handle_event<T>(
@@ -546,11 +545,11 @@ impl<N: Notify + OnResize> Processor<N> {
Event::DPRChanged(scale_factor, (width, height)) => {
let display_update_pending = &mut processor.ctx.display_update_pending;
- // Push current font to update its DPR
+ // 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
+ // 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;
@@ -592,7 +591,7 @@ impl<N: Notify + OnResize> Processor<N> {
WindowEvent::KeyboardInput { input, is_synthetic: false, .. } => {
processor.key_input(input);
if input.state == ElementState::Pressed {
- // Hide cursor while typing
+ // Hide cursor while typing.
if processor.ctx.config.ui_config.mouse.hide_when_typing {
processor.ctx.window.set_mouse_visible(false);
}
@@ -667,7 +666,7 @@ impl<N: Notify + OnResize> Processor<N> {
}
}
- /// Check if an event is irrelevant and can be skipped
+ /// Check if an event is irrelevant and can be skipped.
fn skip_event(event: &GlutinEvent<Event>) -> bool {
match event {
GlutinEvent::WindowEvent { event, .. } => match event {
@@ -709,7 +708,7 @@ impl<N: Notify + OnResize> Processor<N> {
processor.ctx.terminal.update_config(&config);
- // Reload cursor if we've changed its thickness
+ // Reload cursor if we've changed its thickness.
if (processor.ctx.config.cursor.thickness() - config.cursor.thickness()).abs()
> std::f64::EPSILON
{
@@ -717,7 +716,7 @@ impl<N: Notify + OnResize> Processor<N> {
}
if processor.ctx.config.font != config.font {
- // Do not update font size if it has been changed at runtime
+ // 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;
}
@@ -738,13 +737,13 @@ impl<N: Notify + OnResize> Processor<N> {
processor.ctx.terminal.dirty = true;
}
- // Write the ref test results to the disk
+ // Write the ref test results to the disk.
pub fn write_ref_test_results<T>(&self, terminal: &Term<T>) {
if !self.config.debug.ref_test {
return;
}
- // dump grid state
+ // Dump grid state.
let mut grid = terminal.grid().clone();
grid.initialize_all(&Cell::default());
grid.truncate();