Change:
Version: 1.94.0-insider Commit: Date: 2024-09-23T05:12:01.964Z Electron: 30.5.0 ElectronBuildId: Chromium: 124.0.6367.243 20.16.0 V8: 12.4.254.20-electron.0 OS: Darwin arm64 22.6.0 Steps to Reproduce: a very long line. Google IME for Japanese. at the last of the long line. position of the IME widget is not optimal. ! With , it is worse. !
Hi yes thanks a lot for opening this valuable issue. This is happening because we use the model ranges instead of the view ranges in the control bounds, selection bounds and character bounds positioning. The following PR fixes this:
I try the OSS version from the repository. The issue with is fixed. However, I still see the issue with Version: 1.94.0 Commit: Date: Unknown Electron: 30.5.1 ElectronBuildId: undefined Chromium: 124.0.6367.243 20.16.0 V8: 12.4.254.20-electron.0 OS: Darwin arm64 22.6.0 a very long line. Google IME for Japanese. at the last of the long line. position of the IME widget is not optimal. !
Oh I see thanks for letting me know that is curious. I will reopen the issue and have a look.
After investigating the issue, I believe this happens because I didn't remove the editor scroll left position from the bounds set for the selection and character bounds. The following PR should fix this.

Discussion:
const lineHeight = options.get(EditorOption.lineHeight); const contentLeft = options.get(EditorOption.layoutInfo).contentLeft; const parentBounds = this._parent.getBoundingClientRect(); <del> const verticalOffsetStart = this._context.viewLayout.getVerticalOffsetForLineNumber(this._primarySelection.startLineNumber); </del> <ins> const modelStartPosition = this._primarySelection.getStartPosition(); const viewStartPosition = this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(modelStartPosition); const verticalOffsetStart = this._context.viewLayout.getVerticalOffsetForLineNumber(viewStartPosition.lineNumber); </ins> const editorScrollTop = this._context.viewLayout.getCurrentScrollTop(); const top = parentBounds.top + verticalOffsetStart - editorScrollTop;

let width: number; if (this._primarySelection.isEmpty()) { <del> const linesVisibleRanges = ctx.visibleRangeForPosition(this._primarySelection.getPosition()); </del> <ins> const linesVisibleRanges = ctx.visibleRangeForPosition(viewStartPosition); </ins> if (linesVisibleRanges) { left += linesVisibleRanges.left; }

const textStartLineOffsetWithinEditor = this._textStartPositionWithinEditor.lineNumber - 1; const characterStartPosition = new Position(textStartLineOffsetWithinEditor + editContextStartPosition.lineNumber, editContextStartPosition.column); const characterEndPosition = characterStartPosition.delta(0, 1); <del> const characterRange = Range.fromPositions(characterStartPosition, characterEndPosition); const characterLinesVisibleRanges = this._visibleRangeProvider.linesVisibleRangesForRange(characterRange, true) ?? []; const characterVerticalOffset = this._context.viewLayout.getVerticalOffsetForLineNumber(characterRange.startLineNumber); </del> <ins> const characterModelRange = Range.fromPositions(characterStartPosition, characterEndPosition); const characterViewRange = this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(characterModelRange); const characterLinesVisibleRanges = this._visibleRangeProvider.linesVisibleRangesForRange(characterViewRange, true) ?? []; const characterVerticalOffset = this._context.viewLayout.getVerticalOffsetForLineNumber(characterViewRange.startLineNumber); </ins> const editorScrollTop = this._context.viewLayout.getCurrentScrollTop(); const top = parentBounds.top + characterVerticalOffset - editorScrollTop;