Changeset 801b7ac
- Timestamp:
- Feb 6, 2007, 6:05:13 PM (16 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 7a20e4c
- Parents:
- 2566560
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
fmtext.c
r0331c8f r801b7ac 239 239 fg = f->fgcolorbuff[position]; 240 240 bg = f->bgcolorbuff[position]; 241 owl_function_debugmsg("waddstr: fg(%i) bg(%i).", fg, bg);242 241 243 242 pair = owl_fmtext_get_colorpair(fg, bg); … … 696 695 { 697 696 owl_colorpair_mgr *cpmgr; 698 short pair, i,default_bg;697 short pair, default_bg; 699 698 700 699 #ifdef HAVE_USE_DEFAULT_COLORS -
functions.c
r29ebcea r801b7ac 1273 1273 int owl_function_calculate_topmsg_normal(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines) 1274 1274 { 1275 int savey, j,i, foo, y;1275 int savey, i, foo, y; 1276 1276 1277 1277 if (curmsg<0) return(topmsg); … … 1282 1282 } 1283 1283 1284 /* Find number of lines from top to bottom of curmsg (store in savey) */ 1285 savey=0; 1286 for (i=topmsg; i<=curmsg; i++) { 1287 savey+=owl_message_get_numlines(owl_view_get_element(v, i)); 1284 /* If curmsg is so far past topmsg that there are more messages than 1285 lines, skip the line counting that follows because we're 1286 certainly off screen. */ 1287 savey=curmsg-topmsg; 1288 if (savey <= recwinlines) { 1289 /* Find number of lines from top to bottom of curmsg (store in savey) */ 1290 savey = 0; 1291 for (i=topmsg; i<=curmsg; i++) { 1292 savey+=owl_message_get_numlines(owl_view_get_element(v, i)); 1293 } 1288 1294 } 1289 1295 … … 1292 1298 if (savey > recwinlines) { 1293 1299 topmsg=curmsg; 1294 savey=owl_message_get_numlines(owl_view_get_element(v, i));1300 savey=owl_message_get_numlines(owl_view_get_element(v, curmsg)); 1295 1301 direction=OWL_DIRECTION_UPWARDS; 1296 1302 } … … 1300 1306 if (savey < (recwinlines / 4)) { 1301 1307 y=0; 1302 for ( j=curmsg; j>=0; j--) {1303 foo=owl_message_get_numlines(owl_view_get_element(v, j));1308 for (i=curmsg; i>=0; i--) { 1309 foo=owl_message_get_numlines(owl_view_get_element(v, i)); 1304 1310 /* will we run the curmsg off the screen? */ 1305 1311 if ((foo+y) >= recwinlines) { 1306 j++;1307 if ( j>curmsg) j=curmsg;1312 i++; 1313 if (i>curmsg) i=curmsg; 1308 1314 break; 1309 1315 } … … 1312 1318 if (y > (recwinlines / 2)) break; 1313 1319 } 1314 if ( j<0) j=0;1315 return( j);1320 if (i<0) i=0; 1321 return(i); 1316 1322 } 1317 1323 } … … 1322 1328 y=0; 1323 1329 /* count lines from the top until we can save 1/2 the screen size */ 1324 for ( j=topmsg; j<curmsg; j++) {1325 y+=owl_message_get_numlines(owl_view_get_element(v, j));1330 for (i=topmsg; i<curmsg; i++) { 1331 y+=owl_message_get_numlines(owl_view_get_element(v, i)); 1326 1332 if (y > (recwinlines / 2)) break; 1327 1333 } 1328 if ( j==curmsg) {1329 j--;1334 if (i==curmsg) { 1335 i--; 1330 1336 } 1331 return( j+1);1337 return(i+1); 1332 1338 } 1333 1339 } -
view.c
rf1e629d r801b7ac 97 97 int owl_view_get_nearest_to_msgid(owl_view *v, int targetid) 98 98 { 99 int i, bestdist=-1, bestpos=0, curid, curdist;99 int first, last, mid = 0, max, bestdist, curid = 0; 100 100 101 for (i=0; i<owl_view_get_size(v); i++) { 102 curid = owl_message_get_id(owl_view_get_element(v, i)); 103 curdist = abs(targetid-curid); 104 if (bestdist<0 || curdist<bestdist) { 105 bestdist = curdist; 106 bestpos = i; 101 first = 0; 102 last = max = owl_view_get_size(v) - 1; 103 while (first <= last) { 104 mid = (first + last) / 2; 105 curid = owl_message_get_id(owl_view_get_element(v, mid)); 106 if (curid == targetid) { 107 return(mid); 108 } else if (curid < targetid) { 109 first = mid + 1; 110 } else { 111 last = mid - 1; 107 112 } 108 113 } 109 return (bestpos); 114 bestdist = abs(targetid-curid); 115 if (curid < targetid && mid+1 < max) { 116 curid = owl_message_get_id(owl_view_get_element(v, mid+1)); 117 mid = (bestdist < abs(targetid-curid)) ? mid : mid+1; 118 } 119 else if (curid > targetid && mid-1 >= 0) { 120 curid = owl_message_get_id(owl_view_get_element(v, mid-1)); 121 mid = (bestdist < abs(targetid-curid)) ? mid : mid-1; 122 } 123 return mid; 110 124 } 111 125
Note: See TracChangeset
for help on using the changeset viewer.