Why does hitting "Ctrl minus" in the command line shrink the font size?

7,540

Solution 1

It's a somewhat standard keyboard shortcut (it works in Konsole, too).

It's simply bound to reduce font size (and simmetrically, Ctrl+ to increase font size).

You can easily disable/modify by going to the shortcuts preferences:

Edit ▸ Preferences ▸ Shortcuts.

Solution 2

It has nothing to do with the command line, it's just a Gnome Terminal application shortcut. It won't happen in eg Xterm.

Solution 3

These are shortcuts for changing the font size in gnome-terminal. You can see them in the View menu and change them in the Edit → Keybord shortcuts… menu.

Solution 4

As an addition to other answers, you can usually reset the size to default with the key combination Ctrl0

Solution 5

It is a feature of vte (gnome-terminal) and konsole. According to vte's git-log, it was added in November 2002:

handle end-of-line selection correctly. Stop highlighting selection on
* src/vte.c: handle end-of-line selection correctly.  Stop highlighting
    selection on click, but don't lose it until new text is selected.
* python/vte.override: fix binding for set_colors() to properly take a
    list of colors for the palette (#97682).
* src/vte.c, src/vte.h: add increase-font-size and decrease-font-size to allow
    mimicking XTerm's and Mozilla's behavior on Shift/Control
    KP_Add/KP_Subtract
* src/vteapp.c: handle increase-font-size and decrease-font-size.

Konsole added it in April 2007:

Add menu items and shortcuts to increase and decrease font size. I have tried to keep as close as possible to the recommended Zoom In/Out shortcuts given that Ctrl+[Key] shortcuts cannot be used because they are reserved for terminal application use. Ctrl++ zooms in, Ctrl+Shift+- zooms out.

Regarding keyboard shortcuts, xterm has used shifted keypad plus/minus since 1999, imitating rxvt which introduced the feature a few years earlier (seen in version 2.18, August 1996).

That's four implementations over more than 10 years. With macOS (OSX), Terminal.app and iTerm2 do both (using command rather than control), but since there's no reliable documentation on Terminal.app, it's hard to say when the feature was added.

Then again, there are several terminal emulators which appear to lack the feature (still).

Share:
7,540

Related videos on Youtube

jshthornton
Author by

jshthornton

Updated on September 18, 2022

Comments

  • jshthornton
    jshthornton over 1 year

    I have hit a few CTRL- in command line and I see the text in the terminal getting smaller with every invocation. What is going on here and is there a way to redo ie magnify the text to bring it back to the original size via a command?

    Edit: As per Christopher's suggestion in the comment I can get back to my original font size by hitting CTRL+ but I would still like to understand what is going on behind the scenes here.

    • jshthornton
      jshthornton almost 10 years
      @Christopher yes it does work.
    • jshthornton
      jshthornton almost 10 years
      @Christopher I updated the question based on your comment.
    • psimon
      psimon almost 10 years
      This is common behavior in many applications like browsers, file managers, terminal emulators, etc.