Bug #975
EditorBar should be always refresh when font size is changed
Status: | Approved | Start date: | 02/03/2015 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | Miroslav Fidler | % Done: | 100% | |
Category: | CodeEditor | Spent 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).
History
#1 Updated by Zbigniew Rebacz over 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 over 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 over 9 years ago
scrollbar = editorbar;
#4 Updated by Zbigniew Rebacz over 9 years ago
- File EditorBarFix.diff added
- % Done changed from 80 to 100
I think this is the best solution. More information in diff.