mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Rustfmt
This commit is contained in:
parent
6b6398f109
commit
62260a025e
@ -11,7 +11,6 @@ fn move_top(c: &mut Cursive, x_in: isize, y_in: isize) {
|
||||
let s = c.screen_mut();
|
||||
let l = LayerPosition::FromFront(0);
|
||||
|
||||
|
||||
// Step 2. add the specifed amount
|
||||
let pos = s.offset().saturating_add((x_in, y_in));
|
||||
|
||||
|
@ -228,7 +228,8 @@ pub enum MouseButton {
|
||||
Button5,
|
||||
|
||||
// TODO: handle more buttons?
|
||||
#[doc(hidden)] Other,
|
||||
#[doc(hidden)]
|
||||
Other,
|
||||
}
|
||||
|
||||
/// Represents a possible event sent by the mouse.
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::chunk::Chunk;
|
||||
use super::segment::{Segment};
|
||||
use super::segment::Segment;
|
||||
use std::rc::Rc;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
use utils::span::SpannedText;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use super::Segment;
|
||||
use utils::span::{SpannedStr, IndexedCow, Span};
|
||||
use utils::span::{IndexedCow, Span, SpannedStr};
|
||||
|
||||
/// A list of segments representing a row of text
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@ -14,7 +14,7 @@ impl Row {
|
||||
/// Resolve the row indices into string slices and attributes.
|
||||
pub fn resolve<'a, T, S>(&self, source: S) -> Vec<Span<'a, T>>
|
||||
where
|
||||
S: Into<SpannedStr<'a, T>>
|
||||
S: Into<SpannedStr<'a, T>>,
|
||||
{
|
||||
let source = source.into();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use utils::span::{Span, SpannedStr, SpannedText, IndexedCow};
|
||||
use utils::span::{IndexedCow, Span, SpannedStr, SpannedText};
|
||||
|
||||
/// Refers to a part of a span
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -21,8 +21,7 @@ fn test_line_breaks() {
|
||||
|
||||
let iter = LinesIterator::new(&input, 17);
|
||||
|
||||
let rows: Vec<_> = iter.map(|row| row.resolve(&input))
|
||||
.collect();
|
||||
let rows: Vec<_> = iter.map(|row| row.resolve(&input)).collect();
|
||||
|
||||
assert_eq!(
|
||||
&rows[..],
|
||||
|
@ -49,7 +49,9 @@ impl<T: View> BoxView<T> {
|
||||
}
|
||||
|
||||
/// Sets the size constraints for this view.
|
||||
pub fn set_constraints(&mut self, width: SizeConstraint, height: SizeConstraint) {
|
||||
pub fn set_constraints(
|
||||
&mut self, width: SizeConstraint, height: SizeConstraint
|
||||
) {
|
||||
self.set_width(width);
|
||||
self.set_height(height);
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ impl LinearLayout {
|
||||
|
||||
/// Returns index of focused inner view
|
||||
pub fn get_focus_index(&self) -> usize {
|
||||
self.focus
|
||||
self.focus
|
||||
}
|
||||
|
||||
// Invalidate the view, to request a layout next time
|
||||
|
@ -373,11 +373,10 @@ impl View for ListView {
|
||||
// Send the event to the focused child.
|
||||
let labels_width = self.labels_width();
|
||||
if let ListChild::Row(_, ref mut view) = self.children[self.focus] {
|
||||
|
||||
// If self.focus < self.scrollbase.start_line, it means the focus is not
|
||||
// in view. Something's fishy, so don't send the event.
|
||||
if let Some(y) = self.focus.checked_sub(self.scrollbase.start_line) {
|
||||
|
||||
if let Some(y) = self.focus.checked_sub(self.scrollbase.start_line)
|
||||
{
|
||||
let offset = (labels_width + 1, y);
|
||||
let result = view.on_event(event.relativized(offset));
|
||||
if result.is_consumed() {
|
||||
|
Loading…
Reference in New Issue
Block a user