/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/* Copyright (c) 1981 Regents of the University of California */
#include "ex.h"
#include "ex_tty.h"
#include "ex_vis.h"
/*
* Routines to adjust the window, showing specified lines
* in certain positions on the screen, and scrolling in both
* directions. Code here is very dependent on mode (open versus visual).
*/
/*
* Move in a nonlocal way to line addr.
* If it isn't on screen put it in specified context.
* New position for cursor is curs.
* Like most routines here, we vsave().
*/
void
unsigned char *curs;
unsigned char context;
{
vsave();
}
/*
* Vjumpto is like vmoveto, but doesn't mark previous
* context or save linebuf as current line.
*/
void
{
noteit(0);
if (context != 0)
else
noteit(1);
}
/*
* Go up or down cnt (negative is up) to new position curs.
*/
void
{
if (cnt > 0)
else if (cnt < 0)
if (vcnt == 0)
else
}
/*
* Go up cnt lines, afterwards preferring to be ind
* logical lines from the top of the screen.
* If scroll, then we MUST use a scroll.
* Otherwise clear and redraw if motion is far.
*/
void
{
int i, tot;
(void) beep();
return;
}
vsave();
i = lineDOT() - 1;
if (cnt > i) {
if (ind < 0)
ind = 0;
cnt = i;
}
return;
}
goto contxt;
goto okr;
if (state != VISUAL || (!insert_line && !scroll_reverse) || (!scroll && (cnt > tot || vfit(dot - cnt, cnt) > tot / 3 + 1))) {
return;
}
okr:
if (scroll) {
getDOT();
}
}
/*
* Like vup, but scrolling down.
*/
void
{
int i, tot;
(void) beep();
return;
}
vsave();
if (cnt > i) {
if (ind < 0)
ind = 0;
cnt = i;
}
return;
}
goto dcontxt;
if (!scroll) {
return;
}
}
if (cnt > 0)
if (vcline < 0)
getDOT();
}
}
/*
* Show line addr in context where on the screen.
* Work here is in determining new top line implied by
* this placement of line addr, since we always draw from the top.
*/
void
{
else switch (where) {
case '^':
/* fall into ... */
case '-':
break;
case '.':
break;
default:
break;
}
vup1();
vclean();
vup1();
}
/*
* Get a clean line. If we are in a hard open
* we may be able to reuse the line we are on
* if it is blank. This is a real win.
*/
void
vclean(void)
{
destcol = 0;
if (!ateopr())
vup1();
vcnt = 0;
}
}
/*
* Show line addr with the specified top line on the screen.
* Top may be 0; in this case have vcontext compute the top
* (and call us recursively). Eventually, we clear the screen
* (or its open mode equivalent) and redraw.
*/
void
{
#ifndef CBREAK
bool fried = 0;
#endif
getDOT();
vcline = i;
return;
}
return;
}
if (top == 0) {
return;
}
#ifndef CBREAK
if (vcookit(2))
#endif
vclear();
vreset(0);
/* error if vcline >= vcnt ! */
getDOT();
#ifndef CBREAK
if (fried)
#endif
}
/*
* reset the state.
* If inecho then leave us at the beginning of the echo
* area; we are called this way in the middle of a :e escape
* from visual, e.g.
*/
void
{
if (inecho)
}
/*
* Starting from which line preceding tp uses almost (but not more
* than) cnt physical lines?
*/
line *
int cnt;
{
int d;
if (cnt > 0)
d = vdepth();
if (d > cnt)
break;
cnt -= d;
}
return (tp);
}
/*
* How much scrolling will it take to roll cnt lines starting at tp?
*/
int
{
int j;
j = 0;
while (cnt > 0) {
cnt--;
j += vdepth();
}
return (j);
}
/*
* Roll cnt lines onto the screen.
*/
void
{
#ifndef CBREAK
bool fried = 0;
#endif
#ifdef ADEBUG
if (trace)
#endif
vcnt = 0;
vup1();
}
#ifndef CBREAK
#endif
vscrap();
}
sethard();
vsyncCL();
#ifndef CBREAK
if (fried)
#endif
}
/*
* Roll backwards (scroll up).
*/
void
{
bool fried = 0;
#ifdef ADEBUG
if (trace)
#endif
#ifndef CBREAK
#endif
vcnt = 0;
heldech = 0;
dot--;
vscrap();
}
if (heldech)
vclrech(0);
#ifndef CBREAK
if (fried)
#endif
}
/*
* Go into cooked mode (allow interrupts) during
* a scroll if we are at less than 1200 baud and not
* a 'vi' command, of if we are in a 'vi' command and the
* scroll is more than 2 full screens.
*
* BUG: An interrupt during a scroll in this way
* dumps to command mode.
*/
int
{
}
/*
* Determine displayed depth of current line.
*/
int
vdepth(void)
{
int d;
#ifdef ADEBUG
if (trace)
#endif
return (d == 0 ? 1 : d);
}
/*
* Move onto a new line, with cursor at position curs.
*/
void
{
unsigned char *owcursor;
int j;
if (curs) {
if(!*linebuf)
else {
}
} else {
}
}
} else if (vmoving)
else
(void) vmove();
}