Article View: net.bugs.usg
Article #47System V.2 Curses Bug #2
From: Mike Laman
Date: Fri, 10 Aug 1984 23:44
Date: Fri, 10 Aug 1984 23:44
47 lines
3027 bytes
3027 bytes
A call from "mvcur()" to "_loc_down()" can generate incorrect cursor motion
under the following circumstances:
1. ONLCR is set in the user's terminal modes,
2. "cursor_down=^J" in the terminfo information, and
3. "cursor_down" is the "optimal" move chosen by "mvcur()"
(easily accomplished with a simple terminfo entry with NO absolute
cursor addressing).
If "mvcur()" is called and it is desired to move the cursor such that
"_loc_down(2, 3, 1, 0)" is called (I'm sure other situations can be generated
so restriction #3 won't be needed, but that's beside the point.),
"cursor_down", namely '^J' is outputted. Since ONLCR is set, a newline and
form feed are echoed just as the tty driver should do. "_loc_down()" properly
figures out that we are not at the beginning of the line (i.e. we are now at
column number 0). That's fine, but "mvcur()" doesn't know the column number
has been changed! More specifically, "oldcol" in "mvcur()" is still 3.
So in the "local motions are cheapest" section near the end of "mvcur()",
"_loc_left()" is called, and the cursor gets moved back a few spaces in its
attempt to get the cursor to column #0 (but this ends up walking back a few
columns on the end of the previous line on my terminal since my terminal has
"auto_left_margin" (i.e. bw)). This extra backing up of the cursor is caused
by the intelligent cursor movement by "_loc_down()" not being communicated
back up to "mvcur()".
There seem to be two plausible solutions of "mvcur()" not knowing about
"_loc_down()"'s possible changing of the cursor's actual column number, namely:
1. Let "mvcur()" know about it. [ This is the route I chose. ]
Since "_loc_down()" already has the logic, we might as well
use it. Have "mvcur()" pass the address of "oldcol" as
another argument to "_loc_down()", and have "_loc_down()"
change it when the situation occurs. [ Now the call to
"_loc_left()" will immediately return seeing that we are
already on the desired column, namely column #0. ]
[ Sorry, but the sources are not on this system, so I can't
include any diffs here. ]
2. Don't allow "_loc_down()" to make any changes that would affect
the cursor's column number.
Drop "col" as an argument to "_loc_down()", its references
in "_loc_down()", and the argument on all "_loc_down()" calls.
Mike Laman, NCR @ Torrey Pines
UUCP: {ucbvax,philabs,sdcsla}!sdcsvax!laman
Technical Details
Message-ID:
<1113@sdcsvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!cornell!uw-beaver!tektronix!hplabs!sdcrdcf!sdcsvax!lamanShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site sdcsvax.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!cornell!uw-beaver!tektronix!hplabs!sdcrdcf!sdcsvax!laman From: laman@sdcsvax.UUCP (Mike Laman) Newsgroups: net.bugs.usg Subject: System V.2 Curses Bug #2 Message-ID: <1113@sdcsvax.UUCP> Date: Fri, 10-Aug-84 19:44:05 EDT Article-I.D.: sdcsvax.1113 Posted: Fri Aug 10 19:44:05 1984 Date-Received: Mon, 13-Aug-84 00:16:23 EDT Organization: EECS Dept. U.C. San Diego Lines: 47