TUI Reference Guide

October 10, 2025 · View on GitHub

GhostScope's TUI interface consists of three panels with distinct functionality. This guide focuses on keyboard shortcuts and panel operations.

Quick Reference

  • Global Shortcuts: Work across all panels
  • Panel 1: Source Code Panel - Navigate and set trace points
  • Panel 2: eBPF Output Panel - View real-time trace output
  • Panel 3: Command Interaction Panel - Execute commands and edit scripts

Global Shortcuts

Important: These shortcuts only work when the Command Interaction Panel is focused and in Command Mode (not Input Mode or Script Mode).

ShortcutFunctionDescription
TabSwitch PanelCycle forward: Source → eBPF → Command
Shift+TabReverse SwitchCycle backward through panels
Ctrl+W + h/j/k/lVim NavigationJump to left/down/up/right panel
Ctrl+W + z or F1Toggle FullscreenFullscreen current panel or restore
Ctrl+W + v or F2Toggle LayoutSwitch panel layout arrangement
Ctrl+C (twice)QuitPress twice to exit GhostScope

Ctrl+C Behavior

  • First Press:
    • Script Mode: Cancel script editing
    • Other modes: Show "Press Ctrl+C again to exit"
  • Second Press: Exit program

Window Navigation Mode

Press Ctrl+W, then:

  • h: Jump to left panel
  • j: Jump to bottom panel
  • k: Jump to top panel
  • l: Jump to right panel
  • v: Toggle layout
  • z: Toggle fullscreen

Panel 1: Source Code Panel

Displays source code with trace point management. Operates in three modes: Normal, Text Search, and File Search.

Mode: Normal

Basic Navigation

ShortcutFunction
h/j/k/lVim navigation (left/down/up/right)
↑/↓/←/→Arrow key navigation
Ctrl+UScroll up 10 lines (half page)
Ctrl+DScroll down 10 lines (half page)
PgUp/PgDnFull page scroll
ggJump to file start
GJump to file end
[number]GJump to specific line (enter number then G)

Vim-style Word Movement

ShortcutFunction
wNext word beginning
bPrevious word beginning
^Line start (first non-blank character)
$Line end

Mode Switching

ShortcutFunction
/Enter Text Search mode
oEnter File Search mode
SpaceSet trace point at current line → Enter Script Mode

Search for text within the current file.

ShortcutFunction
[char]Type to build search query
nNext search match
NPrevious search match
Esc or Ctrl+CExit to Normal mode

Search and quickly switch between source files. File list comes from all source files in DWARF debug information.

Search & Filtering

ShortcutFunction
[char]Type to filter file list (real-time filtering)
BackspaceDelete character from search query
Ctrl+UClear entire search query
Ctrl+WDelete previous word

Notes:

  • Substring matching: Type any part to match (e.g., nginx matches /path/to/nginx.c)
  • Path search: Search in paths (e.g., core/nginx matches src/core/nginx.c)
  • Real-time filtering: File list updates as you type
  • Shows up to 10 matching results
ShortcutFunction
or Ctrl+NSelect next file
or Ctrl+PSelect previous file
EnterOpen selected file
Esc or Ctrl+CCancel and return to Normal mode

Cursor Control

ShortcutFunction
Ctrl+AMove cursor to beginning of search input
Ctrl+EMove cursor to end of search input
Ctrl+B or Move cursor left one character
Ctrl+F or Move cursor right one character

Tips:

  • File list shares cache with command panel's file completion, automatically updates when srcpath mappings change
  • If file paths cannot be found, use srcpath map command to configure path mappings (see input-commands.md)

Panel 2: eBPF Output Panel

Displays real-time trace events as cards. Two display modes: Auto-Refresh (default) and Scroll (manual navigation).

Carded Output and Expanded View

  • Each event renders as a card with header and body.
  • In list view, each card shows up to 3 wrapped lines; if truncated, a bold yellow appears at the end of line 3.
  • Press Enter to expand the selected card. In expanded view: j/k/↑/↓ scroll, Ctrl+U/D half-page, PgUp/PgDn page, Esc or Ctrl+C to close.

Basic Navigation

ShortcutFunction
j or Scroll down (enters Scroll mode)
k or Scroll up (enters Scroll mode)
h or Scroll left
l or Scroll right
Ctrl+DHalf page down
Ctrl+UHalf page up
PgUp/PgDnFull page scroll
g or ggJump to oldest trace (top)
GJump to latest trace (bottom, returns to Auto-Refresh mode)
[number]GJump to specific line (enter number then G)

Display Modes

  • Auto-Refresh Mode (default): Automatically shows latest traces, auto-scrolls
  • Scroll Mode: Enter by pressing j, k, or other navigation keys; allows manual browsing of trace history

Panel 3: Command Interaction Panel

Supports three interaction modes: Input Mode, Command Mode, and Script Mode.

Mode Overview

ModePurposeEntryExit
Input ModeExecute commandsi (from Command Mode)Esc or jk
Command ModeBrowse command historyEsc or jk (from Input Mode)i
Script ModeEdit trace scriptsAfter trace commandCtrl+S (submit) or Ctrl+C (cancel)

Mode: Input Mode

Execute commands and use command completion. See Input Mode Commands for detailed command reference.

Input & Editing

ShortcutFunction
[char]Type characters
Backspace or Ctrl+HDelete character before cursor
Ctrl+WDelete previous word
Ctrl+UDelete to line start
Ctrl+KDelete to line end
EnterExecute command

Cursor Movement

ShortcutFunction
or Ctrl+BMove cursor left
or Ctrl+FMove cursor right
Ctrl+AMove to line start
Ctrl+EMove to line end

Command Completion & Suggestions

ShortcutFunction
TabAuto-complete command or filename
or Ctrl+EAccept auto-suggestion (gray text)

History Navigation

ShortcutFunction
or Ctrl+PPrevious command
or Ctrl+NNext command
Ctrl+RStart history search mode

History Search Sub-mode

After pressing Ctrl+R:

ShortcutFunction
[char]Type to search history
BackspaceDelete character from search query
Ctrl+RNext matching command
EnterExecute matched command
EscUse matched command as input (exit search)
Ctrl+CCancel and clear input

Mode Switching

ShortcutFunction
Esc or jkEnter Command Mode (jk must be pressed within 150ms)

Mode: Command Mode

Browse and navigate command history with Vim-style navigation.

ShortcutFunction
h/j/k/lNavigate left/down/up/right through history
Ctrl+UHalf page up
Ctrl+DHalf page down
g or ggJump to top of history
GJump to bottom of history

Mode Switching

ShortcutFunction
iReturn to Input Mode

Mode: Script Mode

Edit trace scripts with syntax highlighting after executing trace command.

Features:

  • Real-time syntax highlighting for GhostScope script language
  • Line numbers with current line emphasis
  • Multi-line editing support
  • Automatic script caching per target (restored on re-entry)

Text Editing

ShortcutFunction
[char]Type characters
Backspace or Ctrl+HDelete character before cursor
Ctrl+WDelete previous word
Ctrl+UDelete to line start
Ctrl+KDelete to line end
EnterInsert new line
TabInsert 4 spaces (indent)

Cursor Movement

ShortcutFunction
or Ctrl+BMove cursor left
or Ctrl+FMove cursor right
or Ctrl+PMove to previous line
or Ctrl+NMove to next line
Ctrl+AMove to line start
Ctrl+EMove to line end

Script Control

ShortcutFunction
Ctrl+SSubmit script (compile and load)
Ctrl+C or EscCancel script edit and return to Input Mode

Tips

  1. Quick Tracing: Press Space in Source Panel for fastest trace point setup
  2. Vim Navigation: Master h/j/k/l keys for efficient navigation
  3. Command Completion: Use Tab frequently to reduce typing
  4. History Search: Press Ctrl+R in Input Mode for reverse history search
  5. Fullscreen Focus: Use Ctrl+W z when you need to concentrate on one panel