From cc9bc361cd4059a7fa8c2d9de6c5253f84aa3346 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:29:19 +0700 Subject: [PATCH] overview: math: make `^` power (#217) --- .config/ags/widgets/overview/windowcontent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/ags/widgets/overview/windowcontent.js b/.config/ags/widgets/overview/windowcontent.js index e61250f54..68b9d34a4 100644 --- a/.config/ags/widgets/overview/windowcontent.js +++ b/.config/ags/widgets/overview/windowcontent.js @@ -106,7 +106,7 @@ export const SearchAndWindows = () => { if (couldBeMath(text)) { // Eval on typing is dangerous, this is a workaround try { - const fullResult = eval(text); + const fullResult = eval(text.replace(/\^/g, "**")); // copy execAsync(['wl-copy', `${fullResult}`]).catch(print); App.closeWindow('overview'); @@ -168,7 +168,7 @@ export const SearchAndWindows = () => { // Calculate if (couldBeMath(text)) { // Eval on typing is dangerous; this is a small workaround. try { - const fullResult = eval(text); + const fullResult = eval(text.replace(/\^/g, "**")); resultsBox.add(CalculationResultButton({ result: fullResult, text: text })); } catch (e) { // console.log(e);