Standalone calculator
Updated
A 1C-style four-function calculator opens as a small floating window on top of the work area. You can keep a document open while you run figures in the pad.
This is not the calculator on a number field. CalcNumberInput
(frontend/src/components/NumberCalculator.tsx) still opens its own popover on
integer and decimal fields; the standalone tool does not replace or restyle it.
How it opens#
| Entry | Where |
|---|---|
| Nova | Round Calculator icon in NovaTopBar, in the right cluster with bell and help |
| Palette | Ctrl+K → settings group, title Calculator (calc.title) |
| Classic ribbon | Tools → Calculator |
All paths call openCalculator() in frontend/src/windows/CalculatorWindow.tsx.
There is no default global hotkey.
One window#
The MDI window id is calculator. Opening again focuses and restores that
window; it does not spawn a second copy and does not toggle-close on repeat.
Chrome uses the existing FloatingWindow with kind calculator: pin and
maximize are hidden (the pad must not dock into the workspace), close with ×.
Default size is about 360×440; geometry persists like other floating windows.
Formula line and arithmetic#
The display is an editable formula line: pad keys append, the keyboard types
digits, operators, and ( ). Parentheses are keyboard-only so the pad keeps the
1C layout. Press = or Enter to evaluate.
Example (unit-tested):
(100+50)/20*55 → 412.5
Parentheses first, then × and ÷, then + and −, left to right within
each precedence band. A live preview appears under the formula when the
expression is complete. Both , and . type the decimal separator while typing;
the displayed decimal separator follows the UI language (comma for ru / uk,
dot for en). Thousands grouping is display-only; the engine stores a number.
Evaluation uses the calculator's own evalFormula in
frontend/src/kit/calculatorMath.ts. Do not route the pad through safeEval:
that helper treats % as modulo and accepts identifiers.
Percent#
n % replaces the last number n with n / 100. After + or −,
a + b % is a + a×(b/100) (same idea for minus). After × or ÷, b % is
b / 100. % is never modulo.
Pad keys#
Top combo: last results (newest first); pick one to load it as the current value.
Memory row shows M = … when set, with MS / MR / M+ / M−.
CE deletes the last number or character; C clears the formula (memory
stays). Also ±, %, 1/x, digits, 00, locale decimal, + − × ÷ =.
Memory and history#
Both live in window state only. Closing the window drops memory and history; they
are not written to userPrefs. History keeps the last 20 results.
Errors#
Divide by zero and 1/x of zero show a localized message on the display; they
do not write Infinity or NaN. C or CE clears the error.
Code#
Out of scope (by design)#
Pasting the result into the focused field, scientific/programmer modes, % as
remainder, mobile, persisting memory across sessions, and a default global
hotkey. See the spec for the full list.