forked from zuberfowler/zedit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EXCRDSP.C
86 lines (79 loc) · 2.88 KB
/
EXCRDSP.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "zedit.h"
void excrdsp(
union both_scr *posptr,
register struct bufline *ptr)
/**********************************************************************/
/* */
/* Redisplay an excluded line whose pointer is passed as a parameter. */
/* */
/**********************************************************************/
/* */
/* This is ZEDIT source material. */
/* */
/* ZEDIT Source Materials are intellectual property */
/* (c) Copyright 1987,2001 by Clyde Thomas Zuber. */
/* */
/**********************************************************************/
{
register struct bufline *pos;
register struct bufline *oldbot;
struct bufline *oldtop;
int n;
n = 0;
for (pos = ptr -> prev; pos -> status != ST_BYPS; pos = pos -> prev)
++n;
oldtop = pos;
oldbot = pos -> eblk;
if (n)
/* lines still to be excluded above redisplay line */
if (ptr -> next != oldbot)
{
/* create new XBLK record for exclude above redisplay */
pos = protlin(posptr, ptr, sizeof(struct bufline));
pos -> status |= ST_XBLK;
pos -> rcnt = n;
pos -> bblk = oldtop;
excxblk(pos);
oldtop -> eblk = pos;
/* create new BYPS record for exclude below redisplay */
pos = protlin(posptr, ptr -> next, sizeof(struct bufline_hdr) +
sizeof(char [2]) + sizeof(struct bufline *));
pos -> status |= ST_BYPS;
pos -> bline[0] = '\n';
pos -> bline[1] = '\0';
pos -> eblk = oldbot;
oldbot -> bblk = pos;
oldbot -> rcnt -= (n + 1);
excxblk(oldbot);
} /* end then */
else
{
/* move the XBLK record above redisplay line */
ptr -> prev -> next = oldbot;
oldbot -> prev = ptr -> prev;
ptr -> next = oldbot -> next;
oldbot -> next -> prev = ptr;
oldbot -> next = ptr;
ptr -> prev = oldbot;
--(oldbot -> rcnt);
excxblk(oldbot);
} /* end else, then */
else
/* BYPS is immediately above redisplay line */
if (ptr -> next != oldbot)
{
/* move the BYPS record after redisplay line */
pos -> prev -> next = ptr;
pos -> next = ptr -> next;
ptr -> next -> prev = pos;
ptr -> prev = pos -> prev;
pos -> prev = ptr;
ptr -> next = pos;
--(oldbot -> rcnt);
excxblk(oldbot);
} /* end then */
else
/* no lines remain to be excluded */
excremv(pos, &n);
ptr -> status ^= ST_EXCL;
} /* end excrdsp */