paste

package
v1.62.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

* ChatCLI - Paste Detection * cli/paste/detector.go * Copyright (c) 2024 Edilson Freitas * License: MIT

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BracketedPasteParser

type BracketedPasteParser struct {
	// contains filtered or unexported fields
}

BracketedPasteParser wraps a ConsoleParser to detect bracketed paste sequences. It implements go-prompt's ConsoleParser interface.

func NewBracketedPasteParser

func NewBracketedPasteParser(inner prompt.ConsoleParser, onPaste func(Info)) *BracketedPasteParser

NewBracketedPasteParser creates a new parser that wraps an existing ConsoleParser. The onPaste callback is invoked when a paste operation is detected.

func (*BracketedPasteParser) GetWinSize

func (p *BracketedPasteParser) GetWinSize() *prompt.WinSize

GetWinSize returns the terminal window size.

func (*BracketedPasteParser) Read

func (p *BracketedPasteParser) Read() ([]byte, error)

Read reads bytes from the inner parser and processes bracketed paste sequences.

func (*BracketedPasteParser) Setup

func (p *BracketedPasteParser) Setup() error

Setup initializes the parser and enables bracketed paste mode.

func (*BracketedPasteParser) TearDown

func (p *BracketedPasteParser) TearDown() error

TearDown disables bracketed paste mode and cleans up.

type Info

type Info struct {
	Content   string
	CharCount int
	LineCount int
}

Info holds metadata about a detected paste operation.

func DetectInLine

func DetectInLine(line string) (string, *Info)

DetectInLine strips bracketed paste markers from a line read via bufio and returns paste info if markers were found. This is used for agent mode where we read directly from stdin instead of go-prompt.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL