- General - New flag RELATIVECHARS to show column positino relative to the current line instead of the current file.  New flag -C, --relative, changes to do_cursorpos()


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1046 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
diff --git a/winio.c b/winio.c
index 38824d0..e685e2d 100644
--- a/winio.c
+++ b/winio.c
@@ -1586,32 +1586,47 @@
 {
     filestruct *fileptr;
     float linepct = 0.0, bytepct = 0.0;
-    long i = 0;
+    long i = 0, j = 0;
     static long old_i = -1, old_totsize = -1;
 
     if (current == NULL || fileage == NULL)
 	return 0;
 
-    for (fileptr = fileage; fileptr != current && fileptr != NULL;
-	 fileptr = fileptr->next)
-	i += strlen(fileptr->data) + 1;
-
-    if (fileptr == NULL)
-	return -1;
-
-    i += current_x;
-
     if (old_i == -1)
 	old_i = i;
 
     if (old_totsize == -1)
 	old_totsize = totsize;
 
-    if (totlines > 0)
-	linepct = 100 * current->lineno / totlines;
+    if (ISSET(RELATIVECHARS)) {
 
-    if (totsize > 0)
-	bytepct = 100 * i / totsize;
+	if (strlen(current->data) == 0)
+	    bytepct = 0;
+	else
+	    bytepct = 100 * current_x / strlen(current->data);
+
+	old_i = -1;
+	i = current_x;
+	j = strlen(current->data);
+
+    } else {
+	for (fileptr = fileage; fileptr != current && fileptr != NULL;
+	     fileptr = fileptr->next)
+	    i += strlen(fileptr->data) + 1;
+
+	if (fileptr == NULL)
+	    return -1;
+
+	i += current_x;
+
+	j = totsize;
+
+	if (totsize > 0)
+	    bytepct = 100 * i / totsize;
+    }
+
+    if (totlines > 0)
+	 linepct = 100 * current->lineno / totlines;
 
 #ifdef DEBUG
     fprintf(stderr, _("do_cursorpos: linepct = %f, bytepct = %f\n"),
@@ -1624,7 +1639,7 @@
     if (!constant || (old_i != i || old_totsize != totsize)) {
 	statusbar(_
 		  ("line %d of %d (%.0f%%), character %ld of %ld (%.0f%%)"),
-		  current->lineno, totlines, linepct, i, totsize, bytepct);
+		  current->lineno, totlines, linepct, i, j, bytepct);
     }
 
     old_i = i;