summaryrefslogtreecommitdiff
path: root/src/edit.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/edit.zig')
-rw-r--r--src/edit.zig13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/edit.zig b/src/edit.zig
index 5d46b80d..33b0f050 100644
--- a/src/edit.zig
+++ b/src/edit.zig
@@ -41,16 +41,15 @@ pub fn setYank(p: *Pardes, text: []const u8) void {
'*' => name = '+',
else => {},
}
- const one = !p.multi_on;
- p.registers.put(p.gpa, name, text, if (one) 0 else p.multi_index, if (one) 1 else p.multi_count, one or p.multi_first);
- if (name == '+' and (one or p.multi_first)) p.emit(.{ .set_clipboard = {} });
+ p.registers.put(p.gpa, name, text, p.multi_index, p.multi_count, p.multi_first);
+ if (name == '+' and p.multi_first) p.emit(.{ .set_clipboard = {} });
}
/// Value `i` of register `name` as the command at range `i` reads it, the
/// computed registers included: `#` is the range's number from 1, `.` its
/// text, `%` the file's name, `_` nothing. Scratch- or register-owned.
pub fn registerValue(p: *Pardes, t: *Text, name: u21) ?[]const u8 {
- const i = if (p.multi_on) p.multi_index else 0;
+ const i = p.multi_index;
return switch (name) {
'_' => null,
'#' => std.fmt.allocPrint(p.scratch.allocator(), "{d}", .{i + 1}) catch null,
@@ -671,7 +670,7 @@ pub fn enterInsert(p: *Pardes, t: *Text, where: InsertAt, cnt: usize) void {
t.cur_row = @as(i32, @intCast(if (below) row + 1 else row)) + eb.row0;
t.cur_col = @intCast(ind.len);
t.cur_pinned = true;
- if (cnt > 1 and !p.multi_on) opened: {
+ if (cnt > 1 and p.multi_count == 1) opened: {
const t2 = flatSurface(p, t) catch break :opened;
var rs: [Text.max_selections]modal.Selection = undefined;
const m = @min(cnt, Text.max_selections);
@@ -1006,7 +1005,7 @@ fn insertEdit(p: *Pardes, t: *Text, key: Key) void {
},
Key.tab => {
const ln = modal.lineSlice(text, c.row);
- if (!p.multi_on and c.col > 0 and c.col <= ln.len and ln[c.col - 1] == '.') dot: {
+ if (p.multi_count == 1 and c.col > 0 and c.col <= ln.len and ln[c.col - 1] == '.') dot: {
if (t.what != .body) break :dot;
const f = (t.pane() orelse break :dot).file orelse break :dot;
if (f.output != null or !lsp.speaks(f.path)) break :dot;
@@ -1985,7 +1984,7 @@ pub fn surroundReplace(p: *Pardes, t: *Text, from: u21, to: u21) void {
pub fn pushUndo(p: *Pardes, t: *Text) void {
// one keystroke, one undo step — even when it edited at ten cursors.
- if (p.multi_on and !p.multi_first) return;
+ if (!p.multi_first) return;
switch (t.what) {
// A B1 chord took its one undo point when it began (mouse.zig).
.body => if (p.chord_hold) return,