File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -39,24 +39,24 @@ function toPopupCreateOptions(
3939
4040function handleRelative (
4141 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 } ` ;
42+ offset : number ,
43+ ) : string | number {
44+ switch ( relative ) {
45+ case "editor" :
46+ return offset ;
47+ case "cursor" :
48+ return offset < 0 ? `cursor ${ offset } ` : `cursor+ ${ offset } ` ;
49+ default :
50+ unreachable ( relative ) ;
5151 }
5252}
5353
5454function toPopupSetOptionsOptions (
5555 options : Partial < Omit < OpenOptions , "bufnr" | "noRedraw" > > ,
5656) : vimFn . PopupSetOptionsOptions {
5757 const v : vimFn . PopupCreateOptions = {
58- line : handleRelative ( options . relative ?? "editor" , options . row ) ,
59- col : handleRelative ( options . relative ?? "editor" , options . col ) ,
58+ line : options . row ? handleRelative ( options . relative ?? "editor" , options . row ) : undefined ,
59+ col : options . col ? handleRelative ( options . relative ?? "editor" , options . col ) : undefined ,
6060 pos : options . anchor ? posFromAnchor ( options . anchor ) : undefined ,
6161 fixed : true , // To keep consistent with the behavior of Neovim's floating window
6262 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