aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/loader.lua
diff options
context:
space:
mode:
authorYi Ming <ofseed@foxmail.com>2026-05-07 04:37:16 +0800
committerGitHub <noreply@github.com>2026-05-06 16:37:16 -0400
commit9174157f7498bb79c51164d94aeaef6ce7508410 (patch)
treeb7a2188c91c6ca85871f1a30c932b12d717612b5 /runtime/lua/vim/loader.lua
parent7b00f58d841db5a9b5f0ac82220bebe7a942be08 (diff)
downloadrneovim-9174157f7498bb79c51164d94aeaef6ce7508410.tar.gz
rneovim-9174157f7498bb79c51164d94aeaef6ce7508410.tar.bz2
rneovim-9174157f7498bb79c51164d94aeaef6ce7508410.zip
feat(pos): pos:to_offset(), pos.offset() #39564
Problem: For a given position, it is not easy to compare which of several other positions is closest to it. Solution: Add support for converting `vim.Pos` to a buffer byte offset. This allows for sorting, e.g: ```lua table.sort(positions, function(pos1, pos2) return pos1:to_offset() < pos2:to_offset() end ``` Or a binary search, e.g: ```lua vim.list.bisect(positions, pos, { key = function(pos) return pos:to_offset() end }) ```
Diffstat (limited to 'runtime/lua/vim/loader.lua')
0 files changed, 0 insertions, 0 deletions