summary refs log tree commit diff
path: root/doc.c
diff options
context:
space:
mode:
Diffstat (limited to 'doc.c')
-rw-r--r--doc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc.c b/doc.c
index d41db7c..38b4802 100644
--- a/doc.c
+++ b/doc.c
@@ -71,6 +71,14 @@ struct doc_line *doc_line_at(struct doc *d, size_t ofs) {
 	return (struct doc_line *)&d->txt.buf[ofs];
 }
 
+int doc_line_nextp(struct doc *d, size_t ofs) {
+	return ofs + doc_line_at(d, ofs)->len + sizeof(struct doc_line) < d->txt.sz;
+}
+
+int doc_line_prevp(struct doc *d, size_t ofs) {
+	return ofs >= doc_line_at(d, ofs)->prev + sizeof(struct doc_line);
+}
+
 int doc_line_prev(struct doc *d, size_t *ofs) {
 	size_t n = doc_line_at(d, *ofs)->prev + sizeof(struct doc_line);
 	if (*ofs >= n) {