1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 22:01:47 +03:00

search: auto-update when the pane content changes

refs: https://github.com/wez/wezterm/issues/1205
This commit is contained in:
Wez Furlong 2021-10-05 20:17:45 -07:00
parent 87ea33f2f8
commit 4eef20320d
2 changed files with 8 additions and 0 deletions

View File

@ -55,6 +55,7 @@ As features stabilize some brief notes about them will accumulate here.
* Fixed: wezterm can now match bitmap fonts that are spread across multiple font files [#1189](https://github.com/wez/wezterm/issues/1189)
* Improved: [use_cap_height_to_scale_fallback_fonts](config/lua/config/use_cap_height_to_scale_fallback_fonts.md) now computes *cap-height* based on the rasterized glyph bitmap which means that the data is accurate in more cases, including for bitmap fonts. Scaling is now also applied across varying text styles; previously it only applied to a font within an `wezterm.font_with_fallback` font list.
* Fixed: ssh config parser incorrectly split `Host` patterns with commas instead of whitespace [#1196](https://github.com/wez/wezterm/issues/1196)
* Fixed: search now auto-updates when the pane content changes [#1205](https://github.com/wez/wezterm/issues/1205)
### 20210814-124438-54e29167

View File

@ -37,6 +37,7 @@ struct SearchRenderable {
/// The most recently queried set of matches
results: Vec<SearchResult>,
by_line: HashMap<StableRowIndex, Vec<MatchResult>>,
last_result_seqno: SequenceNo,
viewport: Option<StableRowIndex>,
last_bar_pos: Option<StableRowIndex>,
@ -68,6 +69,7 @@ impl SearchOverlay {
dirty_results: RangeSet::default(),
viewport,
last_bar_pos: None,
last_result_seqno: SEQ_ZERO,
window,
result_pos: None,
width: dims.cols,
@ -292,6 +294,10 @@ impl Pane for SearchOverlay {
fn get_lines(&self, lines: Range<StableRowIndex>) -> (StableRowIndex, Vec<Line>) {
let mut renderer = self.renderer.borrow_mut();
if self.delegate.get_current_seqno() > renderer.last_result_seqno {
renderer.update_search();
}
renderer.check_for_resize();
let dims = self.get_dimensions();
@ -436,6 +442,7 @@ impl SearchRenderable {
let bar_pos = self.compute_search_row();
self.dirty_results.add(bar_pos);
self.last_result_seqno = self.delegate.get_current_seqno();
if !self.pattern.is_empty() {
let pane: Rc<dyn Pane> = self.delegate.clone();