|
|
@ -501,7 +501,7 @@ impl std::str::FromStr for MappableCommand {
|
|
|
|
|
|
|
|
|
|
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
|
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
|
|
if let Some(suffix) = s.strip_prefix(':') {
|
|
|
|
if let Some(suffix) = s.strip_prefix(':') {
|
|
|
|
let mut typable_command = suffix.split(' ').into_iter().map(|arg| arg.trim());
|
|
|
|
let mut typable_command = suffix.split(' ').map(|arg| arg.trim());
|
|
|
|
let name = typable_command
|
|
|
|
let name = typable_command
|
|
|
|
.next()
|
|
|
|
.next()
|
|
|
|
.ok_or_else(|| anyhow!("Expected typable command name"))?;
|
|
|
|
.ok_or_else(|| anyhow!("Expected typable command name"))?;
|
|
|
@ -1470,7 +1470,7 @@ pub fn scroll(cx: &mut Context, offset: usize, direction: Direction) {
|
|
|
|
let cursor = range.cursor(text);
|
|
|
|
let cursor = range.cursor(text);
|
|
|
|
let height = view.inner_height();
|
|
|
|
let height = view.inner_height();
|
|
|
|
|
|
|
|
|
|
|
|
let scrolloff = config.scrolloff.min(height.saturating_sub(1) as usize / 2);
|
|
|
|
let scrolloff = config.scrolloff.min(height.saturating_sub(1) / 2);
|
|
|
|
let offset = match direction {
|
|
|
|
let offset = match direction {
|
|
|
|
Forward => offset as isize,
|
|
|
|
Forward => offset as isize,
|
|
|
|
Backward => -(offset as isize),
|
|
|
|
Backward => -(offset as isize),
|
|
|
|