edwood: github.com/rjkroege/edwood/internal/dumpfile Index | Files

package dumpfile

import "github.com/rjkroege/edwood/internal/dumpfile"

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

Package Files

legacy_parse.go parse.go

type Column Uses

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 Uses

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 Uses

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

Load parses the dump file and returns its content.

func LoadLegacy Uses

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

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

func (*Content) Save Uses

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

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

type Text Uses

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 Uses

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 Uses

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
)

Package dumpfile imports 8 packages (graph) and is imported by 1 packages. Updated 2019-06-27. Refresh now. Tools for package owners.