input.c (367516) | input.c (369759) |
---|---|
1/* | 1/* |
2 * Copyright (C) 1984-2020 Mark Nudelman | 2 * Copyright (C) 1984-2021 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, see the README file. 8 */ 9 10/* --- 15 unchanged lines hidden (view full) --- 26extern int sigs; 27extern int ignore_eoi; 28extern int status_col; 29extern POSITION start_attnpos; 30extern POSITION end_attnpos; 31#if HILITE_SEARCH 32extern int hilite_search; 33extern int size_linebuf; | 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, see the README file. 8 */ 9 10/* --- 15 unchanged lines hidden (view full) --- 26extern int sigs; 27extern int ignore_eoi; 28extern int status_col; 29extern POSITION start_attnpos; 30extern POSITION end_attnpos; 31#if HILITE_SEARCH 32extern int hilite_search; 33extern int size_linebuf; |
34extern int show_attn; |
|
34#endif 35 36/* 37 * Get the next line. 38 * A "current" position is passed and a "new" position is returned. 39 * The current position is the position of the first character of 40 * a line. The new position is the position of the first character 41 * of the NEXT line. The line obtained is the line starting at curr_pos. 42 */ 43 public POSITION | 35#endif 36 37/* 38 * Get the next line. 39 * A "current" position is passed and a "new" position is returned. 40 * The current position is the position of the first character of 41 * a line. The new position is the position of the first character 42 * of the NEXT line. The line obtained is the line starting at curr_pos. 43 */ 44 public POSITION |
44forw_line(curr_pos) | 45forw_line_seg(curr_pos, get_segpos) |
45 POSITION curr_pos; | 46 POSITION curr_pos; |
47 int get_segpos; |
|
46{ 47 POSITION base_pos; 48 POSITION new_pos; 49 int c; 50 int blankline; 51 int endline; 52 int chopped; 53 int backchars; --- 45 unchanged lines hidden (view full) --- 99 break; 100 } 101 --base_pos; 102 } 103 104 /* 105 * Read forward again to the position we should start at. 106 */ | 48{ 49 POSITION base_pos; 50 POSITION new_pos; 51 int c; 52 int blankline; 53 int endline; 54 int chopped; 55 int backchars; --- 45 unchanged lines hidden (view full) --- 101 break; 102 } 103 --base_pos; 104 } 105 106 /* 107 * Read forward again to the position we should start at. 108 */ |
107 prewind(); 108 plinenum(base_pos); | 109 prewind(); 110 plinestart(base_pos); |
109 (void) ch_seek(base_pos); 110 new_pos = base_pos; 111 while (new_pos < curr_pos) 112 { 113 if (ABORT_SIGS()) 114 { 115 null_line(); 116 return (NULL_POSITION); --- 58 unchanged lines hidden (view full) --- 175 backchars = pappend(c, ch_tell()-1); 176 if (backchars > 0) 177 { 178 /* 179 * The char won't fit in the line; the line 180 * is too long to print in the screen width. 181 * End the line here. 182 */ | 111 (void) ch_seek(base_pos); 112 new_pos = base_pos; 113 while (new_pos < curr_pos) 114 { 115 if (ABORT_SIGS()) 116 { 117 null_line(); 118 return (NULL_POSITION); --- 58 unchanged lines hidden (view full) --- 177 backchars = pappend(c, ch_tell()-1); 178 if (backchars > 0) 179 { 180 /* 181 * The char won't fit in the line; the line 182 * is too long to print in the screen width. 183 * End the line here. 184 */ |
183 if (chopline || hshift > 0) | 185 if ((chopline || hshift > 0) && !get_segpos) |
184 { | 186 { |
187 /* Read to end of line. */ |
|
185 do 186 { 187 if (ABORT_SIGS()) 188 { 189 null_line(); 190 return (NULL_POSITION); 191 } 192 c = ch_forw_get(); --- 7 unchanged lines hidden (view full) --- 200 new_pos = ch_tell() - backchars; 201 endline = FALSE; 202 } 203 break; 204 } 205 c = ch_forw_get(); 206 } 207 | 188 do 189 { 190 if (ABORT_SIGS()) 191 { 192 null_line(); 193 return (NULL_POSITION); 194 } 195 c = ch_forw_get(); --- 7 unchanged lines hidden (view full) --- 203 new_pos = ch_tell() - backchars; 204 endline = FALSE; 205 } 206 break; 207 } 208 c = ch_forw_get(); 209 } 210 |
211#if HILITE_SEARCH 212 if (blankline && show_attn) 213 { 214 /* Add spurious space to carry possible attn hilite. */ 215 pappend(' ', ch_tell()-1); 216 } 217#endif |
|
208 pdone(endline, chopped, 1); 209 210#if HILITE_SEARCH 211 if (is_filtered(base_pos)) 212 { 213 /* 214 * We don't want to display this line. 215 * Get the next line. 216 */ 217 curr_pos = new_pos; 218 goto get_forw_line; 219 } 220 | 218 pdone(endline, chopped, 1); 219 220#if HILITE_SEARCH 221 if (is_filtered(base_pos)) 222 { 223 /* 224 * We don't want to display this line. 225 * Get the next line. 226 */ 227 curr_pos = new_pos; 228 goto get_forw_line; 229 } 230 |
221 if (status_col && is_hilited(base_pos, ch_tell()-1, 1, NULL)) 222 set_status_col('*'); | 231 if (status_col) 232 { 233 int attr = is_hilited_attr(base_pos, ch_tell()-1, 1, NULL); 234 if (attr) 235 set_status_col('*', attr); 236 } |
223#endif 224 225 if (squeeze && blankline) 226 { 227 /* 228 * This line is blank. 229 * Skip down to the last contiguous blank line 230 * and pretend it is the one which we are returning. --- 7 unchanged lines hidden (view full) --- 238 if (c != EOI) 239 (void) ch_back_get(); 240 new_pos = ch_tell(); 241 } 242 243 return (new_pos); 244} 245 | 237#endif 238 239 if (squeeze && blankline) 240 { 241 /* 242 * This line is blank. 243 * Skip down to the last contiguous blank line 244 * and pretend it is the one which we are returning. --- 7 unchanged lines hidden (view full) --- 252 if (c != EOI) 253 (void) ch_back_get(); 254 new_pos = ch_tell(); 255 } 256 257 return (new_pos); 258} 259 |
260 public POSITION 261forw_line(curr_pos) 262 POSITION curr_pos; 263{ 264 return forw_line_seg(curr_pos, FALSE); 265} 266 |
|
246/* 247 * Get the previous line. 248 * A "current" position is passed and a "new" position is returned. 249 * The current position is the position of the first character of 250 * a line. The new position is the position of the first character 251 * of the PREVIOUS line. The line obtained is the one starting at new_pos. 252 */ 253 public POSITION --- 99 unchanged lines hidden (view full) --- 353 new_pos = base_pos; 354 if (ch_seek(new_pos)) 355 { 356 null_line(); 357 return (NULL_POSITION); 358 } 359 endline = FALSE; 360 prewind(); | 267/* 268 * Get the previous line. 269 * A "current" position is passed and a "new" position is returned. 270 * The current position is the position of the first character of 271 * a line. The new position is the position of the first character 272 * of the PREVIOUS line. The line obtained is the one starting at new_pos. 273 */ 274 public POSITION --- 99 unchanged lines hidden (view full) --- 374 new_pos = base_pos; 375 if (ch_seek(new_pos)) 376 { 377 null_line(); 378 return (NULL_POSITION); 379 } 380 endline = FALSE; 381 prewind(); |
361 plinenum(new_pos); | 382 plinestart(new_pos); |
362 loop: 363 begin_new_pos = new_pos; 364 (void) ch_seek(new_pos); 365 chopped = FALSE; 366 367 do 368 { 369 c = ch_forw_get(); --- 48 unchanged lines hidden (view full) --- 418 /* 419 * We don't want to display this line. 420 * Get the previous line. 421 */ 422 curr_pos = begin_new_pos; 423 goto get_back_line; 424 } 425 | 383 loop: 384 begin_new_pos = new_pos; 385 (void) ch_seek(new_pos); 386 chopped = FALSE; 387 388 do 389 { 390 c = ch_forw_get(); --- 48 unchanged lines hidden (view full) --- 439 /* 440 * We don't want to display this line. 441 * Get the previous line. 442 */ 443 curr_pos = begin_new_pos; 444 goto get_back_line; 445 } 446 |
426 if (status_col && curr_pos > 0 && is_hilited(base_pos, curr_pos-1, 1, NULL)) 427 set_status_col('*'); | 447 if (status_col && curr_pos > 0) 448 { 449 int attr = is_hilited_attr(base_pos, curr_pos-1, 1, NULL); 450 if (attr) 451 set_status_col('*', attr); 452 } |
428#endif 429 430 return (begin_new_pos); 431} 432 433/* 434 * Set attnpos. 435 */ --- 33 unchanged lines hidden --- | 453#endif 454 455 return (begin_new_pos); 456} 457 458/* 459 * Set attnpos. 460 */ --- 33 unchanged lines hidden --- |