~jamii/focus

2b43964b943660eb94f8a2ab02457ba595cd7a89 — Jamie Brandon 11 months ago f0521f5
Force scroll on A-i/k

Sometimes I hit A-k but the cursor is already at the bottom so nothing
moves and then I'm sad.
1 files changed, 10 insertions(+), 2 deletions(-)

M lib/focus/editor.zig
M lib/focus/editor.zig => lib/focus/editor.zig +10 -2
@@ 191,8 191,16 @@ pub const Editor = struct {
                            ' ' => for (self.cursors.items) |*cursor| self.swapHead(cursor),
                            'j' => for (self.cursors.items) |*cursor| self.goRealLineStart(cursor),
                            'l' => for (self.cursors.items) |*cursor| self.goRealLineEnd(cursor),
                            'k' => for (self.cursors.items) |*cursor| self.goBufferEnd(cursor),
                            'i' => for (self.cursors.items) |*cursor| self.goBufferStart(cursor),
                            'k' => {
                                for (self.cursors.items) |*cursor| self.goBufferEnd(cursor);
                                // hardcode because we want to scroll even if cursor didn't move
                                self.top_pixel = @intCast(Coord, self.buffer.countLines()) * self.app.atlas.char_height;
                            },
                            'i' => {
                                for (self.cursors.items) |*cursor| self.goBufferStart(cursor);
                                // hardcode because we want to scroll even if cursor didn't move
                                self.top_pixel = 0;
                            },
                            '/' => for (self.cursors.items) |*cursor| self.modifyComment(cursor, .Remove),
                            else => accept_textinput = true,
                        }