Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Command Input

The command input widget provides the text entry field for sending commands to the game.

Overview

The command input:

  • Accepts keyboard input for game commands
  • Maintains command history
  • Supports editing operations (cut, copy, paste)
  • Can display a custom prompt

Configuration

[[windows]]
name = "input"
type = "command_input"

# Position and size
row = 38
col = 0
width = 120
height = 2

# Input-specific options
prompt = "> "             # Input prompt
history = true            # Enable command history
history_size = 1000       # Commands to remember

# Visual options
show_border = true
border_style = "rounded"
background_color = "#0A0A0A"
text_color = "#FFFFFF"
cursor_color = "#FFFFFF"

Properties

prompt

The prompt displayed before input:

prompt = "> "         # Default
prompt = ">> "        # Double arrow
prompt = "[cmd] "     # Custom label
prompt = ""           # No prompt

history

Enable command history:

history = true        # Enable (default)
history = false       # Disable

history_size

Number of commands to remember:

history_size = 1000   # Default
history_size = 100    # Smaller history
history_size = 5000   # Large history

Input Operations

Basic Input

KeyAction
EnterSend command
EscapeClear input
Any textInsert at cursor

Cursor Movement

KeyAction
LeftMove cursor left
RightMove cursor right
HomeMove to start
EndMove to end
Ctrl+LeftPrevious word
Ctrl+RightNext word

Editing

KeyAction
BackspaceDelete before cursor
DeleteDelete at cursor
Ctrl+BackspaceDelete word before
Ctrl+DeleteDelete word after
Ctrl+UClear line
Ctrl+KDelete to end

Clipboard

KeyAction
Ctrl+CCopy selection
Ctrl+XCut selection
Ctrl+VPaste
Ctrl+ASelect all

History

KeyAction
UpPrevious command
DownNext command
Ctrl+RSearch history (if supported)

Display

Single Line

> look

Standard single-line input.

Multi-Line

[[windows]]
name = "input"
type = "command_input"
height = 3    # Multiple lines visible

Shows more context:

┌─ Input ────────────────────────────┐
│ > look                             │
│                                    │
└────────────────────────────────────┘

No Border

[[windows]]
name = "input"
type = "command_input"
show_border = false
show_title = false
height = 1

Minimal footprint:

> look█

Examples

Standard Input

[[windows]]
name = "input"
type = "command_input"
row = 38
col = 0
width = 120
height = 2
prompt = "> "
history = true
show_border = true
border_style = "rounded"
title = "Command"

Full-Width Minimal

[[windows]]
name = "input"
type = "command_input"
row = 39
col = 0
width = "100%"
height = 1
show_border = false
background_color = "#0A0A0A"

Centered Input

[[windows]]
name = "input"
type = "command_input"
row = 38
col = 20
width = 80
height = 2
prompt = ">> "
border_style = "double"

Command Processing

Command Flow

  1. User types command
  2. User presses Enter
  3. Command added to history
  4. Command sent to game server
  5. Input cleared for next command

Special Commands

Two-Face intercepts some commands:

CommandAction
;commandClient command (not sent to game)
/quitExit Two-Face
/reloadReload configuration

History Features

  • Up cycles through older commands
  • Down cycles through newer commands
  • Current input is preserved when browsing

Persistence

Command history is saved between sessions in:

~/.two-face/history

Duplicate Handling

Consecutive duplicate commands are not added to history.

Focus Behavior

The command input:

  • Automatically receives focus on startup
  • Maintains focus during normal gameplay
  • Returns focus when popups close
  • Can be focused with Ctrl+I or clicking

Troubleshooting

Commands not sending

  1. Check input has focus (cursor visible)
  2. Verify connection is active
  3. Check for keybind conflicts with Enter

History not working

  1. Verify history = true
  2. Check history_size > 0
  3. Check file permissions on history file

Cursor not visible

  1. Check cursor_color is visible
  2. Verify widget has focus
  3. Check width is sufficient

See Also