[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
vpa - hpa
From: |
Philippe Blain |
Subject: |
vpa - hpa |
Date: |
Wed, 27 Aug 2003 21:21:36 +0200 |
>From Philippe Blain, Bordeaux, France.
My computer: P133 - 8,4 Go - 32 Mo Red Hat Linux 7.0
Subject: Corrections for ncurses-5.3-20030823+
1-----------------------------------------------------------------------
File : ncurses/tty/lib_mvcur.c
Using vpa/hpa in the function relative_move(), is a nonsense:
Column_address (hpa) or row_address (vpa) must be OUTSIDE relative_move()
and considered as a case in itself (tactic#6).
The reason why is that they give VERY OFTEN (but not always) the best cost
comparing with parm_down/parm_up , cursor_right/cursor_left, ... hiding them
and then the tactics #2,#3,#4,#5 become nothing else than
(special_case)+vpa/hpa where (special_case) is mostly useless (except
increasing the cost) as we use the absolute cursor addressing capabilities
of the terminal.
Proof, for linux we have :
hpa=\E[%i%p1%dG, vpa=\E[%i%p1%dd
cub1=^H, cud1=^J, cuf1=\E[C, cuu1=\E[A
ABSENT CAPS : cub, cud, cuf, cuu [parm_xxx_cursor]
vpa/hpa is MOSTLY choosen by relative_move() (shortest sequence) except
when the new point is close to the old one or the edges of screen.
In these cases, relative_move() without vpa/hpa is sufficient.
Moving to x=0,y=12 gives in most cases : (padding=2 or 0.2 msec)
tactic#0 [ 1 3 ; 1 H (cup) real_cost: 14
tactic#1 [ 1 3 d [ 1 G (vpa/hpa) real_cost: 18
tactic#2 [ 1 3 d ^[ [ 1 G (cr + vpa/hpa) real_cost: 20
tactic#3 [ H [ 1 3 d ^[ [ 1 G (home + vpa/hpa) real_cost: 24
tactic#4 no capability real_cost: 1000000
tactic#5 no capability real_cost: 1000000
Useless to do an action (cr/home/...anything) before absolute addressing.
That's why I suggest to put vpa/hpa outside relative_move() and use them
as a tactic (like cup).
Something like that :
/* move via (vpa/hpa) only */
static int absolute_addressing (string_desc * target, int from_y, int
from_x,
int to_y, int to_x)
{
string_desc save;
int vcost = 0, hcost = 0;
if (row_address && column_address) {
_nc_str_copy (&save, target);
if (to_y != from_y) {
vcost = INFINITY;
if (_nc_safe_strcat (target, tparm (row_address, to_y))) {
vcost = SP->_vpa_cost;
}
if (vcost == INFINITY) return (INFINITY);
}
save = *target; // same as _nc_str_copy (&save, target);
if (to_x != from_x) {
hcost = INFINITY;
if (_nc_safe_strcat
(_nc_str_copy (target, &save), tparm (column_address,
to_x))) {
hcost = SP->_hpa_cost;
}
if (hcost == INFINITY) return (INFINITY);
}
return (vcost + hcost);
}
else return (INFINITY);
}
------------------------------------------------------------------------
- Philippe
- vpa - hpa,
Philippe Blain <=