Majo.LineEditing 0.0.4

dotnet add package Majo.LineEditing --version 0.0.4
                    
NuGet\Install-Package Majo.LineEditing -Version 0.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Majo.LineEditing" Version="0.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Majo.LineEditing" Version="0.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Majo.LineEditing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Majo.LineEditing --version 0.0.4
                    
#r "nuget: Majo.LineEditing, 0.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Majo.LineEditing@0.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Majo.LineEditing&version=0.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Majo.LineEditing&version=0.0.4
                    
Install as a Cake Tool

Majo.LineEditing

A small, cross-platform interactive line editor for .NET.

Majo.LineEditing provides interactive line editing for console applications with a managed Win32 backend on Windows and a native linenoise-based backend on Linux.

Installation

dotnet add package Majo.LineEditing

The package targets:

  • .NET 8
  • .NET 10

Supported runtime environments currently include:

  • Windows
  • Linux x64

The Linux native runtime is included in the package, so normal .NET builds and publishes do not require GCC or CMake.

Features

  • Single-line editing with a horizontal viewport
  • Wrapped multi-line editing
  • Command history with configurable capacity
  • Unicode-aware cursor movement and display-width handling
  • Home / End / Left / Right navigation
  • Backspace and Delete editing
  • Up / Down history navigation
  • Ctrl+C interruption handling
  • Ctrl+D end-of-input semantics
  • Terminal resize handling
  • Asynchronous reads with cancellation
  • WriteAbove(...) for background output without losing the active input line

Quick Start

using Majo.LineEditing;

using var editor = new LineEditor(new LineEditorOption
{
    Prompt = "> ",
    CommandBufferSize = 4096,
    HistoryCount = 100,
    PollInterval = 20,
    MultiLine = false
});

ReadResult result = await editor.ReadLineAsync();

ReadLineAsync() returns a ReadResult whose status distinguishes normal acceptance, interruption, and end-of-input.

Background output can be written while an edit is in progress:

editor.WriteAbove("[background] Connection established.");

WriteAbove(...) preserves the current edit state and redraws or relocates the active input as required by the current backend.

Configuration

LineEditorOption controls the editor behavior:

Option Description
Prompt Prompt displayed before the editable line.
CommandBufferSize Maximum command size in UTF-8 bytes.
HistoryCount Number of accepted non-empty commands retained in memory. 0 disables history.
PollInterval Polling interval used while waiting for console input and cancellation/resize work.
MultiLine false uses a single-line horizontal viewport; true enables wrapped multi-row editing.

History belongs to the LineEditor instance and is kept in memory for that instance's lifetime.

Read Semantics

Status Meaning
Accepted The user pressed Enter and submitted the current line.
Interrupted The user pressed Ctrl+C.
EndOfInput The user requested end-of-input, such as Ctrl+D on an empty line.

When Ctrl+D is pressed while the line is not empty, it behaves as forward-delete rather than immediately ending input.

Only one read operation may be active for an editor at a time.

Interactive Console Requirement

Majo.LineEditing is intended for a real interactive console/TTY.

Redirected standard input or output is not a supported editing environment. The editor also enforces a single active line-editor instance for the process so the backends do not compete for ownership of the terminal state.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Majo.LineEditing:

Package Downloads
Majo.TerminalUI

A small terminal interaction layer for .NET console applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.4 152 10/4/2026
0.0.3 169 9/30/2026

Clear the active input when a line read is interrupted with Ctrl+C