* Go back 'n' lines in text. Called by dialog_textbox(). * 'page' will be updated to point to the desired line in 'buf'. */
| 18 | * 'page' will be updated to point to the desired line in 'buf'. |
| 19 | */ |
| 20 | static void back_lines(int n) |
| 21 | { |
| 22 | int i; |
| 23 | |
| 24 | begin_reached = 0; |
| 25 | /* Go back 'n' lines */ |
| 26 | for (i = 0; i < n; i++) { |
| 27 | if (*page == '\0') { |
| 28 | if (end_reached) { |
| 29 | end_reached = 0; |
| 30 | continue; |
| 31 | } |
| 32 | } |
| 33 | if (page == buf) { |
| 34 | begin_reached = 1; |
| 35 | return; |
| 36 | } |
| 37 | page--; |
| 38 | do { |
| 39 | if (page == buf) { |
| 40 | begin_reached = 1; |
| 41 | return; |
| 42 | } |
| 43 | page--; |
| 44 | } while (*page != '\n'); |
| 45 | page++; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | /* |
| 50 | * Return current line of text. Called by dialog_textbox() and print_line(). |