cheezy / te3270

Automates a 3270 Terminal Emulator
MIT License
17 stars 22 forks source link

Support for x3270 display models #21

Open tdpauw opened 6 years ago

tdpauw commented 6 years ago

This adds support for the different display models of the x3270 terminal emulator.

The x3270 emulator supports different display models defining the size of the screen as set by the manual pages:

 -model name
              The model of 3270 display to be emulated.  The model name is in two parts, either of which may be omitted:

              The first part is the base model, which is either 3278 or 3279.  3278 specifies a monochrome (green on black) 3270 display; 3279 specifies a color 3270 display.

              The second part is the model number, which specifies the number of rows and columns.  Model 4 is the default.

               Model Number   Columns   Rows
               ---------------------------------
                    2           80       24
                    3           80       32
                    4           80       43
                    5           132      27

The current implementation only supports model 2, as X3270.text always returns a length of 24*80.

This pull request extends the API of X3270 with a model attribute accepting the values 2, 3, 4 or 5. Buy default model is set to 2 to keep backwards compatibility. Based on the model X3270.text fetches the correct screen size.

The RSpec tests have been extended to cover the different display models and the case of passing an unsupported model.

This has been tested against a mainframe using display model 3.