Skip to content

Scratchpad v2.2.0 — Number Formatting

Choose a tag to compare

@CaseyMargell CaseyMargell released this 26 Apr 20:56
· 2 commits to main since this release

Number formatting (currency, percent, thousands), test suite, and a regression fix for formula range selection.

What's new

Number formatting

Cells can now be formatted as currency, percent, or thousands-separated numbers, with adjustable decimal precision (0–6).

  • Currency: $1,234.56 (default 2 decimals; -$100.00 for negatives)
  • Percent: value × 100 + % — so 0.45 shows as 45% (default 0 decimals)
  • Number: 1,234,567.89 with thousands separator
  • Decimals: bump up/down per cell

Formats persist across content edits (you can format an empty cell first), survive undo/redo, and round-trip through .xlsx save/load and clipboard copy/paste.

Three ways to apply formats

  1. Keyboard shortcuts (Excel-compatible):
    • Ctrl+Shift+$ → Currency
    • Ctrl+Shift+% → Percent
    • Ctrl+Shift+! → Number with thousands
    • Ctrl+Shift+~ → Clear format
    • Ctrl+. / Ctrl+, → More / fewer decimals
  2. Right-click menu on any cell — full format options with shortcut hints and check marks for the active style
  3. Format popover — new # icon in the toolbar opens a small popover with $, %, 1234, decimals −/+, and Clear format

Toolbar reshuffle

The Clear icon moved into Settings → "Reset cells / Clear all cells" (it's rare and destructive — fine one click deeper). The newly freed slot now holds the Format icon. Net icon count unchanged at 4 (Save, Open, Format, Settings).

Bug fixes

  • Formula range selection via mouse drag — clicking a cell while typing a formula was committing the edit before extending the formula, so you couldn't drag-select ranges into =SUM(. Reordered the click handler so formula-mode wins.

Behind the scenes

  • Added an xUnit test project (app.tests/) with 75 tests covering FormulaEvaluator (arithmetic, functions, ref extraction, ref adjustment), GridData (dependency graph, snapshot/restore, format persistence), and CellFormatter (all format styles edge cases).
  • Tests run automatically on every solution build via an MSBuild AfterTargets target — regressions fail the build.
  • Several existing tests are explicitly tagged as regression coverage for prior fixed bugs (copy/paste formula adjustment, format persistence across content clear, legacy snapshot compatibility, formula-change drops old dependencies).

Installation

Download Scratchpad.exe below and run it. Windows SmartScreen will warn once on the unsigned exe: More info → Run anyway. Self-contained single-file, no installer needed. Drop it on top of your existing Scratchpad.exe if you're upgrading from an earlier version — your config (hotkey, window bounds, theme, grid size) and saved cell data carry forward.