#define TTY_UPDATE_STATUS 8 /* Update status line. */
#define TTY_UPDATE_ALL 16 /* Recreate screen. */
+#define TTY3270_INPUT_AREA_ROWS 2
static void tty3270_update(struct timer_list *);
/*
* Setup timeout for a device. On timeout trigger an update.
mod_timer(&tp->timer, jiffies + expires);
}
+static int tty3270_tty_rows(struct tty3270 *tp)
+{
+ return tp->view.rows - TTY3270_INPUT_AREA_ROWS;
+}
+
/*
* The input line are the two last lines of the screen.
*/
memcpy(line->string, blueprint, sizeof(blueprint));
line->len = sizeof(blueprint);
/* Set output offsets. */
- offset = tp->view.cols * (tp->view.rows - 2);
+ offset = tp->view.cols * tty3270_tty_rows(tp);
raw3270_buffer_address(tp->view.dev, line->string + 1, offset);
offset = tp->view.cols * tp->view.rows - 9;
raw3270_buffer_address(tp->view.dev, line->string + 8, offset);
*/
list_for_each_entry_safe(s, n, &tp->update, update)
list_del_init(&s->update);
- line = tp->view.rows - 3;
+ line = tty3270_tty_rows(tp) - 1;
nr_up = tp->nr_up;
list_for_each_entry_reverse(s, &tp->lines, list) {
if (nr_up > 0) {
if (s)
return s;
list_for_each_entry_safe(s, n, &tp->lines, list) {
- BUG_ON(tp->nr_lines <= tp->view.rows - 2);
+ BUG_ON(tp->nr_lines <= tty3270_tty_rows(tp));
list_del(&s->list);
if (!list_empty(&s->update))
list_del(&s->update);
s = alloc_string(&tp->freemem, size);
BUG_ON(!s);
if (tp->nr_up != 0 &&
- tp->nr_up + tp->view.rows - 2 >= tp->nr_lines) {
- tp->nr_up = tp->nr_lines - tp->view.rows + 2;
+ tp->nr_up + tty3270_tty_rows(tp) >= tp->nr_lines) {
+ tp->nr_up = tp->nr_lines - tp->view.rows + TTY3270_INPUT_AREA_ROWS;
tty3270_rebuild_update(tp);
tty3270_update_status(tp);
}
struct string *s, *n;
int i;
- for (i = 0; i < tp->view.rows - 2; i++)
+ for (i = 0; i < tty3270_tty_rows(tp); i++)
tp->screen[i].len = 0;
tp->nr_up = 0;
list_for_each_entry_safe(s, n, &tp->lines, list) {
int nr_up;
spin_lock_irq(&tp->view.lock);
- nr_up = tp->nr_up - tp->view.rows + 2;
+ nr_up = tp->nr_up - tp->view.rows + TTY3270_INPUT_AREA_ROWS;
if (nr_up < 0)
nr_up = 0;
if (nr_up != tp->nr_up) {
int nr_up;
spin_lock_irq(&tp->view.lock);
- nr_up = tp->nr_up + tp->view.rows - 2;
- if (nr_up + tp->view.rows - 2 > tp->nr_lines)
- nr_up = tp->nr_lines - tp->view.rows + 2;
+ nr_up = tp->nr_up + tty3270_tty_rows(tp);
+ if (nr_up + tty3270_tty_rows(tp) > tp->nr_lines)
+ nr_up = tp->nr_lines - tp->view.rows + TTY3270_INPUT_AREA_ROWS;
if (nr_up != tp->nr_up) {
tp->nr_up = nr_up;
tty3270_rebuild_update(tp);
free_string(&tp->freemem, tp->status);
tty3270_create_prompt(tp);
tty3270_create_status(tp);
- while (tp->nr_lines < tp->view.rows - 2)
+ while (tp->nr_lines < tty3270_tty_rows(tp))
tty3270_blank_line(tp);
tp->update_flags = TTY_UPDATE_ALL;
spin_unlock_irq(&tp->view.lock);
tty = tty_port_tty_get(&tp->port);
if (!tty)
return;
- ws.ws_row = tp->view.rows - 2;
+ ws.ws_row = tty3270_tty_rows(tp);
ws.ws_col = tp->view.cols;
tty_do_resize(tty, &ws);
tty_kref_put(tty);
tty3270_update_status(tp);
/* Create blank line for every line in the tty output area. */
- for (i = 0; i < tp->view.rows - 2; i++)
+ for (i = 0; i < tty3270_tty_rows(tp); i++)
tty3270_blank_line(tp);
tp->kbd->port = &tp->port;
tp->inattr = TF_INPUT;
}
- tty->winsize.ws_row = tp->view.rows - 2;
+ tty->winsize.ws_row = tty3270_tty_rows(tp);
tty->winsize.ws_col = tp->view.cols;
rc = tty_port_install(&tp->port, driver, tty);
if (rc) {
/* Determine how long the fragment will be. */
flen = tty3270_required_length(tp, line_nr);
/* Find the line in the list. */
- i = tp->view.rows - 2 - line_nr;
+ i = tty3270_tty_rows(tp) - line_nr;
list_for_each_entry_reverse(s, &tp->lines, list)
if (--i <= 0)
break;
tty3270_reset_attributes(&attr);
cp = tty3270_add_attributes(line, &attr, s->string);
cp = tty3270_add_reset_attributes(tp, line, cp, &attr);
- if (tp->nr_up + line_nr < tp->view.rows - 2) {
+ if (tp->nr_up + line_nr < tty3270_tty_rows(tp)) {
/* Line is currently visible on screen. */
tty3270_update_string(tp, s, line_nr);
/* Add line to update list. */
int i;
tty3270_convert_line(tp, tp->cy);
- if (tp->cy < tp->view.rows - 3) {
+ if (tp->cy < tty3270_tty_rows(tp) - 1) {
tp->cy++;
return;
}
tty3270_blank_line(tp);
temp = tp->screen[0];
temp.len = 0;
- for (i = 0; i < tp->view.rows - 3; i++)
+ for (i = 0; i < tty3270_tty_rows(tp) - 1; i++)
tp->screen[i] = tp->screen[i+1];
- tp->screen[tp->view.rows - 3] = temp;
+ tp->screen[tty3270_tty_rows(tp) - 1] = temp;
tty3270_rebuild_update(tp);
}
case 0:
tty3270_erase_line(tp, 0);
start = tp->cy + 1;
- end = tp->view.rows - 2;
+ end = tty3270_tty_rows(tp);
break;
case 1:
start = 0;
break;
case 2:
start = 0;
- end = tp->view.rows - 2;
+ end = tty3270_tty_rows(tp);
break;
default:
return;
line->len++;
}
- cy = min_t(int, tp->view.rows - 3, max_cy);
+ cy = min_t(int, tty3270_tty_rows(tp) - 1, max_cy);
if (cy != tp->cy) {
tty3270_convert_line(tp, tp->cy);
tp->cy = cy;
tty3270_reset_attributes(&tp->attributes);
tty3270_reset_attributes(&tp->saved_attributes);
tty3270_blank_screen(tp);
- while (tp->nr_lines < tp->view.rows - 2)
+ while (tp->nr_lines < tty3270_tty_rows(tp))
tty3270_blank_line(tp);
tp->update_flags = TTY_UPDATE_ALL;
spin_unlock_irq(&tp->view.lock);