[Pinfo-devel] r172 - pinfo/branches/cxx/src

Nathanael Nerode neroden-guest at costa.debian.org
Tue Sep 6 11:37:20 UTC 2005


Author: neroden-guest
Date: 2005-09-06 11:37:19 +0000 (Tue, 06 Sep 2005)
New Revision: 172

Modified:
   pinfo/branches/cxx/src/mainfunction.cxx
   pinfo/branches/cxx/src/video.cxx
   pinfo/branches/cxx/src/video.h
Log:
...and remove separate tracking of message length in video.cxx.


Modified: pinfo/branches/cxx/src/mainfunction.cxx
===================================================================
--- pinfo/branches/cxx/src/mainfunction.cxx	2005-09-06 11:33:15 UTC (rev 171)
+++ pinfo/branches/cxx/src/mainfunction.cxx	2005-09-06 11:37:19 UTC (rev 172)
@@ -181,10 +181,10 @@
 			if (statusline == FREE) {
 				/* Quick conversion to vector.  Temporary, FIXME. */
 				vector<char *> my_message;
-				for (int x = 0; x < Lines; x++) {
+				for (typeof(my_message.size()) x = 0; x < Lines; x++) {
 					my_message.push_back(Message[x]);
 				}
-				showscreen(my_message, Lines, pos, cursor,infocolumn);
+				showscreen(my_message, pos, cursor, infocolumn);
 			}
 			waitforgetch();
 			key = pinfo_getch();

Modified: pinfo/branches/cxx/src/video.cxx
===================================================================
--- pinfo/branches/cxx/src/video.cxx	2005-09-06 11:33:15 UTC (rev 171)
+++ pinfo/branches/cxx/src/video.cxx	2005-09-06 11:37:19 UTC (rev 172)
@@ -27,7 +27,7 @@
 #include <vector>
 using std::vector;
 
-void info_add_highlights(int pos, int cursor, long lines, int column, vector <char *> message);
+void info_add_highlights(int pos, int cursor, int column, vector <char *> message);
 
 /*
  * Replace first occurence of substring in string.
@@ -70,7 +70,7 @@
 }
 
 void
-showscreen(vector <char *> message, long lines, long pos, long cursor, int column)
+showscreen(vector <char *> message, long pos, long cursor, int column)
 {
 	long i;
 #ifdef getmaxyx
@@ -80,7 +80,7 @@
 	bkgdset(' ' | normal);
 #endif
 	attrset(normal);
-	for (i = pos;(i < lines) &&(i < pos + maxy - 2); i++)
+	for (i = pos;(i < message.size()) &&(i < pos + maxy - 2); i++)
 	{
 		if (!message[i]) continue;
 
@@ -104,11 +104,12 @@
 	attrset(bottomline);
 	mymvhline(maxy - 1, 0, ' ', maxx);
 	move(maxy - 1, 0);
-	if ((pos < lines - 1) &&(lines > pos + maxy - 2))
-		printw(_("Viewing line %d/%d, %d%%"), pos + maxy - 2, lines,((pos + maxy - 2) * 100) / lines);
+	if ((pos < message.size() - 1) &&(message.size() > pos + maxy - 2))
+		printw(_("Viewing line %d/%d, %d%%"), pos + maxy - 2,
+		       message.size(), ((pos + maxy - 2) * 100) / message.size());
 	else
-		printw(_("Viewing line %d/%d, 100%%"), lines, lines);
-	info_add_highlights(pos, cursor, lines, column, message);
+		printw(_("Viewing line %d/%d, 100%%"), message.size(), message.size());
+	info_add_highlights(pos, cursor, column, message);
 	attrset(normal);
 	move(0, 0);
 	refresh();
@@ -143,7 +144,7 @@
 }
 
 void
-info_add_highlights(int pos, int cursor, long lines, int column, vector <char *> message)
+info_add_highlights(int pos, int cursor, int column, vector <char *> message)
 {
 	for (typeof(hyperobjects.size()) i = 0; i < hyperobjects.size(); i++) {
 		if ((hyperobjects[i].line < pos) ||
@@ -212,8 +213,8 @@
 	{
 		regmatch_t pmatch[1];
 		long maxpos = pos +(maxy - 2);
-		if (maxpos > lines)
-			maxpos = lines;
+		if (maxpos > message.size())
+			maxpos = message.size();
 		for (int i = pos; i < maxpos; i++)
 		{
 			int maxregexp = aftersearch ? h_regexp_num + 1 : h_regexp_num;

Modified: pinfo/branches/cxx/src/video.h
===================================================================
--- pinfo/branches/cxx/src/video.h	2005-09-06 11:33:15 UTC (rev 171)
+++ pinfo/branches/cxx/src/video.h	2005-09-06 11:37:19 UTC (rev 172)
@@ -25,7 +25,7 @@
 #define __VIDEO_H
 #include <string>
 /* paints the screen while viewing info file */
-void showscreen (std::vector<char *> message, long lines, long pos,
+void showscreen (std::vector<char *> message, long pos,
 		long cursor, int column);
 /* prints unselected menu option */
 void mvaddstr_menu (int y, int x, char *line, int linenumber);




More information about the Pinfo-devel mailing list