groovy

Allow config file to overide defaults for groovy console font size and console height and width

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6-beta-2
  • Fix Version/s: 1.7-beta-1
  • Component/s: Groovy Console
  • Labels:
    None
  • Environment:
    all
  • Patch Submitted:
    Yes
  • Number of attachments :
    1

Description

A patch is attached that applies the enhancement described below.

The groovy (and grails) consoles currently have a hard coded font size of 12 pixels. It also has a hard coded width of approximately 80 characters and a height of about 24 lines of text (12 for the input area and 12 for the output area).

There are shortcuts to increase the font size (cmd-shift-L on the mac), and it is also possible to drag the swing window to cover a large area, but these steps need to be repeated every time a new console window is opened.

The default font sizes and area covered by the console is quite small when viewed on modern monitor resolutions of 1920x1200 and greater. I know that for myself and another coworker, this is something we do many times a day (and it gets old .

The attached patch allows for a configuration file (in GroovyConfig format) to be created in the users home directory, under (~/.groovy/ConsoleConfig.groovy by default on mac/unix systems).

If this file exists, the user can override the font size of the input area and the output area and can also specify the height and width of both areas independently.

Here is a sample config file created at (~/.groovy/ConsoleConfig.groovy):

console {
inputArea { fontSize=18 width=1440 height=800 }
outputArea { fontSize=16 width=1440 height=200 }
}

This creates a large input area with big font, and a smaller output area with a slightly smaller font.

If the ConsoleConfig.groovy file is not present, the current default are used.

Activity

Hide
Guillaume Laforge added a comment -

It'd be better IMHO to use the preference API for storing these kind of preferences.
It's already used in the console for storing various preferences, we should stick with that mechanism for remembering preferences.

Cf discussion http://www.nabble.com/enhancement-to-groovy-grails-console-to-allow-config-file-to-override-font-size-and-input-output-area-sizes-to21906917.html

Show
Guillaume Laforge added a comment - It'd be better IMHO to use the preference API for storing these kind of preferences. It's already used in the console for storing various preferences, we should stick with that mechanism for remembering preferences. Cf discussion http://www.nabble.com/enhancement-to-groovy-grails-console-to-allow-config-file-to-override-font-size-and-input-output-area-sizes-to21906917.html
Hide
Danno Ferrin added a comment -

Another issue I see is that the patch doesn't automatically save the preferences as they are applied by the user. In fact, it doesn't save any of the config at all as far as I can read. Another issue that needs to be addressed before I would apply the patch.

Show
Danno Ferrin added a comment - Another issue I see is that the patch doesn't automatically save the preferences as they are applied by the user. In fact, it doesn't save any of the config at all as far as I can read. Another issue that needs to be addressed before I would apply the patch.
Hide
Ted Naleid added a comment -

That makes sense. In poking through the console code yesterday, I didn't see any uses of the preferences API (and it never seemed to save any previous state).

I'll look at updating the patch tonight so that it uses the preferences API (and auto saves any changes).

Show
Ted Naleid added a comment - That makes sense. In poking through the console code yesterday, I didn't see any uses of the preferences API (and it never seemed to save any previous state). I'll look at updating the patch tonight so that it uses the preferences API (and auto saves any changes).
Hide
Ted Naleid added a comment -

Updated patch attached: GROOVY_3344_console_font_and_size.patch

Updated patch addresses concerns of Guillame and Danno. It uses the Java Preferences API that's already being used elsewhere in the Console to persist the font size changes as well as the height and width of the input and output areas.

This has been tested successfully on OSX, but I believe it should work on other systems as well with the encapsulation given by the preference API on other platforms.

Show
Ted Naleid added a comment - Updated patch attached: GROOVY_3344_console_font_and_size.patch Updated patch addresses concerns of Guillame and Danno. It uses the Java Preferences API that's already being used elsewhere in the Console to persist the font size changes as well as the height and width of the input and output areas. This has been tested successfully on OSX, but I believe it should work on other systems as well with the encapsulation given by the preference API on other platforms.
Hide
Hamlet D'Arcy added a comment -

is there a problem with the patch? It's not 4 months later.... just trying to move things along

Show
Hamlet D'Arcy added a comment - is there a problem with the patch? It's not 4 months later.... just trying to move things along
Hide
Ted Naleid added a comment -

Last I heard from Guillaume on the mailing list, the patch looked good to him.

http://www.nabble.com/enhancement-to-groovy-grails-console-to-allow-config-file-to-override-font-size-and-input-output-area-sizes-ts21906917.html

As far as I'm aware it's still good and just needs to be applied. I'd love to see it in a release version as it's still bugging me to have to resize all the time.

If there are problems with the patch, just let me know and I'll make the fixes.

Show
Ted Naleid added a comment - Last I heard from Guillaume on the mailing list, the patch looked good to him. http://www.nabble.com/enhancement-to-groovy-grails-console-to-allow-config-file-to-override-font-size-and-input-output-area-sizes-ts21906917.html As far as I'm aware it's still good and just needs to be applied. I'd love to see it in a release version as it's still bugging me to have to resize all the time. If there are problems with the patch, just let me know and I'll make the fixes.
Hide
Guillaume Laforge added a comment -

Actually I thought we had even already applied it, and I was wondering why my console wasn't working that way already
So it's just that we haven't come to applying it.
But it still looks good to me with all the updates Ted did, it's just we need to apply it.
Sorry for not having done so so far, hopefully we'll get to it shortly.
Thanks for the reminder.

Show
Guillaume Laforge added a comment - Actually I thought we had even already applied it, and I was wondering why my console wasn't working that way already So it's just that we haven't come to applying it. But it still looks good to me with all the updates Ted did, it's just we need to apply it. Sorry for not having done so so far, hopefully we'll get to it shortly. Thanks for the reminder.
Hide
Guillaume Laforge added a comment -

Thank you Ted for the patch!
Sorry for not having applied it earlier.

Show
Guillaume Laforge added a comment - Thank you Ted for the patch! Sorry for not having applied it earlier.

People

Vote (3)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: