File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -37,12 +37,26 @@ function toPopupCreateOptions(
3737 } ;
3838}
3939
40+ function handleRelative (
41+ relative : "editor" | "cursor" ,
42+ offset ?: number ,
43+ ) : string | number | undefined {
44+ if ( offset == undefined ) {
45+ return undefined ;
46+ }
47+ if ( relative == "editor" ) {
48+ return offset ;
49+ } else {
50+ return offset < 0 ? `cursor${ offset } ` : `cursor+${ offset } ` ;
51+ }
52+ }
53+
4054function toPopupSetOptionsOptions (
4155 options : Partial < Omit < OpenOptions , "bufnr" | "noRedraw" > > ,
4256) : vimFn . PopupSetOptionsOptions {
4357 const v : vimFn . PopupCreateOptions = {
44- line : options . row ,
45- col : options . col ,
58+ line : handleRelative ( options . relative ?? "editor" , options . row ) ,
59+ col : handleRelative ( options . relative ?? "editor" , options . col ) ,
4660 pos : options . anchor ? posFromAnchor ( options . anchor ) : undefined ,
4761 fixed : true , // To keep consistent with the behavior of Neovim's floating window
4862 flip : false , // To keep consistent with the behavior of Neovim's floating window
You can’t perform that action at this time.
0 commit comments