show_new: bool,
) -> Result<Self, ClientError> {
source.init(client)?;
+ Ok(Self::new_infallible(
+ client, source, desc, file_desc, saved_pos, unfolded, show_new,
+ ))
+ }
+ fn new_infallible(
+ client: &mut Client,
+ source: Source,
+ desc: ColouredString,
+ file_desc: Type,
+ saved_pos: Option<&SavedFilePos>,
+ unfolded: Option<Rc<RefCell<HashSet<String>>>>,
+ show_new: bool,
+ ) -> Self {
let extender = if source.extendable() {
Some(ExtendableIndicator::new())
} else {
initial_pos =
initial_pos.clip(contents.first_index(), contents.last_index());
- let ff = File {
+ File {
contents,
rendered: HashMap::new(),
pos: initial_pos,
search_direction: None,
last_search: None,
latest_read_index,
- };
- Ok(ff)
+ }
}
fn ensure_item_rendered(