Bug 484097 - Git Staging view should update font when preference changes
Summary: Git Staging view should update font when preference changes
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 4.1   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: 4.9.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-10 05:07 EST by Markus Keller CLA
Modified: 2017-07-08 04:56 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2015-12-10 05:07:15 EST
The Commit Message field in the Git Staging view is using the Text Font. When this font gets changed by the user, clients should update to the new font.

This is an old problem that will become more apparent with bug 476037 in Neon M4, e.g. with these steps:
- start up in a way that the Git Staging view is not visible
- increase the font size (Ctrl++)
- open Git Staging view
- decrease the font size (Ctrl+-)
=> Git Staging view keeps the big font
Comment 1 Eclipse Genie CLA 2017-07-05 10:46:21 EDT
New Gerrit change created: https://git.eclipse.org/r/100738
Comment 2 Thomas Wolf CLA 2017-07-06 04:14:16 EDT
(In reply to Eclipse Genie from comment #1)
> New Gerrit change created: https://git.eclipse.org/r/100738

This will work properly with those shortcuts only if:
* EGit views use the default JFace TEXT_FONT, i.e., the theme-specific fonts
  for the commit message in the staging view and the commit message viewer in
  the history view are not overridden (they default to TEXT_FONT).
* There is an active text editor, and it uses TEXT_FONT

The zoom commands (on Mac with the shortcuts  Cmd-= and Cmd--, and NumPad-Minus doesn't work whereas NumPad-= does and is actually for me the only way to trigger this, since Cmd-Shift-0 (on my keyboard, "=" is Shift-0) doesn't work) are available under <Global menu>->Window->Editor, but only when a text editor is active.

If there is no active text editor, the implementation of https://git.eclipse.org/r/#/c/50042/31/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/texteditor/AbstractTextZoomHandler.java won't do anything.

If there is, it will only zoom the font (family) used by that editor.

The shortcuts are not available when e.g. the staging view is active, and the command wouldn't do anything anyway.

If the TEXT_FONT is changed via <Preferences>->General->Appearance->Colors & Fonts, "Basic->Text Font" or "Git->Commit Message Font" or "Git->Commit Message Editor Font", then the views will react properly.

The Gerrit change also adds reacting to color preference changes (font & selection foreground/background).
Comment 3 Mickael Istria CLA 2017-07-06 04:23:01 EDT
The root issue is bug 483921. There is currently no way in Platform to know which FontDefinition (part of the Theme FontRegistry) a view or whatever StyledText is using to decide which font to modify on Ctrl+/-.
The only known workaround is to have EGit providing a specific handler for the zoomIn/Out commands, that reuse or mimic the AbstractTextZoomHandler and provide the right font definition to modify, using EGit specific code.
Comment 4 Thomas Wolf CLA 2017-07-06 04:28:44 EDT
(In reply to Mickael Istria from comment #3)
> The root issue is bug 483921. There is currently no way in Platform to know

Thanks for the pointer!

> which FontDefinition (part of the Theme FontRegistry) a view or whatever
> StyledText is using to decide which font to modify on Ctrl+/-.
> The only known workaround is to have EGit providing a specific handler for
> the zoomIn/Out commands, that reuse or mimic the AbstractTextZoomHandler and
> provide the right font definition to modify, using EGit specific code.

I don't think we'll do that. Too much work-around for too little benefit just to have those shortcuts. The original bug report asked for reacting on preference changes, which is what this Gerrit change implements, and in the default setting, zooming in in an editor will also zoom the EGit viewers (since everything is based by default on the JFace TEXT_FONT).
Comment 5 Eclipse Genie CLA 2017-07-08 04:55:57 EDT
Gerrit change https://git.eclipse.org/r/100738 was merged to [master].
Commit: http://git.eclipse.org/c/egit/egit.git/commit/?id=78a317337d5e35174255b9166ccab32f40e5b692