shithub: spread

ref: f5d1631b91dd7a70c50b84912411465ad94ff2e6
dir: /README/

View raw version
Spreadsheet Editor

This program builds around hoc(1).


# Spreadsheet files

They are divided into two blocks, separated by a line containing three `%`:

1. hoc script. Loaded verbatim to hoc. Use this to add functionality.
2. cells and cell contents.

A sample file could look like this:

	func t(a) {
		print a
	}
	%%%
	A1=3
	A2;hello
	A3=5
	A4=A1()+A3()

The general syntax of cells should be quite obvious, but it's worth noting
that cells divided by an `=` sign will end up being calculation functions,
while cells divided by a `;` sign are string literals. Both will end up
being hoc functions.

# Usage

	spread [-di] file

- `file` will be loaded as a spreadsheet
- `-d` enables extra debug output
- `-i` opens spread in CLI mode (see below)

# Modes

## GUI mode

### Keyboard control

- Use the arrow keys (←↑↓→) to scroll
- Use `q` or `DEL` to quit
- Every other key input [A-Za-z0-9] opens the command line

### Command line

- `w [file]` - save to file (without file: save to original file)
- `s addr` - open the edit dialog for cell addr (addr be like: B5)
- `gg` - go to A1
- `g addr` - go to addr. This scrolls so that addr is in the top left corner.

### Edit dialog

This is a simple text entry box for the specified cell.

- To enter a function, start the line with an `=` sign.
- To enter a string/text, don't start the line with an `=` sign.

Simple as that.

### TODO

- click to edit. Click on a cell to open the edit dialog.

## CLI mode

For now, this opens a direct channel to hoc. All commands entered will
be forwarded to the hoc process unchanged.

Example session for previous example program:

	A4()
	→ 8
	A1()
	→ 3
	A1()*A3()
	→ 15
	A1()+2*A3()
	→ 13

# Open questions

## Hoc limitations

- Range support. Since hoc doesn't support something like `eval`,
  it is impossible to support ranges (`A3()..A5()`) out of the box.
  If we need ranges we need to find a good solution or at least a
  solid workaround, like building a list dynamically.

## Bugs

Sure, there are many. Known issues are:

- Cyclic dependencies are not allowed, but also not really checked for!