wxMaxima-developers / wxmaxima

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

Overtyping in a formula with the integral symbol #1780

Closed irokach closed 1 year ago

irokach commented 1 year ago

image Output of the commands like 'integrate(sin(x), x, 0, π)=integrate(sin(x), x, 0, π); always is overprinted. This issue exists in the last 3 versions of wxMaxima and does not exists in the 12.2022 version. My system is Windows 10 Pro.

daute commented 1 year ago

Thanks. With git bisect I found the problematic commit: 4120bc52f0ee0c568761b1d993e7d30c2fda1005 is the first bad commit But that commit is very large, I do not see the problem immediately.

gunterkoenigsmann commented 1 year ago

Seems like in src/cells/IntCell.cpp we fail to set m_width, currently.

daute commented 1 year ago

The following patch (from commit https://github.com/wxMaxima-developers/wxmaxima/commit/4120bc52f0ee0c568761b1d993e7d30c2fda1005) seems solve the issue, but I have no idea, if there are side-effects:

$ git diff
diff --git a/src/cells/IntCell.cpp b/src/cells/IntCell.cpp
index 3158609a2..8b81b76c7 100644
--- a/src/cells/IntCell.cpp
+++ b/src/cells/IntCell.cpp
@@ -111,6 +111,9 @@ void IntCell::Recalculate(AFontSize fontsize) {
     m_height = 0;
     m_width = 0;
   } else {
+     m_width = m_signWidth + m_base->GetFullWidth() +
+       wxMax(m_over->GetFullWidth(), m_under->GetFullWidth()) +
+       m_var->GetFullWidth() + Scale_Px(4);
     if (m_intStyle == INT_DEF) {
       m_center = wxMax(m_over->GetHeightList() + Scale_Px(4) +
                       m_signHeight / 2 - m_signHeight / 3,
gunterkoenigsmann commented 1 year ago

I am thinking if the width of the integral sign (m_signwidth) should increase the sign of the integral, if m_over or m_under is wider than the integral sign. For the rest it looks good => applying the patch.