mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 23:21:08 +03:00
rustfmt
This commit is contained in:
parent
4098931e62
commit
2db17562a6
@ -91,7 +91,8 @@ impl Inner {
|
||||
xcb::WINDOW_CLASS_INPUT_ONLY as u16,
|
||||
screen.root_visual(),
|
||||
&[(xcb::CW_EVENT_MASK, 0)],
|
||||
).request_check()?;
|
||||
)
|
||||
.request_check()?;
|
||||
}
|
||||
|
||||
Ok(Inner {
|
||||
@ -154,7 +155,8 @@ impl Inner {
|
||||
&self.conn,
|
||||
selection.requestor(),
|
||||
selection.property(),
|
||||
).get_reply()
|
||||
)
|
||||
.get_reply()
|
||||
{
|
||||
Ok(prop) => self.send(Paste::All(prop.name().into())),
|
||||
Err(err) => {
|
||||
@ -339,14 +341,16 @@ impl Inner {
|
||||
Token(0),
|
||||
Ready::readable(),
|
||||
PollOpt::level(),
|
||||
).expect("failed to register xcb conn for clipboard with mio");
|
||||
)
|
||||
.expect("failed to register xcb conn for clipboard with mio");
|
||||
|
||||
poll.register(
|
||||
&self.receiver,
|
||||
Token(1),
|
||||
Ready::readable(),
|
||||
PollOpt::level(),
|
||||
).expect("failed to register receiver for clipboard with mio");
|
||||
)
|
||||
.expect("failed to register receiver for clipboard with mio");
|
||||
|
||||
let mut events = Events::with_capacity(2);
|
||||
|
||||
@ -356,27 +360,29 @@ impl Inner {
|
||||
|
||||
loop {
|
||||
match poll.poll(&mut events, None) {
|
||||
Ok(_) => for event in &events {
|
||||
if event.token() == Token(0) {
|
||||
if let Err(err) = self.process_queued_xcb() {
|
||||
eprintln!("clipboard: {:?}", err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if event.token() == Token(1) {
|
||||
if let Err(err) = self.process_receiver() {
|
||||
// No need to print the error trace if we were shutdown gracefully
|
||||
match err.downcast_ref::<ClipTerminated>() {
|
||||
Some(_) => return,
|
||||
_ => {
|
||||
eprintln!("clipboard: {:?}", err);
|
||||
return;
|
||||
}
|
||||
Ok(_) => {
|
||||
for event in &events {
|
||||
if event.token() == Token(0) {
|
||||
if let Err(err) = self.process_queued_xcb() {
|
||||
eprintln!("clipboard: {:?}", err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
self.conn.flush();
|
||||
if event.token() == Token(1) {
|
||||
if let Err(err) = self.process_receiver() {
|
||||
// No need to print the error trace if we were shutdown gracefully
|
||||
match err.downcast_ref::<ClipTerminated>() {
|
||||
Some(_) => return,
|
||||
_ => {
|
||||
eprintln!("clipboard: {:?}", err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
self.conn.flush();
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("clipboard: {:?}", err);
|
||||
return;
|
||||
|
@ -172,7 +172,8 @@ impl GuiEventLoop {
|
||||
.get(&fd)
|
||||
.ok_or_else(|| {
|
||||
format_err!("fd {} has no associated window in windows_by_fd map", fd)
|
||||
}).map(|w| *w)?;
|
||||
})
|
||||
.map(|w| *w)?;
|
||||
|
||||
let window = windows.by_id.get_mut(&window_id).ok_or_else(|| {
|
||||
format_err!(
|
||||
@ -255,7 +256,8 @@ impl GuiEventLoop {
|
||||
.filter_map(|(window_id, window)| match window.test_for_child_exit() {
|
||||
Ok(_) => None,
|
||||
Err(_) => Some(*window_id),
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
|
||||
for window_id in window_ids {
|
||||
self.schedule_window_close(window_id)?;
|
||||
|
@ -264,7 +264,8 @@ impl GuiEventLoop {
|
||||
.get(&fd)
|
||||
.ok_or_else(|| {
|
||||
format_err!("fd {} has no associated window in windows_by_fd map", fd)
|
||||
}).map(|w| Rc::clone(w))?;
|
||||
})
|
||||
.map(|w| Rc::clone(w))?;
|
||||
|
||||
let window = windows.by_id.get_mut(&entry.window_id).ok_or_else(|| {
|
||||
format_err!(
|
||||
@ -442,7 +443,8 @@ impl GuiEventLoop {
|
||||
.filter_map(|(window_id, window)| match window.test_for_child_exit() {
|
||||
Ok(_) => None,
|
||||
Err(_) => Some(*window_id),
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
|
||||
for window_id in window_ids {
|
||||
self.schedule_window_close(window_id, None)?;
|
||||
|
@ -100,11 +100,13 @@ fn run() -> Result<(), Error> {
|
||||
.about(
|
||||
"Wez's Terminal Emulator\n\
|
||||
http://github.com/wez/wezterm",
|
||||
).arg(Arg::with_name("PROG").multiple(true).help(
|
||||
)
|
||||
.arg(Arg::with_name("PROG").multiple(true).help(
|
||||
"Instead of executing your shell, run PROG. \
|
||||
For example: `wezterm -- bash -l` will spawn bash \
|
||||
as if it were a login shell.",
|
||||
)).get_matches();
|
||||
))
|
||||
.get_matches();
|
||||
let config = Rc::new(config::Config::load()?);
|
||||
println!("Using configuration: {:#?}", config);
|
||||
|
||||
|
@ -130,7 +130,8 @@ impl Inner {
|
||||
io::ErrorKind::Other,
|
||||
format!("fd {} is not present in IOMgr fd_map", fd),
|
||||
)
|
||||
})?.clone();
|
||||
})?
|
||||
.clone();
|
||||
|
||||
poll.deregister(&*evented)?;
|
||||
|
||||
|
@ -130,7 +130,8 @@ impl Connection {
|
||||
.with_depth_size(24)
|
||||
.with_surface_type(
|
||||
egli::SurfaceType::WINDOW | egli::SurfaceType::PBUFFER | egli::SurfaceType::PIXMAP,
|
||||
).with_renderable_type(egli::RenderableType::OPENGL_ES2)
|
||||
)
|
||||
.with_renderable_type(egli::RenderableType::OPENGL_ES2)
|
||||
.with_conformant(egli::RenderableType::OPENGL_ES2)
|
||||
.choose_configs()
|
||||
.map_err(|e| format_err!("failed to get EGL config: {:?}", e))?;
|
||||
@ -255,7 +256,8 @@ impl Window {
|
||||
| xcb::EVENT_MASK_KEY_RELEASE
|
||||
| xcb::EVENT_MASK_STRUCTURE_NOTIFY,
|
||||
)],
|
||||
).request_check()?;
|
||||
)
|
||||
.request_check()?;
|
||||
Rc::new(WindowHolder {
|
||||
window_id,
|
||||
conn: Rc::clone(conn),
|
||||
@ -282,7 +284,8 @@ impl Window {
|
||||
.create_context_with_client_version(
|
||||
conn.egl_config,
|
||||
egli::ContextClientVersion::OpenGlEs2,
|
||||
).map_err(egli_err)?;
|
||||
)
|
||||
.map_err(egli_err)?;
|
||||
|
||||
conn.egl_display
|
||||
.make_current(&surface, &surface, &egl_context)
|
||||
|
@ -151,7 +151,8 @@ impl<'a> term::TerminalHost for TabHost<'a> {
|
||||
.with_window(window_id, |win| {
|
||||
win.update_title();
|
||||
Ok(())
|
||||
}).map(futures::Async::Ready)
|
||||
})
|
||||
.map(futures::Async::Ready)
|
||||
.map_err(|_| ())
|
||||
}));
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ fn write_all(w: &mut std::io::Write, mut buf: &[u8]) -> std::io::Result<()> {
|
||||
return Err(std::io::Error::new(
|
||||
ErrorKind::WriteZero,
|
||||
"failed to write whole buffer",
|
||||
))
|
||||
));
|
||||
}
|
||||
Ok(n) => buf = &buf[n..],
|
||||
Err(ref e)
|
||||
@ -1239,7 +1239,8 @@ impl TerminalState {
|
||||
ypos + cell_pixel_height as f32,
|
||||
),
|
||||
image_data.clone(),
|
||||
)))).clone(),
|
||||
))))
|
||||
.clone(),
|
||||
),
|
||||
);
|
||||
xpos += x_delta;
|
||||
|
@ -130,14 +130,16 @@ impl TestTerm {
|
||||
y,
|
||||
button,
|
||||
modifiers: KeyModifiers::default(),
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
self.mouse(MouseEvent {
|
||||
kind: MouseEventKind::Release,
|
||||
x,
|
||||
y,
|
||||
button,
|
||||
modifiers: KeyModifiers::default(),
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,7 +157,8 @@ impl TestTerm {
|
||||
y: start_y,
|
||||
button: MouseButton::Left,
|
||||
modifiers: KeyModifiers::default(),
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
assert!(self.host.clip.is_none());
|
||||
|
||||
self.mouse(MouseEvent {
|
||||
@ -164,7 +167,8 @@ impl TestTerm {
|
||||
y: end_y,
|
||||
button: MouseButton::None,
|
||||
modifiers: KeyModifiers::default(),
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
assert!(self.host.clip.is_none());
|
||||
|
||||
self.mouse(MouseEvent {
|
||||
@ -173,7 +177,8 @@ impl TestTerm {
|
||||
y: end_y,
|
||||
button: MouseButton::Left,
|
||||
modifiers: KeyModifiers::default(),
|
||||
}).unwrap();
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn assert_cursor_pos(&self, x: usize, y: i64, reason: Option<&str>) {
|
||||
|
@ -223,7 +223,8 @@ impl Capabilities {
|
||||
db.get::<cap::BackColorErase>()
|
||||
.unwrap_or(cap::BackColorErase(false))
|
||||
.0
|
||||
}).unwrap_or(false)
|
||||
})
|
||||
.unwrap_or(false)
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -335,7 +336,8 @@ mod test {
|
||||
.colorterm_bce(Some("1".into()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(caps.bce(), true);
|
||||
}
|
||||
@ -347,7 +349,8 @@ mod test {
|
||||
.terminfo_db(Some(load_terminfo()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(caps.bce(), true);
|
||||
}
|
||||
@ -359,7 +362,8 @@ mod test {
|
||||
.terminfo_db(Some(load_terminfo()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(caps.color_level(), ColorLevel::TrueColor);
|
||||
}
|
||||
@ -371,7 +375,8 @@ mod test {
|
||||
.term(Some("xterm-256color".into()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(caps.color_level(), ColorLevel::TwoFiftySix);
|
||||
}
|
||||
@ -383,7 +388,8 @@ mod test {
|
||||
.colorterm(Some("24bit".into()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(caps.color_level(), ColorLevel::TrueColor);
|
||||
}
|
||||
@ -397,7 +403,8 @@ mod test {
|
||||
.colorterm(Some("24bot".into()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(caps.color_level(), ColorLevel::TwoFiftySix);
|
||||
|
||||
@ -407,7 +414,8 @@ mod test {
|
||||
.colorterm(Some("24bit".into()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(caps.color_level(), ColorLevel::TrueColor);
|
||||
|
||||
@ -417,7 +425,8 @@ mod test {
|
||||
.colorterm(Some("truecolor".into()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(caps.color_level(), ColorLevel::TrueColor);
|
||||
}
|
||||
@ -430,7 +439,8 @@ mod test {
|
||||
.term_program_version(Some("1.0.0".into()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(caps.iterm2_image(), false);
|
||||
|
||||
let caps = Capabilities::new_with_hints(
|
||||
@ -439,7 +449,8 @@ mod test {
|
||||
.term_program_version(Some("2.9.0".into()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(caps.iterm2_image(), false);
|
||||
|
||||
let caps = Capabilities::new_with_hints(
|
||||
@ -448,7 +459,8 @@ mod test {
|
||||
.term_program_version(Some("2.9.20150512".into()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(caps.iterm2_image(), true);
|
||||
|
||||
let caps = Capabilities::new_with_hints(
|
||||
@ -457,7 +469,8 @@ mod test {
|
||||
.term_program_version(Some("3.2.0beta5".into()))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(caps.iterm2_image(), true);
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,8 @@ impl Rule {
|
||||
link,
|
||||
range: m.range(),
|
||||
}
|
||||
}).collect()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -764,9 +764,7 @@ impl InputParser {
|
||||
}),
|
||||
),
|
||||
_,
|
||||
)
|
||||
if self.state == InputState::Normal && self.buf.len() > len =>
|
||||
{
|
||||
) if self.state == InputState::Normal && self.buf.len() > len => {
|
||||
self.state = InputState::EscapeMaybeAlt;
|
||||
self.buf.advance(len);
|
||||
}
|
||||
|
@ -448,33 +448,25 @@ impl TerminfoRenderer {
|
||||
Change::CursorPosition {
|
||||
x: Position::NoChange,
|
||||
y: Position::Relative(n),
|
||||
}
|
||||
if *n > 0 =>
|
||||
{
|
||||
} if *n > 0 => {
|
||||
self.cursor_down(*n as u32, out)?;
|
||||
}
|
||||
Change::CursorPosition {
|
||||
x: Position::NoChange,
|
||||
y: Position::Relative(n),
|
||||
}
|
||||
if *n < 0 =>
|
||||
{
|
||||
} if *n < 0 => {
|
||||
self.cursor_up(*n as u32, out)?;
|
||||
}
|
||||
Change::CursorPosition {
|
||||
x: Position::Relative(n),
|
||||
y: Position::NoChange,
|
||||
}
|
||||
if *n < 0 =>
|
||||
{
|
||||
} if *n < 0 => {
|
||||
self.cursor_left(*n as u32, out)?;
|
||||
}
|
||||
Change::CursorPosition {
|
||||
x: Position::Relative(n),
|
||||
y: Position::NoChange,
|
||||
}
|
||||
if *n > 0 =>
|
||||
{
|
||||
} if *n > 0 => {
|
||||
self.cursor_right(*n as u32, out)?;
|
||||
}
|
||||
Change::CursorPosition {
|
||||
@ -621,9 +613,11 @@ mod test {
|
||||
ProbeHintsBuilder::default()
|
||||
.terminfo_db(Some(
|
||||
terminfo::Database::from_buffer(data.as_ref()).unwrap(),
|
||||
)).build()
|
||||
))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap()
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn no_terminfo_all_enabled() -> Capabilities {
|
||||
@ -632,7 +626,8 @@ mod test {
|
||||
.color_level(Some(ColorLevel::TrueColor))
|
||||
.build()
|
||||
.unwrap(),
|
||||
).unwrap()
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
struct FakeTty {
|
||||
@ -785,7 +780,8 @@ mod test {
|
||||
Change::Text("not ".into()),
|
||||
Change::Attribute(AttributeChange::Intensity(Intensity::Bold)),
|
||||
Change::Text("foo".into()),
|
||||
]).unwrap();
|
||||
])
|
||||
.unwrap();
|
||||
|
||||
let result = out.parse();
|
||||
assert_eq!(
|
||||
@ -922,7 +918,8 @@ mod test {
|
||||
Change::Text("not ".into()),
|
||||
Change::Attribute(AttributeChange::Intensity(Intensity::Bold)),
|
||||
Change::Text("foo".into()),
|
||||
]).unwrap();
|
||||
])
|
||||
.unwrap();
|
||||
|
||||
let result = out.parse();
|
||||
assert_eq!(
|
||||
@ -956,7 +953,8 @@ mod test {
|
||||
Change::Attribute(AttributeChange::Intensity(Intensity::Bold)),
|
||||
Change::Text("red".into()),
|
||||
Change::Attribute(AttributeChange::Foreground(AnsiColor::Red.into())),
|
||||
]).unwrap();
|
||||
])
|
||||
.unwrap();
|
||||
|
||||
let result = out.parse();
|
||||
assert_eq!(
|
||||
@ -991,7 +989,8 @@ mod test {
|
||||
Change::Attribute(AttributeChange::Intensity(Intensity::Bold)),
|
||||
Change::Text("red".into()),
|
||||
Change::Attribute(AttributeChange::Foreground(AnsiColor::Red.into())),
|
||||
]).unwrap();
|
||||
])
|
||||
.unwrap();
|
||||
|
||||
let result = out.parse();
|
||||
assert_eq!(
|
||||
@ -1025,7 +1024,8 @@ mod test {
|
||||
ColorSpec::TrueColor(RgbColor::new(255, 128, 64)).into(),
|
||||
)),
|
||||
Change::Text("A".into()),
|
||||
]).unwrap();
|
||||
])
|
||||
.unwrap();
|
||||
|
||||
let result = out.parse();
|
||||
assert_eq!(
|
||||
@ -1047,7 +1047,8 @@ mod test {
|
||||
ColorSpec::TrueColor(RgbColor::new(255, 128, 64)).into(),
|
||||
)),
|
||||
Change::Text("A".into()),
|
||||
]).unwrap();
|
||||
])
|
||||
.unwrap();
|
||||
|
||||
let result = out.parse();
|
||||
assert_eq!(
|
||||
|
@ -329,9 +329,10 @@ impl Line {
|
||||
if text_run.len() > 0 {
|
||||
// if this is just spaces then it is likely cheaper
|
||||
// to emit ClearToEndOfLine instead.
|
||||
if attr == CellAttributes::default()
|
||||
.set_background(attr.background)
|
||||
.clone()
|
||||
if attr
|
||||
== CellAttributes::default()
|
||||
.set_background(attr.background)
|
||||
.clone()
|
||||
{
|
||||
let left = text_run.trim_right_matches(' ').to_string();
|
||||
let num_trailing_spaces = text_run.len() - left.len();
|
||||
|
@ -216,7 +216,8 @@ impl Surface {
|
||||
image.top_left.y + ypos + ysize,
|
||||
),
|
||||
image.image.clone(),
|
||||
)))).clone(),
|
||||
))))
|
||||
.clone(),
|
||||
),
|
||||
);
|
||||
|
||||
@ -1434,7 +1435,8 @@ mod test {
|
||||
TextureCoordinate::new_f32(0.0, 0.0),
|
||||
TextureCoordinate::new_f32(0.25, 0.5),
|
||||
data.clone()
|
||||
)))).clone()
|
||||
))))
|
||||
.clone()
|
||||
),
|
||||
Cell::new(
|
||||
' ',
|
||||
@ -1443,7 +1445,8 @@ mod test {
|
||||
TextureCoordinate::new_f32(0.25, 0.0),
|
||||
TextureCoordinate::new_f32(0.5, 0.5),
|
||||
data.clone()
|
||||
)))).clone()
|
||||
))))
|
||||
.clone()
|
||||
),
|
||||
Cell::new(
|
||||
' ',
|
||||
@ -1452,7 +1455,8 @@ mod test {
|
||||
TextureCoordinate::new_f32(0.5, 0.0),
|
||||
TextureCoordinate::new_f32(0.75, 0.5),
|
||||
data.clone()
|
||||
)))).clone()
|
||||
))))
|
||||
.clone()
|
||||
),
|
||||
Cell::new(
|
||||
' ',
|
||||
@ -1461,7 +1465,8 @@ mod test {
|
||||
TextureCoordinate::new_f32(0.75, 0.0),
|
||||
TextureCoordinate::new_f32(1.0, 0.5),
|
||||
data.clone()
|
||||
)))).clone()
|
||||
))))
|
||||
.clone()
|
||||
),
|
||||
],
|
||||
[
|
||||
@ -1472,7 +1477,8 @@ mod test {
|
||||
TextureCoordinate::new_f32(0.0, 0.5),
|
||||
TextureCoordinate::new_f32(0.25, 1.0),
|
||||
data.clone()
|
||||
)))).clone()
|
||||
))))
|
||||
.clone()
|
||||
),
|
||||
Cell::new(
|
||||
' ',
|
||||
@ -1481,7 +1487,8 @@ mod test {
|
||||
TextureCoordinate::new_f32(0.25, 0.5),
|
||||
TextureCoordinate::new_f32(0.5, 1.0),
|
||||
data.clone()
|
||||
)))).clone()
|
||||
))))
|
||||
.clone()
|
||||
),
|
||||
Cell::new(
|
||||
' ',
|
||||
@ -1490,7 +1497,8 @@ mod test {
|
||||
TextureCoordinate::new_f32(0.5, 0.5),
|
||||
TextureCoordinate::new_f32(0.75, 1.0),
|
||||
data.clone()
|
||||
)))).clone()
|
||||
))))
|
||||
.clone()
|
||||
),
|
||||
Cell::new(
|
||||
' ',
|
||||
@ -1499,7 +1507,8 @@ mod test {
|
||||
TextureCoordinate::new_f32(0.75, 0.5),
|
||||
TextureCoordinate::new_f32(1.0, 1.0),
|
||||
data.clone()
|
||||
)))).clone()
|
||||
))))
|
||||
.clone()
|
||||
),
|
||||
],
|
||||
]
|
||||
@ -1524,7 +1533,8 @@ mod test {
|
||||
TextureCoordinate::new_f32(0.25, 0.3),
|
||||
TextureCoordinate::new_f32(0.75, 0.8),
|
||||
data.clone()
|
||||
)))).clone()
|
||||
))))
|
||||
.clone()
|
||||
),]]
|
||||
);
|
||||
}
|
||||
|
@ -470,7 +470,8 @@ impl Drop for UnixTerminal {
|
||||
CSI::Mode(Mode::ResetDecPrivateMode(DecPrivateMode::Code(
|
||||
DecPrivateModeCode::$variant
|
||||
)))
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
};
|
||||
}
|
||||
if self.caps.bracketed_paste() {
|
||||
|
@ -326,7 +326,8 @@ impl LayoutState {
|
||||
self.solver
|
||||
.add_constraint(
|
||||
state.left + state.width | LE(REQUIRED) | parent_left.clone() + parent_width,
|
||||
).map_err(adderr)?;
|
||||
)
|
||||
.map_err(adderr)?;
|
||||
self.solver
|
||||
.add_constraint(state.left | GE(REQUIRED) | parent_left.clone())
|
||||
.map_err(adderr)?;
|
||||
@ -334,7 +335,8 @@ impl LayoutState {
|
||||
self.solver
|
||||
.add_constraint(
|
||||
state.top + state.height | LE(REQUIRED) | parent_top.clone() + parent_height,
|
||||
).map_err(adderr)?;
|
||||
)
|
||||
.map_err(adderr)?;
|
||||
self.solver
|
||||
.add_constraint(state.top | GE(REQUIRED) | parent_top.clone())
|
||||
.map_err(adderr)?;
|
||||
@ -383,7 +385,8 @@ impl LayoutState {
|
||||
self.solver
|
||||
.add_constraint(
|
||||
state.width | EQ(STRONG) | f64::from(pct) * parent_width / 100.0,
|
||||
).map_err(adderr)?;
|
||||
)
|
||||
.map_err(adderr)?;
|
||||
}
|
||||
}
|
||||
self.solver
|
||||
@ -391,7 +394,8 @@ impl LayoutState {
|
||||
state.width
|
||||
| GE(STRONG)
|
||||
| f64::from(state.constraints.width.minimum.unwrap_or(1).max(1)),
|
||||
).map_err(adderr)?;
|
||||
)
|
||||
.map_err(adderr)?;
|
||||
if let Some(max_width) = state.constraints.width.maximum {
|
||||
self.solver
|
||||
.add_constraint(state.width | LE(STRONG) | f64::from(max_width))
|
||||
@ -408,7 +412,8 @@ impl LayoutState {
|
||||
self.solver
|
||||
.add_constraint(
|
||||
state.height | EQ(STRONG) | f64::from(pct) * parent_height / 100.0,
|
||||
).map_err(adderr)?;
|
||||
)
|
||||
.map_err(adderr)?;
|
||||
}
|
||||
}
|
||||
self.solver
|
||||
@ -416,7 +421,8 @@ impl LayoutState {
|
||||
state.height
|
||||
| GE(STRONG)
|
||||
| f64::from(state.constraints.height.minimum.unwrap_or(1).max(1)),
|
||||
).map_err(adderr)?;
|
||||
)
|
||||
.map_err(adderr)?;
|
||||
if let Some(max_height) = state.constraints.height.maximum {
|
||||
self.solver
|
||||
.add_constraint(state.height | LE(STRONG) | f64::from(max_height))
|
||||
@ -450,14 +456,16 @@ impl LayoutState {
|
||||
child_state.left + child_state.width
|
||||
| EQ(STRONG)
|
||||
| state.left + state.width,
|
||||
).map_err(adderr)?,
|
||||
)
|
||||
.map_err(adderr)?,
|
||||
HorizontalAlignment::Center => self
|
||||
.solver
|
||||
.add_constraint(
|
||||
child_state.left
|
||||
| EQ(STRONG)
|
||||
| state.left + (state.width - child_state.width) / 2.0,
|
||||
).map_err(adderr)?,
|
||||
)
|
||||
.map_err(adderr)?,
|
||||
}
|
||||
|
||||
match child_state.constraints.valign {
|
||||
@ -471,14 +479,16 @@ impl LayoutState {
|
||||
child_state.top + child_state.height
|
||||
| EQ(STRONG)
|
||||
| state.top + state.height,
|
||||
).map_err(adderr)?,
|
||||
)
|
||||
.map_err(adderr)?,
|
||||
VerticalAlignment::Middle => self
|
||||
.solver
|
||||
.add_constraint(
|
||||
child_state.top
|
||||
| EQ(STRONG)
|
||||
| state.top + (state.height - child_state.height) / 2.0,
|
||||
).map_err(adderr)?,
|
||||
)
|
||||
.map_err(adderr)?,
|
||||
}
|
||||
|
||||
match state.constraints.child_orientation {
|
||||
|
Loading…
Reference in New Issue
Block a user