summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/edit.zig2
-rw-r--r--src/lib_editor.zig6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/edit.zig b/src/edit.zig
index 4a48cfd4..105b9abf 100644
--- a/src/edit.zig
+++ b/src/edit.zig
@@ -378,7 +378,7 @@ pub fn exitInsert(e: Editor, t: *Text) void {
pub fn paneCursorLines(e: Editor, t: *Text) Error![]const []const u8 {
const arena = e.scratch;
- if (t.what != .body) {
+ if (t.what != .body or comptime Editor.lib) {
const text = try flatSurface(e, t);
const lines = try arena.alloc([]const u8, std.mem.count(u8, text, "\n") + 1);
var it = std.mem.splitScalar(u8, text, '\n');
diff --git a/src/lib_editor.zig b/src/lib_editor.zig
index 5430285a..86e494e1 100644
--- a/src/lib_editor.zig
+++ b/src/lib_editor.zig
@@ -356,6 +356,12 @@ pub fn Editor(comptime cap: Capacity) type {
pub fn selectRegex(ed: *Self, a: std.mem.Allocator, pattern: []const u8, how: RegexMode) Outcome {
const live = ed.thaw(a) catch return .{ .refused = .out_of_memory };
const t = &live.text;
+ // as pardes's prompt answers it (look.submitSearch): helix
+ // keeps the pattern in `/`
+ if (pattern.len > 0) {
+ live.registers.put(a, '/', pattern, 0, 1, true) catch return .{ .refused = .out_of_memory };
+ live.registers.last_search = '/';
+ }
var snap: [max_selections]Selection = undefined;
const got = t.ranges(t.own.?, 0, &snap);
normal.selectByRegex(live.context(a), t, snap[0..got.n], got.pri, t.vsel.active and t.vsel.explicit, pattern, how);