Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improv: allow non-multiline to search beyond monitor limit #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lua/flit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,23 @@ local function flit(kwargs)
return '\\V' .. (kwargs.multiline == false and '\\%.l' or '') .. input
end

local function get_horizontal_bounds()
local dec = require('leap.util')['dec']
local window_width = api.nvim_win_get_width(0)
local textoff = vim.fn.getwininfo(vim.fn.win_getid())[1].textoff
local offset_in_win = dec(vim.fn.wincol())
local offset_in_editable_win = (offset_in_win - textoff)
local left_bound = (vim.fn.virtcol(".") - offset_in_editable_win)
local right_bound = (left_bound + dec((window_width - textoff)))
if kwargs.multiline == false then
right_bound = api.nvim_strwidth(api.nvim_get_current_line())
end
return { left_bound, right_bound }
end

local function get_targets(pattern)
local search = require('leap.search')
local bounds = search['get-horizontal-bounds']()
local bounds = get_horizontal_bounds()
local get_char_at = require('leap.util')['get-char-at']
local match_positions = search['get-match-positions'](
pattern, bounds, { ['backward?'] = kwargs.cc.backward }
Expand Down