diff --git a/packages/desktop-client/src/components/table.tsx b/packages/desktop-client/src/components/table.tsx index 59ff2f19565101356860545078dcf56117147a08..96fd84131b65467112285f9d11111f319c9b1873 100644 --- a/packages/desktop-client/src/components/table.tsx +++ b/packages/desktop-client/src/components/table.tsx @@ -339,11 +339,25 @@ function InputValue({ } } + const ops = ['+', '-', '*', '/', '^']; + + function valueIsASingleOperator(text) { + return text?.length === 1 && ops.includes(text.charAt(0)); + } + + function setValue_(text) { + if (valueIsASingleOperator(text)) { + setValue(defaultValue + text); + } else { + setValue(text); + } + } + return ( <Input {...props} value={value} - onChangeValue={text => setValue(text)} + onChangeValue={text => setValue_(text)} onBlur={onBlur_} onUpdate={onUpdate} onKeyDown={onKeyDown} diff --git a/upcoming-release-notes/2523.md b/upcoming-release-notes/2523.md new file mode 100644 index 0000000000000000000000000000000000000000..42f0c8ac804957a1f46fea729b36c664e6631d48 --- /dev/null +++ b/upcoming-release-notes/2523.md @@ -0,0 +1,6 @@ +--- +category: Enhancements +authors: [JazzyJosh] +--- + +Using any math operator on an input will begin a calculation starting with the existing value.