Files
htab/USER_GUIDE.md
T

15 KiB

HTab User Guide

Welcome to HTab. This guide covers everyday spreadsheet tasks, formulas, dynamic spilling, file import/export, display scaling, and every built-in function.


1. Starting HTab

Launch HTab from a terminal or launcher:

htab [OPTIONS] [FILE]

Options:

  • -g WxH, --geometry WxH: Open with a specific initial window size, such as --geometry 960x640 or --geometry 240x296.
  • -h, --help: Print command-line help and exit.
  • FILE: Optional .htab (native multi-sheet JSON) or .csv file to load at startup.

Display Scaling & Compact Mode

HTab automatically reads your ANODE / X11 display theme and DPI settings (Xft.dpi, theme.scale, theme.baseFontSize, theme.touchMode, and live xrdb updates via SIGUSR1 or XA_RESOURCE_MANAGER).

  • Desktop Mode: Displays the full toolbar (Menu, Open, Save, CSV, Undo, Redo, Fmt, +Row, -Row, +Col, -Col), formula bar, grid with A.. columns and numbered rows, selection summary (N and Sum), and full sheet tab names with x close buttons.
  • Compact Mode: When the logical window size is <= 320px wide or <= 360px tall (including explicit --geometry 240x296), HTab switches automatically to a condensed layout:
    • Top bar shows Menu, < (Undo), > (Redo), Fmt, and filename.
    • Formula bar stays on a single line ([A1] [=formula]).
    • Sheet tabs abbreviate Sheet1 to S1 (showing x on the active tab when multiple sheets exist) alongside a compact horizontal scrollbar.

2. Navigating & Editing the Grid

Selecting & Moving

  • Click a cell to select it; click and drag (or hold Shift + Arrow keys) to select a rectangular range.
  • Arrow keys: Move one cell; the viewport scrolls automatically when moving near an edge.
  • Enter / Shift+Enter: Confirm an edit and move down / up.
  • Tab / Shift+Tab: Confirm an edit and move right / left.
  • PageUp / PageDown: Jump 10 rows up / down.
  • Home / Ctrl+Home: Jump to column A on the current row / jump to A1.
  • Go To Cell / Range: Click the active cell box (A1) in the formula bar, press Ctrl+G, or choose F10 -> Go To Cell... and enter a cell (C25), cross-sheet address (Sheet2!B4 or 'Sales Data'!A1), or range (A1:C10).
  • Mouse wheel: Scroll vertically over the grid, or horizontally over the horizontal scrollbar.

Entering & Formatting Data

  • Start editing: Begin typing immediately on any selected cell, press F2, double-click the cell, or click the formula bar input box.
  • Cancel editing: Press Esc to discard changes and restore the previous content.
  • Clear cells: Select one or more cells and press Delete or BackSpace, or right-click and choose Clear Cell(s).
  • Auto-detected types:
    • Leading = starts a formula (=SUM(A1:A5)).
    • Leading ' forces literal text (for example '00123 keeps leading zeros).
    • Numbers, percentages (25% -> 0.25 with percentage format), TRUE / FALSE, and error literals (#N/A, etc.) are typed automatically.
  • Number formatting: Select cells, click Fmt (or right-click -> Format Cell..., or F10 -> Format Cell...) and pick a preset:
    • General
    • Fixed (0.00)
    • Integer (#,##0)
    • Currency ($#,##0.00)
    • Percentage (0.00%)
    • Date (yyyy-mm-dd)
    • Time (hh:mm:ss)

Copy, Cut, Paste & Auto-Fill

  • Ctrl+C / Ctrl+X / Ctrl+V (or right-click Copy / Cut / Paste):
    • Within HTab, pasting a copied formula automatically shifts relative references (A1) while keeping $-locked anchors ($A1, A$1, $A$1) fixed.
    • Copies are also published to the X11 clipboard (CLIPBOARD and PRIMARY) as tab-separated values (TSV) so you can paste into or out of external applications.
  • Fill handle: Drag the small highlighted square at the bottom-right corner of the selection box down, up, left, or right:
    • Extending 2 or more plain numbers continues the linear trend (for example 10, 20 fills 30, 40, 50).
    • Extending formulas shifts relative cell references along the fill direction.

Resizing Columns & Rows

  • Move the pointer onto the divider line between column letters (or row numbers) and drag to resize. Resizing is saved in .htab files and supports Undo/Redo (Ctrl+Z / Ctrl+Y).

3. Rows, Columns, and Sheets

Inserting & Deleting Rows or Columns

  • Desktop toolbar: Click +Row, -Row, +Col, or -Col.
  • Right-click context menu:
    • Right-click any row number for Insert Row Above, Insert Row Below, Delete Row, Format Cell....
    • Right-click any column letter for Insert Column Left, Insert Column Right, Delete Column, Format Cell....
    • Right-click any data cell for quick Insert Row Above, Delete Row, Insert Column Left, Delete Column alongside clipboard/format actions.
  • Menu (F10): Choose Insert Row, Delete Row, Insert Column, or Delete Column.

When multiple rows or columns are selected, -Row / -Col (and context menu Delete Row / Delete Column) removes the entire selected span. All formulas across every sheet are updated automatically: ranges expand or shrink as needed, and formulas pointing directly to a deleted cell become #REF!. Press Ctrl+Z to undo any structural edit cleanly.

Managing Sheets

  • Add a sheet: Click + next to the sheet tabs, right-click any sheet tab -> Add Sheet, or open F10 -> Add Sheet.
  • Switch sheets: Click a sheet tab or press Ctrl+PageUp / Ctrl+PageDown.
  • Rename a sheet: Right-click a sheet tab -> Rename Sheet..., or F10 -> Rename Sheet....
  • Close / delete a sheet:
    • Click the x button on the sheet tab (available whenever there is more than one sheet; in Compact Mode, shown on the active tab).
    • Or middle-click a sheet tab.
    • Or right-click a sheet tab -> Close Sheet.
    • Or open F10 -> Delete Sheet.
    • Note: The last remaining sheet in a workbook cannot be deleted. Deleting a sheet can be undone with Ctrl+Z.

4. Writing Formulas

Cell & Range Addressing

  • Single cell: A1, Z10, AA1
  • Anchors: $A$1 (locked row & col), $A1 (locked col), A$1 (locked row)
  • Range: A1:C10
  • Cross-sheet reference: Sheet2!B2 or 'Sales Data'!A1:C10 (use single quotes around sheet names with spaces or punctuation; double any apostrophe inside a quoted sheet name as '')

Operator Precedence (Highest to Lowest)

  1. Reference operators: : (range), space (intersection, e.g. A1:C3 B2:D4), , (union inside parentheses, e.g. SUM((A1:A2, C1:C2)))
  2. Unary signs: -, + (right-to-left; =-2^2 evaluates to 4, whereas =0-2^2 evaluates to -4)
  3. Percent: % postfix (divides by 100, e.g. =50% -> 0.5)
  4. Exponentiation: ^ (left-associative; =2^3^2 evaluates to 64)
  5. Multiply / Divide: *, /
  6. Add / Subtract: +, -
  7. Text concatenation: & (e.g. ="Row " & 5 -> "Row 5")
  8. Comparisons: =, <>, <, >, <=, >= (text comparisons are case-insensitive)

Error Values

Error Meaning
#DIV/0! Division by zero or invalid domain such as ATAN2(0, 0)
#VALUE! Wrong argument type, mismatched array sizes, or formula syntax error
#NAME? Unknown function name or undefined identifier
#N/A Value not found (for example VLOOKUP, MATCH, or empty FILTER with no fallback)
#REF! Reference points to a deleted row, column, or sheet
#NUM! Invalid numeric domain or convergence failure (for example SQRT(-1))
#CYCLE! Circular formula dependency detected
#SPILL! Dynamic array result blocked by one or more non-empty cells

5. Dynamic Array Spilling (FILTER)

Formulas returning a 2D array (such as FILTER or array arithmetic like =A1:A3*2) automatically spill their values into adjacent empty cells below and to the right of the formula cell.

Example: filter rows in A2:C5 where column B is "East" and column C is at least 100:

=FILTER(A2:C5, (B2:B5="East")*(C2:C5>=100), "None")
  • If every cell in the destination rectangle is empty, HTab fills them automatically (shaded lightly to indicate spilled ownership). Downstream formulas such as =SUM(E1:E4) update whenever the spilled output changes.
  • If any destination cell already contains data, the formula cell displays #SPILL! without overwriting your existing cell. Once you clear the blocking cell, the array spills automatically.

6. Files, CSV, and Menus

Press F10 or click Menu (or use the desktop Open, Save, and CSV toolbar buttons) to access file and workbook commands:

  • New Workbook (Ctrl+N): Replace the current workbook with a fresh single-sheet workbook.
  • Open File... (Ctrl+O): Open GemUI's interactive file browser to load .htab / .json workbooks or .csv files (auto-detected by extension).
  • Save (.htab)... (Ctrl+S): Save directly if already working in a .htab / .json file, or open GemUI's Save browser to choose a folder and filename (auto-appending .htab if omitted).
  • Export CSV (Values)... (Ctrl+E): Export the active sheet to RFC 4180 CSV with evaluated values (including spilled cells) and formatted display strings.
  • Export CSV (Formulas)...: Export the active sheet to RFC 4180 CSV keeping raw =... formulas intact.
  • Go To Cell... (Ctrl+G): Open the address prompt to jump directly to a cell, range, or worksheet target.
  • Keyboard Hints (F1): Display the built-in scrollable shortcut reference overlay.
  • Quit (Ctrl+Q, F10 -> Quit, or closing the window): Exits immediately when saved, or prompts to Save, Discard, or Cancel if there are unsaved changes.

Using the File Open / Save Browser

  • Navigate folders: Click Up (Alt+Up), ~ (Alt+Home), or double-click a directory row (such as ..). You can also use Up / Down / PageUp / PageDown and press Enter.
  • Filters & hidden files: Click .* (or press Ctrl+H) to show or hide dotfiles; click the extension filter badge (e.g., .htab,.csv,.json) to switch between matching files and all files (All (*)).
  • Path & overwrite safety: Type a filename (with ~/ expansion and Ctrl+V clipboard paste) or click a file in the list. In Save/Export mode, saving over an existing file prompts for Overwrite / Back confirmation before modifying the file.

7. Keyboard Shortcuts Reference

Shortcut Context Action
F1 Grid / Edit Show or hide Keyboard Hints
Arrow keys Grid Move active cell
Shift + Arrows Grid Extend cell selection
Enter / Shift+Enter Grid / Edit Move down / up (commits active edit)
Tab / Shift+Tab Grid / Edit Move right / left (commits active edit)
PageUp / PageDown Grid Move 10 rows up / down
Home / Ctrl+Home Grid Jump to column A / jump to A1
Ctrl+G Grid / Edit Go to cell or range (also click active cell box)
F2 Grid Edit active cell in place
Esc Edit / Modal Cancel edit or close active menu/dialog
Delete / BackSpace Grid Clear selected cells
Ctrl+C / Ctrl+X / Ctrl+V Grid Copy / Cut / Paste (with relative reference translation)
Ctrl+Z / Ctrl+Y Grid Undo / Redo
Ctrl+N / Ctrl+O / Ctrl+S Grid New / Open / Save .htab
Ctrl+E Grid Export active sheet to CSV (Values)
Ctrl+Q Grid / Edit Quit HTab (prompts to save if unsaved)
Ctrl+PageUp / Ctrl+PageDown Grid Switch to previous / next sheet
F10 Grid Open main Menu

8. Complete Function Reference (100 Functions)

Optional parameters are shown in [brackets]; ... indicates repeatable arguments.

Math & Trig (27)

ABS(number), ACOS(number), ASIN(number), ATAN(number), ATAN2(x_num, y_num), COS(number), DEGREES(angle), EXP(number), FACT(number), INT(number), LN(number), LOG(number, [base]), LOG10(number), MOD(number, divisor), PI(), POWER(number, power), PRODUCT(number1, [number2, ...]), RADIANS(angle), RAND(), ROUND(number, num_digits), SIN(number), SQRT(number), SUM(number1, [number2, ...]), SUMIF(range, criteria, [sum_range]), SUMIFS(sum_range, criteria_range1, criteria1, [criteria_range2, criteria2, ...]), TAN(number), TRUNC(number, [num_digits])

Logical (6)

AND(logical1, [logical2, ...]), FALSE(), IF(logical_test, value_if_true, [value_if_false]), NOT(logical), OR(logical1, [logical2, ...]), TRUE()

Statistical (12)

AVERAGE(number1, [number2, ...]), COUNT(value1, [value2, ...]), COUNTA(value1, [value2, ...]), COUNTBLANK(range), COUNTIF(range, criteria), COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2, ...]), MAX(number1, [number2, ...]), MIN(number1, [number2, ...]), STDEV(number1, [number2, ...]), STDEVP(number1, [number2, ...]), VAR(number1, [number2, ...]), VARP(number1, [number2, ...])

Wildcards * (any characters), ? (single character), and ~*/~?/~~ (escaped literals), along with operators =, <>, <, <=, >, >=, work across SUMIF, SUMIFS, COUNTIF, COUNTIFS, and Database criteria.

Lookup & Reference (8)

CHOOSE(index_num, value1, [value2, ...]), COLUMNS(array), FILTER(array, include, [if_empty]), HLOOKUP(lookup_value, table_array, row_index_num, [range_lookup]), INDEX(array, row_num, [column_num]), MATCH(lookup_value, lookup_array, [match_type]), ROWS(array), VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])

Text (14)

EXACT(text1, text2), FIND(find_text, within_text, [start_num]), LEFT(text, [num_chars]), LEN(text), LOWER(text), MID(text, start_num, num_chars), PROPER(text), REPLACE(old_text, start_num, num_chars, new_text), REPT(text, number_times), RIGHT(text, [num_chars]), SUBSTITUTE(text, old_text, new_text, [instance_num]), T(value), TRIM(text), UPPER(text)

Date & Time (11)

Dates and times are stored as serial day numbers (integer day + fractional time of day): DATE(year, month, day), DATEVALUE(date_text), DAY(serial_number), HOUR(serial_number), MINUTE(serial_number), MONTH(serial_number), NOW(), SECOND(serial_number), TIME(hour, minute, second), TIMEVALUE(time_text), YEAR(serial_number)

Financial (10)

DDB(cost, salvage, life, period, [factor]), FV(rate, nper, pmt, [pv], [type]), IRR(values, [guess]), NPER(rate, pmt, pv, [fv], [type]), NPV(rate, value1, [value2, ...]), PMT(rate, nper, pv, [fv], [type]), PV(rate, nper, pmt, [fv], [type]), RATE(nper, pmt, pv, [fv], [type], [guess]), SLN(cost, salvage, life), SYD(cost, salvage, life, per)

Database (12)

All database functions share the signature (database, field, criteria), where database includes header labels in its top row, field is either a column header name or a 1-based column index, and criteria is a header-matched criteria table where cells on the same row are ANDed and separate rows are ORed:

DAVERAGE, DCOUNT, DCOUNTA, DGET, DMAX, DMIN, DPRODUCT, DSTDEV, DSTDEVP, DSUM, DVAR, DVARP

Example criteria range E1:F3 ((Tree="Apple" AND Height>10) OR Tree="Cherry"):

E1: Tree     | F1: Height
E2: Apple    | F2: >10
E3: Cherry   | F3:

DSUM(A1:C6, "Yield", E1:F3) sums the Yield column across all matching rows.