Change summary
zed/src/editor/buffer/mod.rs | 6 ++++--
zed/src/editor/buffer/point.rs | 5 +++++
2 files changed, 9 insertions(+), 2 deletions(-)
Detailed changes
@@ -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 }
}