Skip to content

Commit a6921e0

Browse files
committed
rename widget: fix not showing on 2nd try
1 parent 69f86ad commit a6921e0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/vs/editor/contrib/rename/browser/renameInputField.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,12 @@ export class RenameInputField implements IContentWidget {
179179

180180
const bodyBox = getClientArea(this.getDomNode().ownerDocument.body);
181181
const editorBox = getDomNodePagePosition(this._editor.getDomNode());
182-
const cursorBox = this._editor.getScrolledVisiblePosition(this._position!);
183182

184-
this._nPxAvailableAbove = cursorBox.top + editorBox.top;
183+
// FIXME@ulugbekna: can getVisibleRanges() be empty? if so what to do about it
184+
const firstLineInViewport = this._editor.getVisibleRanges()[0].startLineNumber;
185+
const cursorBoxTop = this._editor.getTopForLineNumber(this._position!.lineNumber) - this._editor.getTopForLineNumber(firstLineInViewport);
186+
187+
this._nPxAvailableAbove = cursorBoxTop + editorBox.top;
185188
this._nPxAvailableBelow = bodyBox.height - this._nPxAvailableAbove;
186189

187190
const lineHeight = this._editor.getOption(EditorOption.lineHeight);

0 commit comments

Comments
 (0)