Bug 363553

Summary: Octave output is not parsed correctly
Product: [Applications] cantor Reporter: Alexander Semke <alexander.semke>
Component: octave-backendAssignee: Filipe Saraiva <filipe>
Status: RESOLVED FIXED    
Severity: major CC: alexanderrieder, filipe
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: All   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alexander Semke 2016-05-26 18:54:39 UTC
The variables added to the variable model have empty strings as values.

Reproducible: Always

Steps to Reproduce:
1. create a row vector a=[1 2 3] or a column vector b=[1;2;3] and observe the changes on the variable model. Looks like the line breaks at the beginning and at the end of octave's output string are not handled correctly in Cantor.
2. this problem also exists for large vectors where pagination is used to display the elements. To see this, create a vector for example with big_vector=1:100 


2.
3.
Comment 1 Filipe Saraiva 2016-05-26 19:19:03 UTC
This behaviour is caused by changes in Octave output. Cantor fills the variable management widget using the Octave outputs in OctaveExpression::finalize function.

When you type for instance 'x = 2', the output is 'x = 2\n' so the current logic in that Cantor function can get the variable and the value. But the command for creation of a vector, like 'x = [1 2 3]' the output is 'x=\n\n1 2 3\n\n', it is different from the previous pattern of Octave outputs.

This bug is related with #363445. I am thinking in a new way to get the variables correctly.
Comment 2 Alexander Semke 2016-05-26 19:27:05 UTC
would a simple replacing of all occurrences of '\n' with '' and doing the extraction of the variable value after that help here?
Comment 3 Filipe Saraiva 2016-05-26 21:44:21 UTC
(In reply to Alexander Semke from comment #2)
> would a simple replacing of all occurrences of '\n' with '' and doing the
> extraction of the variable value after that help here?

Yes, it fix this bug but not the #363445 bug. I am thinking in a way to solve both, if it not possible for the moment maybe I can to use the replacement of '\n'.
Comment 4 Filipe Saraiva 2017-01-28 14:09:28 UTC
Git commit 1a0043d3ddf905f54f8e706d2f793d55f034e3d5 by Filipe Saraiva.
Committed on 28/01/2017 at 14:05.
Pushed by filipesaraiva into branch 'master'.

Parse correctly the vector/list output of Octave backend to
variable management widget

M  +1    -1    src/backends/octave/octaveexpression.cpp

https://commits.kde.org/cantor/1a0043d3ddf905f54f8e706d2f793d55f034e3d5
Comment 5 Filipe Saraiva 2017-01-28 14:11:25 UTC
Hi asemke, I am using the workaround to fix it. Unfortunately it will be very hard to fix this bug together with bug #363445.

Please, if you find some errors with this approach reopen this bug report.