input: use faster model access (#193476)

For #193427

Doesn't really matter here since it's just a search input, but use best practices anyway.
This commit is contained in:
Connor Peet 2023-09-19 08:28:01 -07:00 committed by GitHub
parent fa45b00051
commit db6150c8f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -444,7 +444,7 @@ export class ContextScopedSuggestEnabledInputWithHistory extends SuggestEnabledI
this._register(this.inputWidget.onDidChangeCursorPosition(({ position }) => {
const viewModel = this.inputWidget._getViewModel()!;
const lastLineNumber = viewModel.getLineCount();
const lastLineCol = viewModel.getLineContent(lastLineNumber).length + 1;
const lastLineCol = viewModel.getLineLength(lastLineNumber) + 1;
const viewPosition = viewModel.coordinatesConverter.convertModelPositionToViewPosition(position);
historyNavigationBackwardsEnablement.set(viewPosition.lineNumber === 1 && viewPosition.column === 1);
historyNavigationForwardsEnablement.set(viewPosition.lineNumber === lastLineNumber && viewPosition.column === lastLineCol);