Skip to content

[FEATURE] Make TUI cursor style configurable (thin/line cursor instead of forced block) #32209

Closed

Description

@iloveboom

Summary

opencode's TUI forces the terminal cursor to a block shape, overriding the user's terminal-emulator cursor preference. It would be great to make the cursor style configurable (e.g. a thin/line cursor) like the cursor color already is.

Current behavior

  • The terminal is configured with a thin (bar/beam) cursor.
  • On launching opencode, the cursor switches to a block while the prompt is focused.
  • On exit, opencode restores the cursor shape (ESC [ 0 q) and color (ESC ] 112 BEL), so the behavior is clearly driven by opencode, not the terminal.

There is no opencode.json field to change this (confirmed against https://opencode.ai/config.json).

Root cause

opencode uses OpenTUI (@opencode-ai/tui → @opentui/core). The EditBufferRenderable (the prompt input) defaults its cursor style to block:

packages/core/src/renderables/EditBufferRenderable.ts

cursorStyle: {
  style: "block",
  blinking: true,
},

OpenTUI already supports all four shapes (packages/core/src/types.ts):

export type CursorStyle = "block" | "line" | "underline" | "default"

…and exposes a writable cursorStyle on the edit buffer, which it translates into DECSCUSR escape sequences.

However, opencode's prompt component only sets cursorColor, never cursorStyle:

packages/tui/src/component/prompt/index.tsx

if (props.disabled) input.cursorColor = theme.backgroundElement
if (!props.disabled) input.cursorColor = theme.text
// cursorStyle is never set -> falls back to OpenTUI's "block" default

Proposal

Expose the cursor style via config (e.g. opencode.json or the theme), so users can pick e.g. a thin/line cursor. Minimal change would be passing cursorStyle through to the input alongside cursorColor, e.g. input.cursorStyle = { style: "line", blinking: true }.

A possible config shape:

{
  "tui": {
    "cursorStyle": "line"   // "block" | "line" | "underline" | "default"
  }
}

Environment

  • opencode 1.17.4 (Homebrew, macOS arm64)
  • TUI via OpenTUI @opentui/core 0.3.4

Activity

  1. github-actions commented on Jun 13, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions