Fix style issues
This commit is contained in:
parent
55e675a3d8
commit
63a40df520
|
@ -68,7 +68,7 @@ impl Descriptor {
|
||||||
font_name: desc.font_name(),
|
font_name: desc.font_name(),
|
||||||
style_name: desc.style_name(),
|
style_name: desc.style_name(),
|
||||||
display_name: desc.display_name(),
|
display_name: desc.display_name(),
|
||||||
font_path: desc.font_path().unwrap_or_else(||{"".to_owned()}),
|
font_path: desc.font_path().unwrap_or_else(String::new),
|
||||||
ct_descriptor: desc,
|
ct_descriptor: desc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ impl<'a> Iterator for Iter<'a> {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let pattern = unsafe {
|
let pattern = unsafe {
|
||||||
let ptr = *(*self.font_set.as_ptr()).fonts.offset(self.current as isize);
|
let ptr = *(*self.font_set.as_ptr()).fonts.add(self.current);
|
||||||
PatternRef::from_ptr(ptr)
|
PatternRef::from_ptr(ptr)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
//! Defines the Row type which makes up lines in the grid
|
//! Defines the Row type which makes up lines in the grid
|
||||||
|
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
use std::ops::{Range, RangeTo, RangeFrom, RangeFull};
|
use std::ops::{Range, RangeTo, RangeFrom, RangeFull, RangeToInclusive};
|
||||||
use std::cmp::{max, min};
|
use std::cmp::{max, min};
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
|
@ -200,3 +200,20 @@ impl<T> IndexMut<RangeFull> for Row<T> {
|
||||||
&mut self.inner[..]
|
&mut self.inner[..]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<T> Index<RangeToInclusive<Column>> for Row<T> {
|
||||||
|
type Output = [T];
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn index(&self, index: RangeToInclusive<Column>) -> &[T] {
|
||||||
|
&self.inner[..=(index.end.0)]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> IndexMut<RangeToInclusive<Column>> for Row<T> {
|
||||||
|
#[inline]
|
||||||
|
fn index_mut(&mut self, index: RangeToInclusive<Column>) -> &mut [T] {
|
||||||
|
self.occ = max(self.occ, *index.end);
|
||||||
|
&mut self.inner[..=(index.end.0)]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -232,8 +232,8 @@ impl<T> Storage<T> {
|
||||||
// Cast to a qword array to opt out of copy restrictions and avoid
|
// Cast to a qword array to opt out of copy restrictions and avoid
|
||||||
// drop hazards. Byte array is no good here since for whatever
|
// drop hazards. Byte array is no good here since for whatever
|
||||||
// reason LLVM won't optimized it.
|
// reason LLVM won't optimized it.
|
||||||
let a_ptr = self.inner.as_mut_ptr().offset(a as isize) as *mut u64;
|
let a_ptr = self.inner.as_mut_ptr().add(a) as *mut u64;
|
||||||
let b_ptr = self.inner.as_mut_ptr().offset(b as isize) as *mut u64;
|
let b_ptr = self.inner.as_mut_ptr().add(b) as *mut u64;
|
||||||
|
|
||||||
// Copy 1 qword at a time
|
// Copy 1 qword at a time
|
||||||
//
|
//
|
||||||
|
|
|
@ -67,7 +67,7 @@ pub fn set_locale_environment() {
|
||||||
// try setting `locale_id`
|
// try setting `locale_id`
|
||||||
let modified = setlocale(LC_CTYPE, locale_ptr);
|
let modified = setlocale(LC_CTYPE, locale_ptr);
|
||||||
let result = if modified.is_null() {
|
let result = if modified.is_null() {
|
||||||
String::from("")
|
String::new()
|
||||||
} else {
|
} else {
|
||||||
locale_id
|
locale_id
|
||||||
};
|
};
|
||||||
|
|
|
@ -1725,7 +1725,7 @@ impl ansi::Handler for Term {
|
||||||
},
|
},
|
||||||
ansi::LineClearMode::Left => {
|
ansi::LineClearMode::Left => {
|
||||||
let row = &mut self.grid[self.cursor.point.line];
|
let row = &mut self.grid[self.cursor.point.line];
|
||||||
for cell in &mut row[..(col + 1)] {
|
for cell in &mut row[..=col] {
|
||||||
cell.reset(&template);
|
cell.reset(&template);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue