mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-15 06:40:17 +00:00
Reset QueryCursors before putting them back in the pool
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
c423033042
commit
fc8758c619
2 changed files with 9 additions and 2 deletions
|
@ -689,7 +689,7 @@ impl Buffer {
|
|||
(indent, is_whitespace)
|
||||
}
|
||||
|
||||
fn autoindent_for_rows(&self, rows: Range<u32>) -> Vec<usize> {
|
||||
pub fn autoindent_for_rows(&self, rows: Range<u32>) -> Vec<usize> {
|
||||
// Find the indentation level of the previous non-whitespace row.
|
||||
let mut prev_row = rows.start;
|
||||
let prev_indent = loop {
|
||||
|
@ -2237,7 +2237,9 @@ fn acquire_query_cursor() -> QueryCursor {
|
|||
.unwrap_or_else(|| QueryCursor::new())
|
||||
}
|
||||
|
||||
fn release_query_cursor(cursor: QueryCursor) {
|
||||
fn release_query_cursor(mut cursor: QueryCursor) {
|
||||
cursor.set_byte_range(0, usize::MAX);
|
||||
cursor.set_point_range(Point::zero().into(), Point::MAX.into());
|
||||
QUERY_CURSORS.lock().push(cursor)
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,11 @@ pub struct Point {
|
|||
}
|
||||
|
||||
impl Point {
|
||||
pub const MAX: Self = Self {
|
||||
row: u32::MAX,
|
||||
column: u32::MAX,
|
||||
};
|
||||
|
||||
pub fn new(row: u32, column: u32) -> Self {
|
||||
Point { row, column }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue