/*************************************************************************
* This program is copyright (C) 1985, 1986 by Jonathan Payne. It is *
* provided to you without charge for use only on a licensed Unix *
* system. You may copy JOVE provided that this notice is included with *
* the copy. You may not sell copies of this program or versions *
* modified for use on microcomputer systems, unless the copies are *
* included with a Unix system distribution and the source is provided. *
*************************************************************************/
int MarksShouldFloat
= 1;
MakeMark(line
, column
, type
)
register Mark
*newmark
= (Mark
*) emalloc(sizeof *newmark
);
MarkSet(newmark
, line
, column
);
newmark
->m_next
= curbuf
->b_marks
;
newmark
->m_floater
= type
;
curbuf
->b_marks
= newmark
;
register Mark
*mp
= curbuf
->b_marks
;
curbuf
->b_marks
= m
->m_next
;
while (mp
!= 0 && mp
->m_next
!= m
)
complain("Unknown mark!");
for (mp
= b
->b_marks
; mp
!= 0; mp
= mp
->m_next
)
if (curbuf
->b_markring
[(curbuf
->b_themark
+ 1) % NMARKS
] == 0) {
pmark
= curbuf
->b_themark
;
} while (curbuf
->b_markring
[pmark
] != 0);
curbuf
->b_markring
[pmark
] = MakeMark(curline
, curchar
, MarksShouldFloat
);
pmark
= curbuf
->b_themark
- 1;
curbuf
->b_themark
= pmark
;
DoSetMark(curline
, curchar
);
curbuf
->b_themark
= (curbuf
->b_themark
+ 1) % NMARKS
;
curmark
= MakeMark(l
, c
, MarksShouldFloat
);
s_mess("[Point pushed]");
DotTo(m
->m_line
, m
->m_char
);
if (curchar
> (len
= length(curline
)))
MarkSet(m
, mline
, mchar
);
/* Fix marks for after a deletion. For now, even marks that don't
float will actually float, because we can't allow marks to point
to non-existant lines. */
DFixMarks(line1
, char1
, line2
, char2
)
if (curbuf
->b_marks
== 0)
while (lp
!= line2
->l_next
) {
for (m
= curbuf
->b_marks
; m
!= 0; m
= m
->m_next
) {
for (m
= curbuf
->b_marks
; m
; m
= m
->m_next
) {
if ((m
->m_char
& (1 << 15)) == 0)
continue; /* Not effected */
if (m
->m_line
== line1
&& m
->m_char
< char1
)
continue; /* This mark is not affected */
if (m
->m_char
>= char1
&& m
->m_char
<= char2
)
else if (m
->m_char
> char2
)
m
->m_char
-= (char2
- char1
);
/* Same line move the mark backward */
} else if (m
->m_line
== line2
) {
m
->m_char
= char1
+ (m
->m_char
- char2
);
/* Fix marks after an insertion. Marks that don't float are ignored
on insertion, which means PtToMark has to be careful ... */
IFixMarks(line1
, char1
, line2
, char2
)
for (m
= curbuf
->b_marks
; m
!= 0; m
= m
->m_next
) {
if (m
->m_line
== line1
) {
m
->m_char
+= (char2
- char1
);
m
->m_char
= char2
+ (m
->m_char
- char1
);