Don't return Results from position methods in FoldMap and DisplayMap
This commit is contained in:
committed by
Antonio Scandurra
parent
72b98ad688
commit
b3d2a70834
@@ -72,8 +72,8 @@ impl Selection {
|
||||
}
|
||||
|
||||
pub fn display_range(&self, map: &DisplayMap, app: &AppContext) -> Range<DisplayPoint> {
|
||||
let start = self.start.to_display_point(map, app).unwrap();
|
||||
let end = self.end.to_display_point(map, app).unwrap();
|
||||
let start = self.start.to_display_point(map, app);
|
||||
let end = self.end.to_display_point(map, app);
|
||||
if self.reversed {
|
||||
end..start
|
||||
} else {
|
||||
@@ -87,12 +87,11 @@ impl Selection {
|
||||
map: &DisplayMap,
|
||||
ctx: &AppContext,
|
||||
) -> (Range<u32>, Range<u32>) {
|
||||
let display_start = self.start.to_display_point(map, ctx).unwrap();
|
||||
let buffer_start = DisplayPoint::new(display_start.row(), 0)
|
||||
.to_buffer_point(map, Bias::Left, ctx)
|
||||
.unwrap();
|
||||
let display_start = self.start.to_display_point(map, ctx);
|
||||
let buffer_start =
|
||||
DisplayPoint::new(display_start.row(), 0).to_buffer_point(map, Bias::Left, ctx);
|
||||
|
||||
let mut display_end = self.end.to_display_point(map, ctx).unwrap();
|
||||
let mut display_end = self.end.to_display_point(map, ctx);
|
||||
if !include_end_if_at_line_start
|
||||
&& display_end.row() != map.max_point(ctx).row()
|
||||
&& display_start.row() != display_end.row()
|
||||
@@ -100,12 +99,8 @@ impl Selection {
|
||||
{
|
||||
*display_end.row_mut() -= 1;
|
||||
}
|
||||
let buffer_end = DisplayPoint::new(
|
||||
display_end.row(),
|
||||
map.line_len(display_end.row(), ctx).unwrap(),
|
||||
)
|
||||
.to_buffer_point(map, Bias::Left, ctx)
|
||||
.unwrap();
|
||||
let buffer_end = DisplayPoint::new(display_end.row(), map.line_len(display_end.row(), ctx))
|
||||
.to_buffer_point(map, Bias::Left, ctx);
|
||||
|
||||
(
|
||||
buffer_start.row..buffer_end.row + 1,
|
||||
|
||||
Reference in New Issue
Block a user