Compare commits
2 commits
29231ad87a
...
c1707b132e
| Author | SHA1 | Date | |
|---|---|---|---|
| c1707b132e | |||
| 891b80e5bb |
2 changed files with 16 additions and 2 deletions
|
|
@ -1039,9 +1039,19 @@ const Node = union(enum) {
|
|||
}
|
||||
}
|
||||
};
|
||||
const pattern_ = switch (mode) {
|
||||
.exact => pattern,
|
||||
.case_folded => unicode.case_fold(allocator, pattern) catch
|
||||
allocator.dupe(u8, pattern) catch
|
||||
@panic("OOM find_all_ranges"),
|
||||
};
|
||||
defer switch (mode) {
|
||||
.exact => {},
|
||||
.case_folded => allocator.free(pattern_),
|
||||
};
|
||||
var ctx: Ctx = .{
|
||||
.allocator = allocator,
|
||||
.pattern = pattern,
|
||||
.pattern = pattern_,
|
||||
.data = data,
|
||||
.callback = callback,
|
||||
.buf = try allocator.alloc(u8, pattern.len * 2),
|
||||
|
|
|
|||
|
|
@ -180,7 +180,11 @@ const cmds = struct {
|
|||
pub fn toggle_find_mode(self: *Self, _: Ctx) Result {
|
||||
const new_find_mode: Buffer.FindMode = switch (self.find_mode) {
|
||||
.exact => .case_folded,
|
||||
.auto, .case_folded => .exact,
|
||||
.case_folded => .exact,
|
||||
.auto => if (Buffer.unicode.is_lowercase(self.input_.items))
|
||||
.exact
|
||||
else
|
||||
.case_folded,
|
||||
};
|
||||
const allocator = self.allocator;
|
||||
const query = try allocator.dupe(u8, self.input_.items);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue