fn refresh_search(&mut self, forward: bool) {
        let search_history_loc = self.search_history_loc();
        self.history_subset_index = self.context.history.search_index(&self.new_buf);
        if self.history_subset_index.len() > 0 {
            self.history_subset_loc = if forward {
                Some(0)
            } else {
                Some(self.history_subset_index.len() - 1)
            };
            if let Some(target_loc) = search_history_loc {
                for (i, history_loc) in self.history_subset_index.iter().enumerate() {
                    if target_loc <= *history_loc {
                        if forward || target_loc == *history_loc || i == 0 {
                            self.history_subset_loc = Some(i);
                        } else {
                            self.history_subset_loc = Some(i-1);
                        }
                        break;
                    }
                }

            }
        } else {
            self.history_subset_loc = None;
        }

        self.reverse_search = !forward;
        self.forward_search = forward;
        self.cur_history_loc = None;
        self.no_newline = true;
        self.buffer_changed = false;
    }
/// Refresh incremental search, either when started or when the buffer changes.
Refresh incremental search, either when started or when the buffer changes.
Refresh incremental search either when started or when the buffer changes .
fn refresh_search(&mut self, forward: bool) {
        let search_history_loc = self.search_history_loc();
        self.history_subset_index = self.context.history.search_index(&self.new_buf);
        if self.history_subset_index.len() > 0 {
            self.history_subset_loc = if forward {
                Some(0)
            } else {
                Some(self.history_subset_index.len() - 1)
            };
            if let Some(target_loc) = search_history_loc {
                for (i, history_loc) in self.history_subset_index.iter().enumerate() {
                    if target_loc <= *history_loc {
                        if forward || target_loc == *history_loc || i == 0 {
                            self.history_subset_loc = Some(i);
                        } else {
                            self.history_subset_loc = Some(i-1);
                        }
                        break;
                    }
                }
            }
        } else {
            self.history_subset_loc = None;
        }
        self.reverse_search = !forward;
        self.forward_search = forward;
        self.cur_history_loc = None;
        self.no_newline = true;
        self.buffer_changed = false;
    }
fn refresh_search ( & mut self , forward : bool ) { let search_history_loc = self . search_history_loc ( ) ; self . history_subset_index = self . context . history . search_index ( & self . new_buf ) ; if self . history_subset_index . len ( ) > 0 { self . history_subset_loc = if forward { Some ( 0 ) } else { Some ( self . history_subset_index . len ( ) - 1 ) } ; if let Some ( target_loc ) = search_history_loc { for ( i , history_loc ) in self . history_subset_index . iter ( ) . enumerate ( ) { if target_loc <= * history_loc { if forward || target_loc == * history_loc || i == 0 { self . history_subset_loc = Some ( i ) ; } else { self . history_subset_loc = Some ( i - 1 ) ; } break ; } } } } else { self . history_subset_loc = None ; } self . reverse_search = ! forward ; self . forward_search = forward ; self . cur_history_loc = None ; self . no_newline = true ; self . buffer_changed = false ; }
Refresh incremental search, either when started or when the buffer changes.
Refresh incremental search either when started or when the buffer changes .
&mut self
forward
bool
&mut self
forward
bool