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

Nathanael Nerode neroden-guest at costa.debian.org
Mon Aug 29 05:08:43 UTC 2005


Author: neroden-guest
Date: 2005-08-29 05:08:42 +0000 (Mon, 29 Aug 2005)
New Revision: 70

Modified:
   pinfo/branches/cxx/src/initializelinks.cxx
   pinfo/branches/cxx/src/video.cxx
Log:
More low hanging fruit, and a comment.


Modified: pinfo/branches/cxx/src/initializelinks.cxx
===================================================================
--- pinfo/branches/cxx/src/initializelinks.cxx	2005-08-29 04:58:24 UTC (rev 69)
+++ pinfo/branches/cxx/src/initializelinks.cxx	2005-08-29 05:08:42 UTC (rev 70)
@@ -90,6 +90,8 @@
  * calculates the length of string between start and end, counting `\t' as
  * filling up to 8 chars. (i.e. at line 22 tab will increment the counter by 2
  * [8-(22-int(22/8)*8)] spaces)
+ *
+ * Bugs: this doesn't actually work.  FIXME.
  */
 int
 calculate_len(char *start, char *end)

Modified: pinfo/branches/cxx/src/video.cxx
===================================================================
--- pinfo/branches/cxx/src/video.cxx	2005-08-29 04:58:24 UTC (rev 69)
+++ pinfo/branches/cxx/src/video.cxx	2005-08-29 05:08:42 UTC (rev 70)
@@ -220,14 +220,13 @@
 					int n = pmatch[0].rm_eo - pmatch[0].rm_so;
 					int y = i - pos + 1;
 					int x = calculate_len(message[i], pmatch[0].rm_so + str);
-					int txtoffset = pmatch[0].rm_so + str - message[i];
-					char tmp;
-					tmp = message[i][x + n];
-					message[i][x + n] = 0;
+					int txtoffset = (str - message[i]) + pmatch[0].rm_so;
+					string tmpstr = message[i];
+					tmpstr.resize(x+n);
+					string tmpstr2 = tmpstr.substr(txtoffset);
 					attrset(searchhighlight);
-					mvaddstr(y, x, message[i] + txtoffset);
+					mvaddstr(y, x, tmpstr2.c_str());
 					attrset(normal);
-					message[i][x + n] = tmp;
 					str = str + pmatch[0].rm_eo;
 				}
 			}




More information about the Pinfo-devel mailing list