feat(selection): add Selection.is_reversed helper function
This commit is contained in:
parent
0f08b3930f
commit
1c5dc9064d
1 changed files with 5 additions and 2 deletions
|
@ -33,9 +33,12 @@ pub fn reverse(self: *Self) void {
|
||||||
self.end = tmp;
|
self.end = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub inline fn is_reversed(self: *Self) bool {
|
||||||
|
return self.begin.right_of(self.end);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn normalize(self: *Self) void {
|
pub fn normalize(self: *Self) void {
|
||||||
if (self.begin.right_of(self.end))
|
if (self.is_reversed()) self.reverse();
|
||||||
self.reverse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn write(self: *const Self, writer: Buffer.MetaWriter) !void {
|
pub fn write(self: *const Self, writer: Buffer.MetaWriter) !void {
|
||||||
|
|
Loading…
Add table
Reference in a new issue