Skip to content

Commit

Permalink
Found the rescaling-issue for #1802
Browse files Browse the repository at this point in the history
  • Loading branch information
gunterkoenigsmann committed Jan 11, 2024
1 parent 215bdc0 commit cb1468a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
- Many checkmarks in menus had the wrong value
- Maxima's demos are now available in the menu and context menu
- Default the filter search boxes to text search, not regex
- Rescaling affected size calculations for code only with a delay
- Mac Os: way higher stability if multiple windows are open

# 23.12.0

Expand Down
11 changes: 7 additions & 4 deletions src/cells/EditorCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,10 @@ bool EditorCell::NeedsRecalculation(AFontSize fontSize) const {
void EditorCell::Recalculate(AFontSize fontsize) {
if(NeedsRecalculation(fontsize))
{
// Needs to be before the StyleText() as it sets m_fontsize_scaled
Cell::Recalculate(fontsize);
// Perhaps we should test if the fons have actually changed here.
FontsChanged();
m_isDirty = false;
m_widths.clear();
StyleText();
Expand All @@ -603,7 +607,8 @@ void EditorCell::Recalculate(AFontSize fontsize) {
m_numberOfLines++;
linewidth = textSnippet.GetIndentPixels();
} else {
m_configuration->GetRecalcDC()->GetTextExtent(textSnippet.GetText(), &tokenwidth, &tokenheight);
m_configuration->GetRecalcDC()->GetTextExtent(textSnippet.GetText(),
&tokenwidth, &tokenheight);
textSnippet.SetWidth(tokenwidth);
linewidth += tokenwidth;
width = std::max(width, linewidth);
Expand Down Expand Up @@ -635,7 +640,6 @@ void EditorCell::Recalculate(AFontSize fontsize) {
m_height = std::max(m_height, m_charHeight + 2 * Scale_Px(2));

m_containsChanges = false;
Cell::Recalculate(fontsize);
}
}

Expand Down Expand Up @@ -2961,8 +2965,7 @@ void EditorCell::StyleTextCode() {
// All spaces except the last one (that could cause a line break)
// share the same token
if (tokenString.Length() > 1)
m_styledText.push_back(
StyledText(tokenString.Right(tokenString.Length() - 1)));
m_styledText.push_back(StyledText(tokenString.Right(tokenString.Length() - 1)));

// Now we push the last space to the list of tokens and remember this
// space as the space that potentially serves as the next point to
Expand Down

0 comments on commit cb1468a

Please sign in to comment.