dumpfile

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: BSD-3-Clause, MIT Imports: 8 Imported by: 1

Documentation

Overview

Package dumpfile implements encoding and decoding of Edwood dump file.

A dump file stores the state of Edwood so that it can be restored when Edwood is restarted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Position float64 // Position within the row (in percentage)
	Tag      Text    // Tag above the column (usually "New ... Delcol")
}

Column stores the state of a column in Edwood.

type Content

type Content struct {
	CurrentDir string    // Edwood's current working directory
	VarFont    string    // Variable width font
	FixedFont  string    // Fixed width font
	RowTag     Text      // Top-most tag (usually "Newcol ... Exit")
	Columns    []Column  // List of columns
	Windows    []*Window // List of windows across all columns
}

Content stores the state of Edwood.

func Load

func Load(file string) (*Content, error)

Load parses the dump file and returns its content.

func LoadLegacy

func LoadLegacy(file, home string) (*Content, error)

TODO(rjk): split this apart into smaller functions and files.

func (*Content) Save

func (c *Content) Save(file string) error

Save encodes the dump file content and writes it to file.

type Text

type Text struct {
	Buffer string `json:",omitempty"` // UTF-8 encoded text
	Q0     int    // Selection starts at this rune position
	Q1     int    // Selection ends before this rune position
}

Text is a UTF-8 encoded text with a substring selected using rune-indexing (instead of byte-indexing).

type Window

type Window struct {
	Type WindowType // Type of window

	Column   int     // Column index where the window will be placed
	Position float64 // Position within the column (in percentage)
	Font     string  `json:",omitempty"` // Font name or path

	Tag Text // Tag above this window (usually "/path/to/file Del ...")

	// Text buffer and selection of body.
	// Body.Buffer is empty if Type == Unsaved.
	Body Text

	// Used for Type == Exec
	ExecDir     string `json:",omitempty"` // Execute command in this directory
	ExecCommand string `json:",omitempty"` // Command to execute
}

Window stores the state of a window in Edwood.

type WindowType

type WindowType int

WindowType defines the type of window.

const (
	Saved   WindowType = iota // Saved is a File and directory stored on disk
	Unsaved                   // Unsaved contains buffer that's not stored on disk
	Zerox                     // Zerox is a copy of a Saved or Unsaved window
	Exec                      // Exec is a window controlled by an outside process
)

Jump to

Keyboard shortcuts

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