wxMaxima-developers / wxmaxima

A gui for the computer algebra system Maxima built with wxWidgets
https://wxMaxima-developers.github.io/wxmaxima/
Other
459 stars 96 forks source link

Formatting seems off. #1894

Closed richardgobeli closed 4 months ago

richardgobeli commented 4 months ago

The formatting in the build_info and the myinfo() I made is incorrect. My function needs to be run twice. Before it works. The second items in the list should line up on a vertical line.

image

image

wxmaxima-init.txt Attached is the function myinfo() which should load each time WxMaxima is opened up.

richardgobeli commented 4 months ago

There must be something off with the font size. Today the second items line up in a vertical column. But myinfo() still does not work the first time. I see this is a version before the above was from a computer at work running Windows 11.

This one is Windows 10.

image

Here it is from today.

image

daute commented 4 months ago

I think the reason is, that your function myinfo() has some "side effects" (printing) during evaluation. And I suspect, that this output - I am really guessing - reaches wxMaxima 'too early'.

A improved version of your function may be:

myinfo2():=block(buildinfo:build_info(),
listx:["maxima version","time stamp",host,"lisp name","lisp version","maxima directory","temp directory","obj directory","front end name","front end version"],
myinfooutput:printf(false, "------------------------------~%"),
for i: 1  thru 10 do myinfooutput:sconcat(myinfooutput,printf(false, "~35a~a~a~%", listx[i], "= ", part(buildinfo,i))),
return(myinfooutput));

(That can be improved, by using local variables, etc.)

Then the output of the function is the (formatted) result, which can either be printed (myinfo2();) or assigned to another variable (a:myinfo2()$) and than you can use a for further processing.

Best regards, Wolfgang

daute commented 4 months ago

Concerning the alignment: That (of course) will only work, if you use a monospaced font.

richardgobeli commented 4 months ago

This had always worked a few months ago. Now it does not work on the first try. Another inconsistency is the code ~% does not print a new line every time, but only when something is printed.

richardgobeli commented 4 months ago

I tried your version with the same result every time nothing; image Printing direct works but only the second time. image

richardgobeli commented 4 months ago

why is this? on starting a normal printf takes more the 5 seconds and does not do a line feed, but the second time it is very fast and does the new line. first line is 2+2; image after along response we get the answer 4. image

next line is the printf twice.

image the reason it takes more than 5 seconds is that the first printf statement WxMaxima asks for the symboltable.

image The second time it response correctly.

image

daute commented 4 months ago

Hm. Strange, you are right, my function works on Linux (where I tested it), but not on Windows, it removes the newlines - but only if wxMaxima is used as frontend. There is something very strange occuring most likely in the Lisp part of wxMaxima. But what?

gunterkoenigsmann commented 4 months ago

If the problem might be the stupid CR/CRLF/LF/LFCR problem?

gunterkoenigsmann commented 4 months ago

My question is now: Did maxima send one line containing all the minusses the first time the command was issued and two lines with half the minusses each, the second time?

The problem with the symbol table is that that table is 65 Kilobytes long - and reading from maxima for some reason is quite slow. Am still trying to find out how to speed it up.

gunterkoenigsmann commented 4 months ago

Found one reason why reading unicode from a socket was able to be this slow. Originally I tried to move it to a background thread. But that still doesn't work as it should, for some reason...

richardgobeli commented 4 months ago

New result from last nights build. About 50% of the time it will do this from repeated restart button.

image image

gunterkoenigsmann commented 4 months ago

With that command I was finally able to reproduce the bug on my own computer. Thanks a lot for doing all the debugging work!