RFR: 8332314: Add window size configuration option to JavaShellToolBuilder interface

Archie Cobbs acobbs at openjdk.org
Wed May 15 17:03:13 UTC 2024


On Tue, 14 May 2024 02:46:33 GMT, Chen Liang <liach at openjdk.org> wrote:

>> When launching JShell programmatically (i.e., from a Java program instead of the command line) for an interactive session, it's not currently possible to inform JShell what the terminal window's dimensions are. As a result, JShell defaults to 80x24 and line editing becomes almost impossible because of the scrambled screen contents unless you happen to be using an 80x24 window, which these days is very unlikely.
>> 
>> This patch adds a new method `JavaShellToolBuilder.windowSize()` which allows passing a "hint" for the number of rows & columns.
>
> src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellToolBuilder.java line 225:
> 
>> 223:             throw new IllegalArgumentException("columns = " + columns);
>> 224:         if (rows <= 0)
>> 225:             throw new IllegalArgumentException("-columns = " + -columns);
> 
> Is this supposed to have a message like `"rows = " + rows` instead

Oops, yes - thanks. Fixed in 08f7d3bc069.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19226#discussion_r1600052871


More information about the kulla-dev mailing list