aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/selection.rs
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty_terminal/src/selection.rs')
-rw-r--r--alacritty_terminal/src/selection.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/alacritty_terminal/src/selection.rs b/alacritty_terminal/src/selection.rs
index ffe35e08..29934e5a 100644
--- a/alacritty_terminal/src/selection.rs
+++ b/alacritty_terminal/src/selection.rs
@@ -39,6 +39,7 @@ use crate::term::{Search, Term};
/// [`simple`]: enum.Selection.html#method.simple
/// [`semantic`]: enum.Selection.html#method.semantic
/// [`lines`]: enum.Selection.html#method.lines
+/// [`update`]: enum.Selection.html#method.update
#[derive(Debug, Clone, PartialEq)]
pub enum Selection {
Simple {
@@ -164,7 +165,7 @@ impl Selection {
}
}
- pub fn to_span(&self, term: &Term) -> Option<Span> {
+ pub fn to_span<T>(&self, term: &Term<T>) -> Option<Span> {
// Get both sides of the selection
let (mut start, mut end) = match *self {
Selection::Simple { ref region } | Selection::Block { ref region } => {
@@ -405,13 +406,19 @@ mod test {
use super::{Selection, Span};
use crate::clipboard::Clipboard;
+ use crate::config::MockConfig;
+ use crate::event::{Event, EventListener};
use crate::grid::Grid;
use crate::index::{Column, Line, Point, Side};
- use crate::message_bar::MessageBuffer;
use crate::term::cell::{Cell, Flags};
use crate::term::{SizeInfo, Term};
- fn term(width: usize, height: usize) -> Term {
+ struct Mock;
+ impl EventListener for Mock {
+ fn send_event(&self, _event: Event) {}
+ }
+
+ fn term(width: usize, height: usize) -> Term<Mock> {
let size = SizeInfo {
width: width as f32,
height: height as f32,
@@ -421,7 +428,7 @@ mod test {
padding_y: 0.0,
dpr: 1.0,
};
- Term::new(&Default::default(), size, MessageBuffer::new(), Clipboard::new_nop())
+ Term::new(&MockConfig::default(), &size, Clipboard::new_nop(), Mock)
}
/// Test case of single cell selection