contextwindow

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package contextwindow parses directional line and character window specifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Extract

func Extract(raw string, matchIndex []int, spec Spec) string

Extract returns the context selected by spec around matchIndex in raw.

Types

type Mode

type Mode int

Mode determines how a context window is interpreted.

const (
	ModeNone Mode = iota
	ModeCols
	ModeBox
)

type Spec

type Spec struct {
	Mode        Mode
	ColsBefore  int
	ColsAfter   int
	LinesBefore int
	LinesAfter  int
}

Spec describes directional context boundaries around a match.

func Parse

func Parse(value string) (Spec, error)

Parse parses the grammar shared by --match-context and component within fields.

func (Spec) IsZero

func (s Spec) IsZero() bool

IsZero reports whether no window is configured.

Jump to

Keyboard shortcuts

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