way easier way to slice to end of storage duh

This commit is contained in:
Mitchell Hashimoto
2022-08-05 11:21:37 -07:00
parent ecaca23959
commit abde2b9e18

View File

@ -503,13 +503,9 @@ fn selectionSlices(self: Screen, sel: Selection) struct {
// The bottom and top are split into two slices, so we slice to the // The bottom and top are split into two slices, so we slice to the
// bottom of the storage, then from the top. // bottom of the storage, then from the top.
// This the last row in the storage area, which is the total rows
// in the full storage minus the top offset minus 1 (due to 0-index).
const storage_bot = self.rowIndex(self.totalRows() - self.top - 1);
return .{ return .{
.top_offset = sel_top.x, .top_offset = sel_top.x,
.top = self.storage[top + sel_top.x .. storage_bot + self.cols], .top = self.storage[top + sel_top.x .. self.storage.len],
.bot = self.storage[0 .. bot + sel_bot.x + 1], .bot = self.storage[0 .. bot + sel_bot.x + 1],
}; };
} }