Bug 407910 - Add keyboard shortcut to change font back to default size
Summary: Add keyboard shortcut to change font back to default size
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: 19.04.1
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-24 14:56 UTC by Kishore Gopalakrishnan
Modified: 2019-05-26 12:17 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.59.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kishore Gopalakrishnan 2019-05-24 14:56:29 UTC
Currently, we only have 'enlarge font' and 'reduce font' options in 'Settings > Configure Shortcuts'. A keyboard shortcut to reset the default font size would be useful to quickly recover when one accidentally changes the font size (sometimes I accidentally press ctrl while scrolling). This could be bound by default to 'ctrl+0', since people are probably used to that from web browsers.
Comment 1 Nate Graham 2019-05-24 21:03:33 UTC
Konsole now has this, added with https://cgit.kde.org/konsole.git/commit/?id=f6e432ab0c04226bd772019911b97298070d1264

Maybe you could work on a patch, copying how it was done for Konsole?
Comment 2 Lothar 2019-05-25 06:42:11 UTC
There was in the past a nice feature where one wheel tick was ignored when the font has the default size. But since some weeks is it gone. No idea why that was "fixed".
Comment 3 Kishore Gopalakrishnan 2019-05-26 05:31:18 UTC
(In reply to Nate Graham from comment #1)
> Konsole now has this, added with
> https://cgit.kde.org/konsole.git/commit/
> ?id=f6e432ab0c04226bd772019911b97298070d1264
> 
> Maybe you could work on a patch, copying how it was done for Konsole?

I have a working patch now, in the sense that the action appears in the shortcuts manager and if one manually assigns a shortcut to it, one can reset the font sizes. However, I still haven't figured out how to get it to show in the 'Edit' menu, or how to correctly assign a default shortcut for it.
Comment 4 Lothar 2019-05-26 05:44:34 UTC
> I still haven't figured out how to get it to show in the 'Edit' menu,

On top of these ui/xml is a version number you need to increase
Comment 5 Dominik Haumann 2019-05-26 05:50:39 UTC
You have to add an entry into the KTextEditor ui.rc file:
https://github.com/KDE/ktexteditor/blob/master/src/data/katepart5ui.rc

Note: you have to increase the version number from 82 to 83, otherwise it will not update caches.

Could you post your patch on phabricator.jde.orf?
Comment 6 Kishore Gopalakrishnan 2019-05-26 06:10:27 UTC
I've posted it here: https://phabricator.kde.org/D21412
Comment 7 Christoph Cullmann 2019-05-26 11:52:07 UTC
Git commit 968af10fd4b64cccf6a858f105ac6cfad9fce78e by Christoph Cullmann, on behalf of Kishore Gopalakrishnan.
Committed on 26/05/2019 at 11:51.
Pushed by cullmann into branch 'master'.

Add action to reset font size

Summary: Add an action to reset the font size to the default and set the default shortcut to Ctrl+0

Test Plan:
Zoom out the text. Press Ctrl+0 to go back to default zoom.
Do the same with the 'Reset font size' item in the 'View' menu.
Try to reassign the keyboard shortcut in the shortcuts manager and check that it works.

Reviewers: #ktexteditor, cullmann

Reviewed By: #ktexteditor, cullmann

Subscribers: cullmann, kwrite-devel, kde-frameworks-devel

Tags: #kate, #frameworks

Differential Revision: https://phabricator.kde.org/D21412

M  +6    -3    src/data/katepart5ui.rc
M  +6    -0    src/render/katerenderer.cpp
M  +1    -0    src/render/katerenderer.h
M  +7    -0    src/view/kateview.cpp
M  +5    -0    src/view/kateviewinternal.cpp
M  +1    -0    src/view/kateviewinternal.h

https://commits.kde.org/ktexteditor/968af10fd4b64cccf6a858f105ac6cfad9fce78e