Skip to content

About

A very fast Text Editor

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

418 Commits

Folders and files

Repository files navigation

Scratchpad

Scratchpad is a local-first plain-text workspace for Windows and Linux. It is built for notes, logs, reports, terminal output, encoded files, and temporary text work that needs more structure and recovery than a basic editor provides.

Scratchpad is intentionally not an IDE: there are no language servers, plugin runtime, project index, or cloud account. The focus is fast text editing, resilient session restore, explicit file-format handling, and flexible multi-file workspaces.

How Fast Is Scratchpad?

The archived baseline below reported seven passing performance promises on a 16-thread AMD Ryzen 7 PRO 8840HS. These are historical measurements, not current compliance guarantees: fresh session-migration runs identify existing failures and coverage risks. Timings are not cross-platform guarantees.

Promise Result Measured workload
Large Files Pass 1 GiB first-visible prefix in 0.57 ms; background indexing in 1.69 s
Many Files Pass 10,000-file first-visible load in 64.6 ms; background completion in 697 ms
Search Pass 1 GiB prepared search in about 160 ms; 10,000 targets in about 2.4 ms
Many Tabs Pass 10,000-tab reorder in about 0.18 ms; prepared capacity cycle in about 14 ms
Many Views Pass 1,000-view prepared operation in under 0.1 ms
Large Text Mutation Pass 128 MiB paste in about 136 ms
Session Persistence & Restore Pass 10,000-tab startup-visible restore in 14.9 ms; steady-state persistence in 66.8 ms

See the performance baseline for methodology, budgets, and additional results.

Highlights

  • Workspace tabs containing one editor or a tiled set of file views.
  • Multiple views of the same document, directional splits, resizing, tile movement, promotion, tab combining, and tab overflow.
  • Search and replace across a selection, file, workspace, or every open tab, with plain text, regular expressions, case, and whole-word modes.
  • Encoding and BOM detection, mixed newline awareness, save compatibility checks, and external-file conflict handling.
  • Visibility for control characters, ANSI escapes, carriage-return output, and other text artifacts.
  • Per-document undo/redo, preserved edit branches, and a visible Now in History.
  • Session recovery for open files, unsaved text, workspace layouts, settings, and file metadata.
  • Platform profiles for Windows, generic Linux desktops, and Hyprland.
  • Single-instance forwarding: later launches activate the existing window and send their incoming files to it.

See the user manual for workflows and shortcuts.

Pane zoom

Each editor pane has independent zoom, from 25% to 400%. Ctrl + + / − adjusts it in 10-percentage-point steps; Ctrl + 0 resets to 100% of the configured editor font size. Ctrl + 9 toggles line numbers. Mouse-wheel zoom affects the pane under the pointer; keyboard zoom affects the active pane.

The status bar shows the active pane's percentage without any click action. The editor context menu has one Zoom · 100% [−] [+] [↺] row and stays open while adjusting. New splits inherit their source pane's zoom and then zoom independently; new tabs start at 100%. Pane zoom is preserved in sessions and closed-tab recovery. Changing the font size in Settings changes the baseline, not the pane percentages.

Platforms

Scratchpad supports:

  • Windows, including the MSI packaging flow and app-rendered window chrome.
  • Linux under Wayland or X11, with native desktop integration.
  • NixOS/Home Manager and a Hyprland profile that leaves global window management to the compositor.

Windows and Linux release artifacts are built from the same application. The Hyprland launcher selects Wayland and the Hyprland platform profile; it is not a separate editor.

Run and Develop

The repository pins Rust 1.95 in rust-toolchain.toml. A Nix development shell is also provided.

cargo run --release
cargo test --all-features
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt --all -- --check

On NixOS/Linux:

nix develop
nix run .#scratchpad
nix run .#scratchpad-hyprland

Scratchpad uses eframe's WGPU renderer by default. The local eframe patch prevents Wayland busy-polling while waiting for compositor redraw callbacks. On Linux, set SCRATCHPAD_RENDERER=glow to use the fallback OpenGL renderer; its presentation path remains nonblocking and compositor-paced. See the WGPU recovery investigation and Wayland startup validation for the fixes and native probe.

The host's Rust storage daemon manages development cache cleanup. Use shelllist storage to inspect usage and clean eligible caches. Development-shell entry does not trim caches.

UI inspection support is optional:

cargo run --features inspection
EGUI_INSPECTION=1 cargo run --features inspection

Command Line

Scratchpad accepts file paths and Windows-style startup switches on both supported platforms:

scratchpad [switches] [files...]

/clean                 skip session restore
/here                  open incoming files in the active workspace
/addto:active          add files to the active workspace
/addto:index:N         add files to restored workspace N (1-based)
/files:"a","b"         pass a comma-delimited file list
/help, /?              show help
/version               show the version

A second invocation forwards files and workspace targets to the running instance. An invocation without files activates its window. Close the running instance before using /clean.

Configuration

Settings are available in the app with Ctrl + , and are stored as TOML:

Platform Settings Session state and diagnostics
Windows %APPDATA%\Scratchpad\settings.toml %LOCALAPPDATA%\Scratchpad
Linux $XDG_CONFIG_HOME/scratchpad/settings.toml or ~/.config/scratchpad/settings.toml $XDG_STATE_HOME/scratchpad or ~/.local/state/scratchpad

Sessions use a local embedded Turso session.db; settings remain TOML and user files keep their existing save paths. If a session cannot be opened, including an older or newer incompatible format, the [] status panel shows the full error and offers Start new session. After warning you, this action moves the old database to a temporary backup and creates a fresh session at the usual location. The backup path remains visible in Status; temporary-file cleanup may delete it. Saved text files and settings are preserved. See history storage.

Closing during startup restore leaves the previous session intact. If startup restore fails, session saving stays paused until you start a new session. If you choose not to, save new edits to files before closing. A protected/unavailable session store does not prevent exit. Retryable save errors still keep the window open, without retrying automatic last-tab shutdown every frame.

Scrubber appears when you undo or redo (Ctrl+Z / Ctrl+Y) and follows your position through the active file's retained edits. It stays visible until you resume editing or press Escape. Switch freely between the shortcuts and dragging the timeline to update the file live, with a subtle highlight on each change; Left/Right and Home/End navigate while the scrubber has focus. History… (Ctrl+H) shows each file's edit tree, with a visible Now at the selected state. Click an edit to select the text after it; hovering does not change text. Escape or clicking outside keeps the selected state. Undo moves to the parent; redo follows the selected branch. Editing after undo keeps the old branch available in History.

The scrubber shows one selected file and branch, with start/end and previous/next buttons alongside the live track. Open in History shows the full tree. History offers This file for branch inspection and a searchable, newest-first Timeline across open and retained closed documents. Timeline includes grouped edits, Created, Opened, Closed, missing-file and disk-conflict observations. Only edit rows select a text state; other rows are informational. Selecting a closed file's edit opens that document alone, then selects the retained state without saving it to disk. Use This file on an edit to inspect its branches.

Each file has its own Now. Undo, redo, saves and file switches add no activity. Timeline uses recording order, local dates and times, and a closed-file marker. Up/Down, Home/End and Enter navigate loaded edit rows, skipping informational rows; scrolling fetches older pages. Latest returns to the top without changing text.

All branches and activity survive closing and restarting. Close without saving retains unsaved text in history. Reopening unchanged disk text restores that local work; changed disk text becomes one External changes loaded edit with the previous state reachable. Dirty files changed while open or before restart keep local text and their path, show Disk conflict, and offer the usual save choices. Metadata-only touches add no activity. Missing files are recorded once and checked again when they return. Same-size changes with an identical modified time are not detected by the metadata watcher.

Forget history requires confirmation and removes that file's branches and activity, establishing a baseline from current text. It does not save the file. Settings > History & Recovery contains memory limits and measured disk usage. See history storage and schema changes.

Start with the configuration guide. It documents the TOML sections, shortcut syntax, platform overrides, runtime environment variables, and Home Manager integration. A complete example is available at examples/settings.toml. Saved settings.toml files list every configurable shortcut under [shortcuts]: existing overrides remain active, and platform defaults are commented out for easy customization. Fixed editor, search, and history shortcuts follow as a reference.

For compositor setup, see the NixOS/Hyprland notes.

Build and Package

cargo build --release --locked
./scripts/package-linux-release.sh 0.4.2
nix build .#scratchpad
nix build .#scratchpad-hyprland

Windows installer packaging:

dotnet tool restore
cargo build --release --locked
.\scripts\package-windows-installer.ps1 -Version 0.4.2

Release tags use vX.Y.Z and must match the package versions in Cargo.toml and flake.nix.

The flake exports homeManagerModules.default. A minimal setup is:

programs.scratchpad = {
  enable = true;
  profile = "auto";
};

Set profile = "hyprland" and configure hyprland.autoStart, workspace, or enableBinds when compositor integration is wanted.

Project Layout

src/app/domain/       buffers, piece-tree text, panes, tabs, and views
src/app/services/     file IO, search, settings, sessions, and background work
src/app/ui/           editor, tabs, dialogs, settings, and search/replace
src/app/startup/      command-line parsing and startup behavior
src/bin/              capacity, frame, resource, and profiling tools
crates/                platform file-watch and icon helper crates
packaging/             Nix/Home Manager and Windows installer definitions
benches/               Criterion benchmarks
docs/                  user, configuration, architecture, and review documents

Documentation

Scratchpad uses Rust 2024 and upstream eframe/egui 0.37.0. See the upgrade validation notes for backend coverage and limitations. Unsafe Rust is forbidden at the crate level. Generated performance and capacity artifacts are written to target/analysis/; the measurement boundary is described in docs/measurement-tools.md.

Scratchpad is available under the MIT License.

About

A very fast Text Editor

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages