shithub: Nail

Download patch

ref: f15f4664195c86c3a732fc69573b3341c18fbb02
parent: 0bc32c98a7362dff162ba782323bfa68484545f3
author: Ori Bernstein <[email protected]>
date: Thu Nov 5 13:26:00 EST 2020

fix off by one in line number calculation

--- a/mbox.c
+++ b/mbox.c
@@ -120,8 +120,8 @@
 	int i, o, n, d;
 
 	o = 0;
-	n = 0;
 	d = 0;
+	n = 1;
 	r = msg;
 	if(msg->parent != nil) {
 		m = msg->parent;
@@ -128,7 +128,7 @@
 		for(i = 0; i < m->nchild; i++){
 			if(m->child[i] == msg)
 				break;
-			o += m->child[i]->nsub;
+			o += m->child[i]->nsub + 1;
 		}
 	}
 	while(r->parent != nil){
@@ -150,7 +150,7 @@
 	if(depth != nil)
 		*depth = d;
 	assert(n + o < mbox.nmesg);
-	return n + o + 1;
+	return n + o;
 }
 
 static int