Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Windows stty replacement

License

NotificationsYou must be signed in to change notification settings

aymanbagabas/wstty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusLatest Release

wstty is a small tool that sets or reports various console related settings onWindows systems. It is meant to be a replacement for thestty coreutilscommand on Unix systems.

Installation

Go Install

go install github.com/aymanbagabas/wstty@latest

Scoop (Windows)

scoop bucket add aymanbagabas https://github.com/aymanbagabas/scoop-bucket.gitscoop install aymanbagabas/wstty

Usage

wstty [-a][-][mode...]

To set a specific mode tooff, prefix the mode with a- sign. To set it toon, just specify the mode.

Use-a to displays all the current console modes,-h to display the help.

Input Modes

Input modes control how keyboard input is processed by the console.

ModeDescription
echoEnables echo input. Characters typed by the user are echoed to the console.
lineEnables line input mode. Input is not sent to the application until the Enter key is pressed.
iprocEnables processed input. Special key combinations like Ctrl+C are processed by the system.
minputEnables mouse input. Mouse events are reported to the application.
winputEnables window input. Window resize events are reported to the application.
iinsertEnables insert mode. Text is inserted at the cursor position rather than overwriting existing text.
iqeditEnables quick edit mode. Allows text selection with the mouse and clipboard operations.
ivtermEnables virtual terminal input processing. Supports ANSI/VT100 escape sequences for input.
iautoposEnables automatic cursor positioning. The cursor is automatically positioned after a write operation.
iextEnables extended flags. Required for some extended console features.

Output Modes

Output modes control how text and formatting are displayed on the console.

ModeDescription
oprocEnables processed output. Backspace, tab, bell, carriage return, and line feed characters are processed.
owrapEnables line wrapping. Text that extends beyond the right edge of the console window wraps to the next line.
ovtermEnables virtual terminal processing. Supports ANSI/VT100 escape sequences for text formatting and colors.
onewlineDisables automatic carriage return on line feed. Line feeds are not automatically preceded by carriage returns.
olvbEnables LVB grid worldwide. Supports line-drawing and box-drawing characters.

Special Commands

CommandDescription
rawSets the console to raw mode. Disables echo, line input, and processed input, while enabling virtual terminal input.
cookedSets the console to cooked mode. Enables echo, line input, and processed input, while disabling virtual terminal input.
saneResets the console to a reasonable default state.
cp <code>Sets both input and output code pages to the specified code.
icp <code>Sets the input code page to the specified code.
ocp <code>Sets the output code page to the specified code.
-aDisplays all current console modes and settings.
-v or-versionDisplays the version of wstty.
-h or-helpDisplays help information.

Examples

# Display all current console modeswstty -a# Enable virtual terminal processing for ANSI color supportwstty ovterm# Disable line input mode (useful for character-by-character input)wstty -line# Set raw mode (useful for applications like vim)wstty raw# Set cooked mode (standard terminal behavior)wstty cooked# Set UTF-8 code page (65001) for both input and outputwstty cp 65001# Enable virtual terminal processing and disable automatic line wrappingwstty ovterm -owrap

Technical Details

Input Mode Flags

These flags control how input is processed by the Windows console:

  • ENABLE_ECHO_INPUT (echo): When enabled, characters typed by the user are echoed to the console. When disabled, input characters are not displayed.
  • ENABLE_LINE_INPUT (line): When enabled, input is not sent to the application until the Enter key is pressed. When disabled, input is sent immediately after each keystroke.
  • ENABLE_PROCESSED_INPUT (iproc): When enabled, Ctrl+C is processed by the system and generates a SIGINT signal. When disabled, Ctrl+C is read as a regular character.
  • ENABLE_MOUSE_INPUT (minput): When enabled, mouse events are reported in the input buffer. When disabled, mouse events are ignored.
  • ENABLE_WINDOW_INPUT (winput): When enabled, window resize events are reported in the input buffer. When disabled, window resize events are ignored.
  • ENABLE_INSERT_MODE (iinsert): When enabled, text is inserted at the cursor position. When disabled, text overwrites existing characters.
  • ENABLE_QUICK_EDIT_MODE (iqedit): When enabled, the mouse can be used to select text and perform clipboard operations. When disabled, mouse input is sent to the application.
  • ENABLE_VIRTUAL_TERMINAL_INPUT (ivterm): When enabled, ANSI/VT100 escape sequences for input are supported. When disabled, these sequences are treated as regular characters.
  • ENABLE_AUTO_POSITION (iautopos): When enabled, the cursor is automatically positioned after a write operation. When disabled, the cursor position must be set explicitly.
  • ENABLE_EXTENDED_FLAGS (iext): When enabled, the console can use extended features. This flag is required for some extended console features.

Output Mode Flags

These flags control how output is processed by the Windows console:

  • ENABLE_PROCESSED_OUTPUT (oproc): When enabled, backspace, tab, bell, carriage return, and line feed characters are processed. When disabled, these characters are displayed as is.
  • ENABLE_WRAP_AT_EOL_OUTPUT (owrap): When enabled, text that extends beyond the right edge of the console window wraps to the next line. When disabled, text is truncated at the edge of the window.
  • ENABLE_VIRTUAL_TERMINAL_PROCESSING (ovterm): When enabled, ANSI/VT100 escape sequences for text formatting and colors are supported. When disabled, these sequences are displayed as is.
  • DISABLE_NEWLINE_AUTO_RETURN (onewline): When enabled, line feeds are not automatically preceded by carriage returns. When disabled, a carriage return is automatically inserted before each line feed.
  • ENABLE_LVB_GRID_WORLDWIDE (olvb): When enabled, line-drawing and box-drawing characters are supported. When disabled, these characters may not display correctly.

SeeConsole Modes for more information.

Notes

  • Some modes may not be available on all Windows versions.
  • Changing console modes affects the behavior of all applications using the console.
  • The-a option is useful for debugging console issues.
  • Thesane command is useful for resetting the console to a known good state.
  • Code page 65001 corresponds to UTF-8 encoding.
  • Common code pages include:
    • 437: US English
    • 850: Western European
    • 932: Japanese
    • 936: Simplified Chinese
    • 949: Korean
    • 950: Traditional Chinese
    • 1200: UTF-16LE
    • 1201: UTF-16BE
    • 65001: UTF-8

License

This project is licensed under the MIT License - see theLICENSE file


[8]ページ先頭

©2009-2025 Movatter.jp