Commit 3a5c45d4 authored by MovingtoMars's avatar MovingtoMars

rename word_fn -> word_divider_fn

parent c8f9bf91
......@@ -5,7 +5,7 @@ use termion::raw::{IntoRawMode, RawTerminal};
use super::*;
use keymap;
/// The default for `Context.word_fn`.
/// The default for `Context.word_divider_fn`.
pub fn get_buffer_words(buf: &Buffer) -> Vec<(usize, usize)> {
let mut res = Vec::new();
......@@ -49,7 +49,7 @@ pub enum KeyBindings {
pub struct Context {
pub history: History,
pub completer: Option<Box<Completer>>,
pub word_fn: Box<Fn(&Buffer) -> Vec<(usize, usize)>>,
pub word_divider_fn: Box<Fn(&Buffer) -> Vec<(usize, usize)>>,
pub key_bindings: KeyBindings,
}
......@@ -58,7 +58,7 @@ impl Context {
Context {
history: History::new(),
completer: None,
word_fn: Box::new(get_buffer_words),
word_divider_fn: Box::new(get_buffer_words),
key_bindings: KeyBindings::Emacs,
}
}
......
......@@ -131,7 +131,7 @@ impl<'a, W: Write> Editor<'a, W> {
}
pub fn get_words_and_cursor_position(&self) -> (Vec<(usize, usize)>, CursorPosition) {
let word_fn = &self.context.word_fn;
let word_fn = &self.context.word_divider_fn;
let words = word_fn(cur_buf!(self));
let pos = CursorPosition::get(self.cursor, &words);
(words, pos)
......
......@@ -20,9 +20,9 @@ impl<'a, 'out: 'a, W: Write + 'a> Event<'a, 'out, W> {
#[derive(Debug)]
pub enum EventKind {
/// Sent in `Editor.handle_key()`, before handling the key.
/// Sent before handling a keypress.
BeforeKey(Key),
/// Sent in `Editor.handle_key()`, after handling the key.
/// Sent after handling a keypress.
AfterKey(Key),
/// Sent in `Editor.complete()`, before processing the completion.
BeforeComplete,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment