Bug 430055

Summary: Bash escape sequences visible in the output of qalculate
Product: [Applications] cantor Reporter: Joshua Houghton <joshua.houghton>
Component: qualculate-backendAssignee: Nikita Sirgienko <warquark>
Status: RESOLVED FIXED    
Severity: normal CC: joshua.houghton, warquark
Priority: NOR    
Version First Reported In: 20.08   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 20.12.1
Sentry Crash Report:
Attachments: Screenshot of qualculate and cantor side by side

Description Joshua Houghton 2020-12-05 21:00:45 UTC
Created attachment 133895 [details]
Screenshot of qualculate and cantor side by side

SUMMARY
Qalculate now applies colours to it's output. Cantor however fails to parse the bash escape sequences and therefore outputs garbase

STEPS TO REPRODUCE
1. Create a thing with the qalculate backend
2. Run this mathematical expression ((-2)^3.3)
3. You'll see the following garbage in the output 
(−[0;36m2[0m)^[0;36m3.3[0m ≈ [0;36m−[0m[0;36m5.789188237[0m − [0;36m7.968134023[0m[0;33mi[0m
4. Run this mathematical expression integrate(asin(x))
5. You'll see the following garbage in the output
integrate(arcsin([0;33m[3mx[23m[0m)) = [0;33m[3mx[23m[0m × arcsin([0;33m[3mx[23m[0m) + √([0;36m1[0m − [0;33m[3mx[23m[0m^[0;36m2[0m) + [0;33m[3mC[23m[0m

OBSERVED RESULT

See screenshot attached. Look at the output from cantor

EXPECTED RESULT

See screenshot attached. Look at the top left terminal

SOFTWARE/OS VERSIONS
SOFTWARE/OS VERSIONS
Qt Version: 5.15.1
Frameworks Version: 5.75.0
Operating System: Linux 5.9.11-200.fc33.x86_64 x86_64
Windowing system: X11
Distribution: "Fedora release 33 (Thirty Three)"
qalculate: 3.15.0

ADDITIONAL INFORMATION

I was going to look into this issue myself but when i tried to compile and run cantor i couldn't https://bugs.kde.org/show_bug.cgi?id=430045. I did eventually manage to get it to start but i feel i should probably be getting on with other things now.

I have tested the following versions of cantor and can confirm this is an issue on all three.
master: 481d52238f5c4cf0b4e0a77fbb7bcc2aff2e8645
v20.11.80
v20.08.1

I'm using qalc version 3.15.0
Comment 1 Nikita Sirgienko 2020-12-06 22:26:59 UTC
Git commit 9556b69fc03350eb88f5a3f2ef21e6853b058cf3 by Nikita Sirgienko.
Committed on 06/12/2020 at 22:25.
Pushed by sirgienko into branch 'master'.

[Qalculate] Fix bug with terminal colour symobls in command results
FIXED-IN: 20.12.1

M  +1    -1    CMakeLists.txt
M  +2    -0    cmake/FindQalculate.cmake
M  +3    -0    src/backends/qalculate/CMakeLists.txt
M  +5    -0    src/backends/qalculate/qalculatesession.cpp

https://invent.kde.org/education/cantor/commit/9556b69fc03350eb88f5a3f2ef21e6853b058cf3