jump.c (161475) | jump.c (170256) |
---|---|
1/* | 1/* |
2 * Copyright (C) 1984-2005 Mark Nudelman | 2 * Copyright (C) 1984-2007 Mark Nudelman |
3 * 4 * You may distribute under the terms of either the GNU General Public 5 * License or the Less License, as specified in the README file. 6 * 7 * For more information about less, or for information on how to 8 * contact the author, see the README file. 9 */ 10 --- 86 unchanged lines hidden (view full) --- 97 pos_clear(); 98 jump_loc(scrpos.pos, scrpos.ln); 99} 100 101/* 102 * Jump to a specified percentage into the file. 103 */ 104 public void | 3 * 4 * You may distribute under the terms of either the GNU General Public 5 * License or the Less License, as specified in the README file. 6 * 7 * For more information about less, or for information on how to 8 * contact the author, see the README file. 9 */ 10 --- 86 unchanged lines hidden (view full) --- 97 pos_clear(); 98 jump_loc(scrpos.pos, scrpos.ln); 99} 100 101/* 102 * Jump to a specified percentage into the file. 103 */ 104 public void |
105jump_percent(percent) | 105jump_percent(percent, fraction) |
106 int percent; | 106 int percent; |
107 long fraction; |
|
107{ 108 POSITION pos, len; 109 110 /* 111 * Determine the position in the file 112 * (the specified percentage of the file's length). 113 */ 114 if ((len = ch_length()) == NULL_POSITION) 115 { 116 ierror("Determining length of file", NULL_PARG); 117 ch_end_seek(); 118 } 119 if ((len = ch_length()) == NULL_POSITION) 120 { 121 error("Don't know length of file", NULL_PARG); 122 return; 123 } | 108{ 109 POSITION pos, len; 110 111 /* 112 * Determine the position in the file 113 * (the specified percentage of the file's length). 114 */ 115 if ((len = ch_length()) == NULL_POSITION) 116 { 117 ierror("Determining length of file", NULL_PARG); 118 ch_end_seek(); 119 } 120 if ((len = ch_length()) == NULL_POSITION) 121 { 122 error("Don't know length of file", NULL_PARG); 123 return; 124 } |
124 pos = percent_pos(len, percent); | 125 pos = percent_pos(len, percent, fraction); |
125 if (pos >= len) 126 pos = len-1; 127 128 jump_line_loc(pos, jump_sline); 129} 130 131/* 132 * Jump to a specified position in the file. --- 142 unchanged lines hidden (view full) --- 275 */ 276 back(nline+1, tpos, 1, 0); 277 if (show_attn) 278 repaint_hilite(1); 279 return; 280 } 281 } 282 lastmark(); | 126 if (pos >= len) 127 pos = len-1; 128 129 jump_line_loc(pos, jump_sline); 130} 131 132/* 133 * Jump to a specified position in the file. --- 142 unchanged lines hidden (view full) --- 276 */ 277 back(nline+1, tpos, 1, 0); 278 if (show_attn) 279 repaint_hilite(1); 280 return; 281 } 282 } 283 lastmark(); |
283 if (top_scroll != OPT_ON) | 284 if (!top_scroll) |
284 clear(); 285 else 286 home(); 287 screen_trashed = 0; 288 add_back_pos(pos); 289 back(sc_height-1, pos, 1, 0); 290 } 291} | 285 clear(); 286 else 287 home(); 288 screen_trashed = 0; 289 add_back_pos(pos); 290 back(sc_height-1, pos, 1, 0); 291 } 292} |