diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2023-07-28 20:46:24 -0230 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2023-07-28 20:46:24 -0230 |
| commit | 3516ab494570f077df967bfe1222acc0dfcdf5da (patch) | |
| tree | 4464b0c8e5b93e3ba62b4be3e2bd4c92b0cad1dd /ui.go | |
| parent | 04ba853e7b9ad245865b6e9b4387d2efc144fc72 (diff) | |
| download | pfc-3516ab494570f077df967bfe1222acc0dfcdf5da.zip | |
arithmetic operators
Diffstat (limited to 'ui.go')
| -rw-r--r-- | ui.go | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -37,8 +37,10 @@ func (ui UI) Update(msg tea.Msg) (tea.Model, tea.Cmd) { switch msg.String() { case "ctrl+c", "Q": return ui, tea.Quit - case "+": - ui.calc.add() + case "+", "-", "*", "/", "%": + if err := ui.calc.performOp(msg.String()[0]); err != nil { + panic(err) + } case "backspace": if len(ui.calc.buf) > 0 { ui.calc.buf = ui.calc.buf[:len(ui.calc.buf)-1] |