vt: fix backup/forward after resize
This commit is contained in:
parent
b74ce50a1c
commit
03bcc1520a
2 changed files with 9 additions and 14 deletions
|
@ -54,7 +54,7 @@ extern void ringbell(void);
|
||||||
extern int number(Rune *, int *);
|
extern int number(Rune *, int *);
|
||||||
extern void shift(int,int,int,int);
|
extern void shift(int,int,int,int);
|
||||||
extern void scroll(int,int,int,int);
|
extern void scroll(int,int,int,int);
|
||||||
extern void backup(int);
|
extern int backup(int);
|
||||||
extern void sendnchars(int, char *);
|
extern void sendnchars(int, char *);
|
||||||
extern Point pt(int, int);
|
extern Point pt(int, int);
|
||||||
extern Point pos(Point);
|
extern Point pos(Point);
|
||||||
|
|
|
@ -58,7 +58,6 @@ char *menutext3[] = {
|
||||||
int x, y; /* character positions */
|
int x, y; /* character positions */
|
||||||
Rune *backp;
|
Rune *backp;
|
||||||
int backc;
|
int backc;
|
||||||
int atend;
|
|
||||||
int nbacklines;
|
int nbacklines;
|
||||||
int xmax, ymax;
|
int xmax, ymax;
|
||||||
int blocked;
|
int blocked;
|
||||||
|
@ -1142,18 +1141,13 @@ readmenu(void)
|
||||||
|
|
||||||
switch(menuhit(2, mc, &menu2, nil)) {
|
switch(menuhit(2, mc, &menu2, nil)) {
|
||||||
case Mbackup: /* back up */
|
case Mbackup: /* back up */
|
||||||
if(atend == 0){
|
if(backup(backc+1))
|
||||||
backc++;
|
backc++;
|
||||||
backup(backc);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Mforward: /* move forward */
|
case Mforward: /* move forward */
|
||||||
backc--;
|
if(backc > 0)
|
||||||
if(backc >= 0)
|
backup(--backc);
|
||||||
backup(backc);
|
|
||||||
else
|
|
||||||
backc = 0;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Mreset: /* reset */
|
case Mreset: /* reset */
|
||||||
|
@ -1183,11 +1177,11 @@ readmenu(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
backup(int count)
|
backup(int count)
|
||||||
{
|
{
|
||||||
Rune *cp;
|
Rune *cp;
|
||||||
int n;
|
int left, n;
|
||||||
|
|
||||||
unselect();
|
unselect();
|
||||||
|
|
||||||
|
@ -1200,13 +1194,13 @@ backup(int count)
|
||||||
nbacklines = ymax-1;
|
nbacklines = ymax-1;
|
||||||
}
|
}
|
||||||
cp = histp;
|
cp = histp;
|
||||||
atend = 0;
|
left = 1;
|
||||||
while (n >= 0) {
|
while (n >= 0) {
|
||||||
cp--;
|
cp--;
|
||||||
if(cp < hist)
|
if(cp < hist)
|
||||||
cp = &hist[HISTSIZ-1];
|
cp = &hist[HISTSIZ-1];
|
||||||
if(*cp == '\0') {
|
if(*cp == '\0') {
|
||||||
atend = 1;
|
left = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(*cp == '\n')
|
if(*cp == '\n')
|
||||||
|
@ -1216,6 +1210,7 @@ backup(int count)
|
||||||
if(cp >= &hist[HISTSIZ])
|
if(cp >= &hist[HISTSIZ])
|
||||||
cp = hist;
|
cp = hist;
|
||||||
backp = cp;
|
backp = cp;
|
||||||
|
return left;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point
|
Point
|
||||||
|
|
Loading…
Reference in a new issue