fix(editor): fix cursor positioning, scrolling, and clipping
- Fix cursor vertical alignment and ensure it respects ScrollOffset. - Fix scrolling in editor page by correctly registering scroll interactions in the renderer. - Ensure cursor is clipped to the editor text area to prevent drawing over status bars.
This commit is contained in:
@@ -374,13 +374,15 @@ func EditorLayout(screenWidth, screenHeight ui.Dp, wordWrap bool) []ui.Element {
|
||||
// approximation until GlyphLayout-based line tracking is added).
|
||||
line, col := byteOffsetToLineCol(TheState.Editor.Buffer, TheState.Editor.CursorPosition)
|
||||
|
||||
// Create the cursor element at the computed position
|
||||
// Create the cursor element at the computed position.
|
||||
// Ensure the cursor element knows its bounds for clipping.
|
||||
cursorElem := ui.NewCursor(
|
||||
"editor_cursor",
|
||||
ui.Region{X: cursorX, Y: cursorY, W: ui.Dp(2), H: lineHeight},
|
||||
line, col,
|
||||
true,
|
||||
)
|
||||
cursorElem.ClipRegion = editorRegion
|
||||
|
||||
return []ui.Element{statusBar, editorElem, cursorElem, bottomBar}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user