Merge pull request #286 from jelly/reset-zoom-level

Reset font size to startup default using a keybinding
This commit is contained in:
Daniel Micay 2016-01-26 02:53:00 -05:00
commit 7fdf5ceabd
3 changed files with 13 additions and 0 deletions

View File

@ -146,6 +146,8 @@ SELECTION MODE
+-----------------------------------+-----------------------------------------------------------+ +-----------------------------------+-----------------------------------------------------------+
| ``-`` | decrease font size | | ``-`` | decrease font size |
+-----------------------------------+-----------------------------------------------------------+ +-----------------------------------+-----------------------------------------------------------+
| ``=`` | reset font size to default |
+-----------------------------------+-----------------------------------------------------------+
During scrollback search, the current selection is changed to the search match During scrollback search, the current selection is changed to the search match
and copied to the PRIMARY clipboard buffer. and copied to the PRIMARY clipboard buffer.

View File

@ -135,6 +135,8 @@ previous search match
increase font size increase font size
.IP "\fB-\fP" .IP "\fB-\fP"
decrease font size decrease font size
.IP "\fB=\fP"
reset font size to default
.SS Hints Mode .SS Hints Mode
The The
\fBHints Mode\fP is meant for accessing urls outputted to the terminal. \fBHints Mode\fP is meant for accessing urls outputted to the terminal.

View File

@ -123,6 +123,7 @@ struct config_info {
gboolean fullscreen; gboolean fullscreen;
int tag; int tag;
char *config_file; char *config_file;
gdouble font_scale;
}; };
struct keybind_info { struct keybind_info {
@ -722,6 +723,10 @@ void window_title_cb(VteTerminal *vte, gboolean *dynamic_title) {
title ? title : "termite"); title ? title : "termite");
} }
static void reset_font_scale(VteTerminal *vte, gdouble scale) {
vte_terminal_set_font_scale(vte, scale);
}
static void increase_font_scale(VteTerminal *vte) { static void increase_font_scale(VteTerminal *vte) {
gdouble scale = vte_terminal_get_font_scale(vte); gdouble scale = vte_terminal_get_font_scale(vte);
@ -902,6 +907,9 @@ gboolean key_press_cb(VteTerminal *vte, GdkEventKey *event, keybind_info *info)
case GDK_KEY_minus: case GDK_KEY_minus:
decrease_font_scale(vte); decrease_font_scale(vte);
break; break;
case GDK_KEY_equal:
reset_font_scale(vte, info->config.font_scale);
break;
} }
return TRUE; return TRUE;
} }
@ -1371,6 +1379,7 @@ static void set_config(GtkWindow *window, VteTerminal *vte, config_info *info,
info->filter_unmatched_urls = cfg_bool("filter_unmatched_urls", TRUE); info->filter_unmatched_urls = cfg_bool("filter_unmatched_urls", TRUE);
info->modify_other_keys = cfg_bool("modify_other_keys", FALSE); info->modify_other_keys = cfg_bool("modify_other_keys", FALSE);
info->fullscreen = cfg_bool("fullscreen", TRUE); info->fullscreen = cfg_bool("fullscreen", TRUE);
info->font_scale = vte_terminal_get_font_scale(vte);
g_free(info->browser); g_free(info->browser);
info->browser = nullptr; info->browser = nullptr;