[Pinfo-devel] r229 - pinfo/branches/cxx/src
Nathanael Nerode
neroden-guest at costa.debian.org
Sun Sep 25 23:31:17 UTC 2005
Author: neroden-guest
Date: 2005-09-25 23:31:16 +0000 (Sun, 25 Sep 2005)
New Revision: 229
Modified:
pinfo/branches/cxx/src/mainfunction.cxx
pinfo/branches/cxx/src/printinfo.cxx
pinfo/branches/cxx/src/video.cxx
Log:
Convert .line (in hyperlinks) to 0-based.
Modified: pinfo/branches/cxx/src/mainfunction.cxx
===================================================================
--- pinfo/branches/cxx/src/mainfunction.cxx 2005-09-25 21:47:10 UTC (rev 228)
+++ pinfo/branches/cxx/src/mainfunction.cxx 2005-09-25 23:31:16 UTC (rev 229)
@@ -136,12 +136,10 @@
/* initialize node-links for every line */
for (int i = 0; i < my_message.size() - 1; i++)
{
- /* Horrible conversion to 1-based index here. FIXME. */
- initializelinks(my_message[i], my_message[i + 1], i + 1);
+ initializelinks(my_message[i], my_message[i + 1], i);
}
- /* Horrible conversion to 1-based index here. FIXME. */
initializelinks(my_message[my_message.size() - 1],"",
- my_message.size());
+ my_message.size() - 1);
/* infomenu will remain -1 if it's the last pos, or if there's no menu item */
next_infomenu();
@@ -817,8 +815,8 @@
*/
for (int i = cursor - 1; i >= 0; i--)
{
- if ((hyperobjects[i].line >= pos) &&
- (hyperobjects[i].line < pos +(maxy - 1)))
+ if ((hyperobjects[i].line >= pos - 1) &&
+ (hyperobjects[i].line < pos - 1 +(maxy - 1)))
{
/* don't play with `highlight' objects */
if (hyperobjects[i].type < HIGHLIGHT)
@@ -837,7 +835,7 @@
/* and scan for a hyperlink in the new line */
for (typeof(hyperobjects.size()) i = 0;
i < hyperobjects.size(); i++) {
- if (hyperobjects[i].line == pos)
+ if (hyperobjects[i].line == pos - 1)
{
if (hyperobjects[i].type < HIGHLIGHT)
{
@@ -918,8 +916,8 @@
if (cursor < hyperobjects.size())
for (typeof(hyperobjects.size()) i = cursor + 1;
i < hyperobjects.size(); i++) {
- if ((hyperobjects[i].line >= pos) &&
- (hyperobjects[i].line < pos +(maxy - 2)))
+ if ((hyperobjects[i].line >= pos - 1) &&
+ (hyperobjects[i].line < pos - 1 +(maxy - 2)))
{
if (hyperobjects[i].type < HIGHLIGHT)
{
@@ -937,8 +935,8 @@
for (typeof(hyperobjects.size()) i = cursor + 1;
i < hyperobjects.size(); i++)
{
- if ((hyperobjects[i].line >= pos) &&
- (hyperobjects[i].line < pos +(maxy - 2)))
+ if ((hyperobjects[i].line >= pos - 1) &&
+ (hyperobjects[i].line < pos - 1 +(maxy - 2)))
{
if (hyperobjects[i].type < HIGHLIGHT)
{
@@ -992,8 +990,8 @@
if (!toggled_by_menu)
infohistory[infohistory.size() - 1].menu = cursor;
if ((cursor >= 0) && (cursor < hyperobjects.size()))
- if ((hyperobjects[cursor].line >= pos) &&
- (hyperobjects[cursor].line < pos +(maxy - 2)) ||
+ if ((hyperobjects[cursor].line >= pos - 1) &&
+ (hyperobjects[cursor].line < pos - 1 +(maxy - 2)) ||
(toggled_by_menu))
{
toggled_by_menu = 0;
@@ -1065,7 +1063,7 @@
{
for (typeof(hyperobjects.size()) i = cursor; i > 0; i--)
{
- if (hyperobjects[i].line == mouse.y + pos - 1)
+ if (hyperobjects[i].line == mouse.y + pos - 2)
{
if (hyperobjects[i].col <= mouse.x - 1)
{
@@ -1085,7 +1083,7 @@
for (typeof(hyperobjects.size()) i = cursor;
i < hyperobjects.size(); i++)
{
- if (hyperobjects[i].line == mouse.y + pos - 1)
+ if (hyperobjects[i].line == mouse.y + pos - 2)
{
if (hyperobjects[i].col <= mouse.x - 1)
{
@@ -1114,7 +1112,7 @@
/* signed/unsigned. Use iterators. FIXME. */
for (int i = cursor; i >= 0; i--)
{
- if (hyperobjects[i].line == mouse.y + pos - 1)
+ if (hyperobjects[i].line == mouse.y + pos - 2)
{
if (hyperobjects[i].col <= mouse.x - 1)
{
@@ -1134,7 +1132,7 @@
for (typeof(hyperobjects.size()) i = cursor;
i < hyperobjects.size(); i++)
{
- if (hyperobjects[i].line == mouse.y + pos - 1)
+ if (hyperobjects[i].line == mouse.y + pos - 2)
{
if (hyperobjects[i].col <= mouse.x - 1)
{
@@ -1198,8 +1196,8 @@
{
for (typeof(hyperobjects.size()) i = 0; i < hyperobjects.size(); i++)
{
- if ((hyperobjects[i].line >= pos) &&
- (hyperobjects[i].line < pos +(maxy - 2)))
+ if ((hyperobjects[i].line >= pos - 1) &&
+ (hyperobjects[i].line < pos - 1 +(maxy - 2)))
{
if (hyperobjects[i].type < HIGHLIGHT)
{
Modified: pinfo/branches/cxx/src/printinfo.cxx
===================================================================
--- pinfo/branches/cxx/src/printinfo.cxx 2005-09-25 21:47:10 UTC (rev 228)
+++ pinfo/branches/cxx/src/printinfo.cxx 2005-09-25 23:31:16 UTC (rev 229)
@@ -50,7 +50,7 @@
* Handle the highlights which belong to our (i'th) line.
*/
int highlight = 0; /* counter to track which highlights have been handled */
- while (hyperobjects[highlight].line <= i + 1) {
+ while (hyperobjects[highlight].line <= i) {
string mynode;
/* build a complete highlighted text */
if (hyperobjects[highlight].file[0] == 0)
@@ -62,7 +62,7 @@
mynode += hyperobjects[highlight].node;
}
/* if it's a contiunuation of last's line highlight */
- if (hyperobjects[highlight].line == i) {
+ if (hyperobjects[highlight].line == i - 1) {
int length = 1;
if (hyperobjects[highlight].breakpos == -1)
length = mynode.length() - hyperobjects[highlight].breakpos;
@@ -71,7 +71,7 @@
string::npos);
fputs(trimmed.c_str(), prnFD);
lineprinted += trimmed.length();
- } else if (hyperobjects[highlight].line == i + 1) {
+ } else if (hyperobjects[highlight].line == i) {
for (int j = 0; j < hyperobjects[highlight].col - lineprinted; j++)
fputc(' ', prnFD);
fputs(mynode.c_str(), prnFD);
Modified: pinfo/branches/cxx/src/video.cxx
===================================================================
--- pinfo/branches/cxx/src/video.cxx 2005-09-25 21:47:10 UTC (rev 228)
+++ pinfo/branches/cxx/src/video.cxx 2005-09-25 23:31:16 UTC (rev 229)
@@ -142,8 +142,8 @@
info_add_highlights(int pos, int cursor, int column, const vector <string> message)
{
for (typeof(hyperobjects.size()) i = 0; i < hyperobjects.size(); i++) {
- if ((hyperobjects[i].line < pos) ||
- (hyperobjects[i].line >= pos +(maxy - 2)))
+ if ((hyperobjects[i].line < pos - 1) ||
+ (hyperobjects[i].line >= pos - 1 +(maxy - 2)))
continue; /* Off screen */
/* first set of ifs sets the required attributes */
@@ -177,7 +177,7 @@
mynode += hyperobjects[i].node;
}
if (hyperobjects[i].breakpos == -1) {
- info_addstring(1 + hyperobjects[i].line - pos,
+ info_addstring(1 + hyperobjects[i].line + 1 - pos,
hyperobjects[i].col,
mynode,
column);
@@ -185,7 +185,7 @@
int j;
string part1, part2;
part1 = mynode.substr(0, hyperobjects[i].breakpos);
- info_addstring(1 + hyperobjects[i].line - pos,
+ info_addstring(1 + hyperobjects[i].line + 1 - pos,
hyperobjects[i].col,
part1,
column);
@@ -194,8 +194,8 @@
while (mynode[j] == ' ')
j++;
part2 = mynode.substr(j, string::npos);
- if (hyperobjects[i].line - pos + 3 < maxy)
- info_addstring(1 + hyperobjects[i].line - pos + 1,
+ if (hyperobjects[i].line + 1 - pos + 3 < maxy)
+ info_addstring(1 + hyperobjects[i].line + 1 - pos + 1,
j - hyperobjects[i].breakpos,
part2,
column);
More information about the Pinfo-devel
mailing list