Bug #975

EditorBar should be always refresh when font size is changed

Added by Zbigniew Rebacz about 9 years ago. Updated about 9 years ago.

Status:ApprovedStart date:02/03/2015
Priority:NormalDue date:
Assignee:Miroslav Fidler% Done:

100%

Category:CodeEditorSpent time:-
Target version:-

Description

I think we still have problems with appropriately EditorBar scaling when font change.

It should even be called when line_numbers is disable (for example annotation position should be update).

EditorBarFix.diff Magnifier (1.7 KB) Zbigniew Rebacz, 02/04/2015 04:24 PM

History

#1 Updated by Zbigniew Rebacz about 9 years ago

  • Status changed from New to Patch ready
  • Assignee set to Miroslav Fidler
  • % Done changed from 0 to 80

This should solve the problem (Refresh should be always called after refresh):

void EditorBar::SyncWidth()
{
    int n = editor ? editor->GetLineCount() : 0;
    int i = 0;
    while(n) {
        i++;
        n /= 10;
    }
    int w = (line_numbers && editor ? editor->GetFont()['0'] * i : 0) + 12 + 4 + annotations;
    if(w != GetWidth())
        Width(w);
    Refresh();
}

First reason is that font height can be different, but width stay the same (This issue can be spotted when scaling line numbers). Maybe we should implement "SyncHeight" method to make code more understandable. The second reason is scaling annotation position and breakpoint position.

#2 Updated by Zbigniew Rebacz about 9 years ago

To make it totally clear we need to calculate overall scrollbar height and if it is different than previous - refresh.

#3 Updated by Zbigniew Rebacz about 9 years ago

scrollbar = editorbar;

#4 Updated by Zbigniew Rebacz about 9 years ago

I think this is the best solution. More information in diff.

#5 Updated by Miroslav Fidler about 9 years ago

  • Status changed from Patch ready to Approved

thanks

Also available in: Atom PDF