diff --git a/cmd/pad/pad b/cmd/pad/pad new file mode 100755 index 0000000..37f1d27 Binary files /dev/null and b/cmd/pad/pad differ diff --git a/internal/ui/render.go b/internal/ui/render.go index b4ed8dd..80e57a6 100644 --- a/internal/ui/render.go +++ b/internal/ui/render.go @@ -163,20 +163,34 @@ func (r *Renderer) drawBottomBar(gtx layout.Context, bb BottomBar) { drawY := unit.Dp(float64(drawYPx) / float64(scale)) fmt.Printf("[DEBUG drawBottomBar] drawY=%d (clamped from %d)\n", gtx.Dp(drawY), gtx.Dp(reg.Y)) + // Use the BottomBar region for X positioning, clamped to visible window width. + // The region width (1520 DP = 3040px) exceeds the window width (780px). + regXPx := int(float32(reg.X) * scale) + windowW := gtx.Constraints.Max.X + // Clamp right edge to window width + rightXPx := regXPx + int(float32(reg.W)*scale) + if rightXPx > windowW { + rightXPx = windowW + } + barW := rightXPx - regXPx + // Left: Cursor position - cursorX := reg.X + unit.Dp(8) - fmt.Printf("[DEBUG drawBottomBar] cursor=(%d, %d) text=%q\n", gtx.Dp(cursorX), gtx.Dp(drawY), bb.CursorPos) - r.drawText(gtx, r.shp, bb.CursorPos, r.theme.FontSize, cursorX, drawY, color.NRGBA{R: 0, G: 0, B: 0, A: 255}) + cursorXPx := regXPx + int(8*scale) + cursorXDp := unit.Dp(float64(cursorXPx) / float64(scale)) + fmt.Printf("[DEBUG drawBottomBar] cursor=(%d, %d) text=%q\n", cursorXPx, drawYPx, bb.CursorPos) + r.drawText(gtx, r.shp, bb.CursorPos, r.theme.FontSize, cursorXDp, drawY, color.NRGBA{R: 0, G: 0, B: 0, A: 255}) // Center: Byte position - byteX := reg.X + reg.W/2 - unit.Dp(60) // approximate center - fmt.Printf("[DEBUG drawBottomBar] byte=(%d, %d) text=%q\n", gtx.Dp(byteX), gtx.Dp(drawY), bb.BytePos) - r.drawText(gtx, r.shp, bb.BytePos, r.theme.FontSize, byteX, drawY, color.NRGBA{R: 0, G: 0, B: 0, A: 255}) + byteXPx := regXPx + barW/2 - int(60*scale) + byteXDp := unit.Dp(float64(byteXPx) / float64(scale)) + fmt.Printf("[DEBUG drawBottomBar] byte=(%d, %d) text=%q\n", byteXPx, drawYPx, bb.BytePos) + r.drawText(gtx, r.shp, bb.BytePos, r.theme.FontSize, byteXDp, drawY, color.NRGBA{R: 0, G: 0, B: 0, A: 255}) // Right: Word wrap button - wordWrapX := reg.X + reg.W - unit.Dp(80) - fmt.Printf("[DEBUG drawBottomBar] wordwrap=(%d, %d) text=%q\n", gtx.Dp(wordWrapX), gtx.Dp(drawY), "W:"+boolToString(bb.WordWrap)) - r.drawText(gtx, r.shp, "W:"+boolToString(bb.WordWrap), r.theme.FontSize, wordWrapX, drawY, color.NRGBA{R: 0, G: 0, B: 0, A: 255}) + wordWrapXPx := regXPx + barW - int(80*scale) + wordWrapXDp := unit.Dp(float64(wordWrapXPx) / float64(scale)) + fmt.Printf("[DEBUG drawBottomBar] wordwrap=(%d, %d) text=%q\n", wordWrapXPx, drawYPx, "W:"+boolToString(bb.WordWrap)) + r.drawText(gtx, r.shp, "W:"+boolToString(bb.WordWrap), r.theme.FontSize, wordWrapXDp, drawY, color.NRGBA{R: 0, G: 0, B: 0, A: 255}) } func (r *Renderer) drawButton(gtx layout.Context, btn Button) {