mirror of
https://github.com/wez/wezterm.git
synced 2024-11-27 02:25:28 +03:00
update rustfmt for 1.28
This commit is contained in:
parent
6fc620ce47
commit
1c6b51be46
@ -1,3 +1,2 @@
|
|||||||
# Please keep these in alphabetical order.
|
# Please keep these in alphabetical order.
|
||||||
tab_spaces = 4
|
tab_spaces = 4
|
||||||
wrap_comments = true
|
|
||||||
|
@ -170,7 +170,8 @@ impl Capabilities {
|
|||||||
_ => {
|
_ => {
|
||||||
// COLORTERM isn't set, so look at the terminfo.
|
// COLORTERM isn't set, so look at the terminfo.
|
||||||
if let Some(ref db) = hints.terminfo_db.as_ref() {
|
if let Some(ref db) = hints.terminfo_db.as_ref() {
|
||||||
let has_true_color = db.get::<cap::TrueColor>()
|
let has_true_color = db
|
||||||
|
.get::<cap::TrueColor>()
|
||||||
.unwrap_or(cap::TrueColor(false))
|
.unwrap_or(cap::TrueColor(false))
|
||||||
.0;
|
.0;
|
||||||
if has_true_color {
|
if has_true_color {
|
||||||
|
@ -23,7 +23,8 @@ impl<Value: Debug> Node<Value> {
|
|||||||
self.value = Some(value);
|
self.value = Some(value);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
match self.children
|
match self
|
||||||
|
.children
|
||||||
.binary_search_by(|node| node.label.cmp(&key[0]))
|
.binary_search_by(|node| node.label.cmp(&key[0]))
|
||||||
{
|
{
|
||||||
Ok(idx) => {
|
Ok(idx) => {
|
||||||
@ -54,7 +55,8 @@ impl<Value: Debug> Node<Value> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.children
|
match self
|
||||||
|
.children
|
||||||
.binary_search_by(|node| node.label.cmp(&key[0]))
|
.binary_search_by(|node| node.label.cmp(&key[0]))
|
||||||
{
|
{
|
||||||
Ok(idx) => {
|
Ok(idx) => {
|
||||||
|
@ -780,14 +780,16 @@ impl Surface {
|
|||||||
// lines of text into simpler strings.
|
// lines of text into simpler strings.
|
||||||
let mut attr: Option<CellAttributes> = None;
|
let mut attr: Option<CellAttributes> = None;
|
||||||
|
|
||||||
for ((row_num, line), other_line) in self.lines
|
for ((row_num, line), other_line) in self
|
||||||
|
.lines
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.skip(y)
|
.skip(y)
|
||||||
.take_while(|(row_num, _)| *row_num < y + height)
|
.take_while(|(row_num, _)| *row_num < y + height)
|
||||||
.zip(other.lines.iter().skip(other_y))
|
.zip(other.lines.iter().skip(other_y))
|
||||||
{
|
{
|
||||||
for ((col_num, cell), (_, other_cell)) in line.visible_cells()
|
for ((col_num, cell), (_, other_cell)) in line
|
||||||
|
.visible_cells()
|
||||||
.skip(x)
|
.skip(x)
|
||||||
.take_while(|(col_num, _)| *col_num < x + width)
|
.take_while(|(col_num, _)| *col_num < x + width)
|
||||||
.zip(other_line.visible_cells().skip(other_x))
|
.zip(other_line.visible_cells().skip(other_x))
|
||||||
|
@ -277,7 +277,8 @@ impl LayoutState {
|
|||||||
parent_top: usize,
|
parent_top: usize,
|
||||||
results: &mut Vec<LaidOutWidget>,
|
results: &mut Vec<LaidOutWidget>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let state = self.widget_states
|
let state = self
|
||||||
|
.widget_states
|
||||||
.get(&widget)
|
.get(&widget)
|
||||||
.ok_or_else(|| err_msg("widget has no solver state"))?;
|
.ok_or_else(|| err_msg("widget has no solver state"))?;
|
||||||
let width = self.solver.get_value(state.width) as usize;
|
let width = self.solver.get_value(state.width) as usize;
|
||||||
@ -310,7 +311,8 @@ impl LayoutState {
|
|||||||
parent_left: Option<Variable>,
|
parent_left: Option<Variable>,
|
||||||
parent_top: Option<Variable>,
|
parent_top: Option<Variable>,
|
||||||
) -> Result<WidgetState, Error> {
|
) -> Result<WidgetState, Error> {
|
||||||
let state = self.widget_states
|
let state = self
|
||||||
|
.widget_states
|
||||||
.get(&widget)
|
.get(&widget)
|
||||||
.ok_or_else(|| err_msg("widget has no solver state"))?
|
.ok_or_else(|| err_msg("widget has no solver state"))?
|
||||||
.clone();
|
.clone();
|
||||||
@ -343,25 +345,31 @@ impl LayoutState {
|
|||||||
// We handle alignment on the root widget specially here;
|
// We handle alignment on the root widget specially here;
|
||||||
// for non-root widgets, we handle it when assessing children
|
// for non-root widgets, we handle it when assessing children
|
||||||
match state.constraints.halign {
|
match state.constraints.halign {
|
||||||
HorizontalAlignment::Left => self.solver
|
HorizontalAlignment::Left => self
|
||||||
|
.solver
|
||||||
.add_constraint(state.left | EQ(STRONG) | 0.0)
|
.add_constraint(state.left | EQ(STRONG) | 0.0)
|
||||||
.map_err(adderr)?,
|
.map_err(adderr)?,
|
||||||
HorizontalAlignment::Right => self.solver
|
HorizontalAlignment::Right => self
|
||||||
|
.solver
|
||||||
.add_constraint(state.left | EQ(STRONG) | parent_width - state.width)
|
.add_constraint(state.left | EQ(STRONG) | parent_width - state.width)
|
||||||
.map_err(adderr)?,
|
.map_err(adderr)?,
|
||||||
HorizontalAlignment::Center => self.solver
|
HorizontalAlignment::Center => self
|
||||||
|
.solver
|
||||||
.add_constraint(state.left | EQ(STRONG) | (parent_width - state.width) / 2.0)
|
.add_constraint(state.left | EQ(STRONG) | (parent_width - state.width) / 2.0)
|
||||||
.map_err(adderr)?,
|
.map_err(adderr)?,
|
||||||
}
|
}
|
||||||
|
|
||||||
match state.constraints.valign {
|
match state.constraints.valign {
|
||||||
VerticalAlignment::Top => self.solver
|
VerticalAlignment::Top => self
|
||||||
|
.solver
|
||||||
.add_constraint(state.top | EQ(STRONG) | 0.0)
|
.add_constraint(state.top | EQ(STRONG) | 0.0)
|
||||||
.map_err(adderr)?,
|
.map_err(adderr)?,
|
||||||
VerticalAlignment::Bottom => self.solver
|
VerticalAlignment::Bottom => self
|
||||||
|
.solver
|
||||||
.add_constraint(state.top | EQ(STRONG) | parent_height - state.height)
|
.add_constraint(state.top | EQ(STRONG) | parent_height - state.height)
|
||||||
.map_err(adderr)?,
|
.map_err(adderr)?,
|
||||||
VerticalAlignment::Middle => self.solver
|
VerticalAlignment::Middle => self
|
||||||
|
.solver
|
||||||
.add_constraint(state.top | EQ(STRONG) | (parent_height - state.height) / 2.0)
|
.add_constraint(state.top | EQ(STRONG) | (parent_height - state.height) / 2.0)
|
||||||
.map_err(adderr)?,
|
.map_err(adderr)?,
|
||||||
}
|
}
|
||||||
@ -438,17 +446,20 @@ impl LayoutState {
|
|||||||
)?;
|
)?;
|
||||||
|
|
||||||
match child_state.constraints.halign {
|
match child_state.constraints.halign {
|
||||||
HorizontalAlignment::Left => self.solver
|
HorizontalAlignment::Left => self
|
||||||
|
.solver
|
||||||
.add_constraint(child_state.left | EQ(STRONG) | left_edge.clone())
|
.add_constraint(child_state.left | EQ(STRONG) | left_edge.clone())
|
||||||
.map_err(adderr)?,
|
.map_err(adderr)?,
|
||||||
HorizontalAlignment::Right => self.solver
|
HorizontalAlignment::Right => self
|
||||||
|
.solver
|
||||||
.add_constraint(
|
.add_constraint(
|
||||||
child_state.left + child_state.width
|
child_state.left + child_state.width
|
||||||
| EQ(STRONG)
|
| EQ(STRONG)
|
||||||
| state.left + state.width,
|
| state.left + state.width,
|
||||||
)
|
)
|
||||||
.map_err(adderr)?,
|
.map_err(adderr)?,
|
||||||
HorizontalAlignment::Center => self.solver
|
HorizontalAlignment::Center => self
|
||||||
|
.solver
|
||||||
.add_constraint(
|
.add_constraint(
|
||||||
child_state.left
|
child_state.left
|
||||||
| EQ(STRONG)
|
| EQ(STRONG)
|
||||||
@ -458,17 +469,20 @@ impl LayoutState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
match child_state.constraints.valign {
|
match child_state.constraints.valign {
|
||||||
VerticalAlignment::Top => self.solver
|
VerticalAlignment::Top => self
|
||||||
|
.solver
|
||||||
.add_constraint(child_state.top | EQ(STRONG) | top_edge.clone())
|
.add_constraint(child_state.top | EQ(STRONG) | top_edge.clone())
|
||||||
.map_err(adderr)?,
|
.map_err(adderr)?,
|
||||||
VerticalAlignment::Bottom => self.solver
|
VerticalAlignment::Bottom => self
|
||||||
|
.solver
|
||||||
.add_constraint(
|
.add_constraint(
|
||||||
child_state.top + child_state.height
|
child_state.top + child_state.height
|
||||||
| EQ(STRONG)
|
| EQ(STRONG)
|
||||||
| state.top + state.height,
|
| state.top + state.height,
|
||||||
)
|
)
|
||||||
.map_err(adderr)?,
|
.map_err(adderr)?,
|
||||||
VerticalAlignment::Middle => self.solver
|
VerticalAlignment::Middle => self
|
||||||
|
.solver
|
||||||
.add_constraint(
|
.add_constraint(
|
||||||
child_state.top
|
child_state.top
|
||||||
| EQ(STRONG)
|
| EQ(STRONG)
|
||||||
|
Loading…
Reference in New Issue
Block a user