diff -ur -ruNp mc-4.7.2.orig/src/viewer/move.c mc-4.7.2/src/viewer/move.c
old
|
new
|
mcview_move_down (mcview_t * view, off_t |
154 | 154 | else |
155 | 155 | { |
156 | 156 | off_t i; |
157 | | off_t new_offset = 0; |
| 157 | off_t new_offset; |
158 | 158 | |
159 | 159 | if (view->dpy_end - view->dpy_start > last_byte - view->dpy_end) |
160 | 160 | { |
161 | | i = 0; |
162 | | new_offset = view->dpy_end; |
163 | | while (view->dpy_end < last_byte && lines-- > 0) |
| 161 | while (lines-- > 0) |
164 | 162 | { |
165 | 163 | new_offset = mcview_eol (view, view->dpy_end); |
166 | 164 | if (view->text_wrap_mode) |
167 | 165 | new_offset = min (new_offset, view->dpy_end + view->data_area.width); |
168 | 166 | view->dpy_end = new_offset; |
| 167 | if(view->dpy_end>=last_byte) lines=0; |
169 | 168 | |
170 | 169 | new_offset = mcview_eol (view, view->dpy_start); |
171 | 170 | if (view->text_wrap_mode) |
172 | 171 | new_offset = min (new_offset, view->dpy_start + view->data_area.width); |
173 | | view->dpy_start = new_offset; |
| 172 | if(new_offset<last_byte) view->dpy_start = new_offset; |
174 | 173 | } |
175 | | view->dpy_end = last_byte; |
176 | 174 | } |
177 | 175 | else |
178 | 176 | { |
179 | 177 | |
180 | | for (i = 0; i < lines && view->dpy_end < last_byte && new_offset < last_byte; i++) |
| 178 | for (i = 0; i < lines && new_offset < last_byte; i++) |
181 | 179 | { |
182 | 180 | new_offset = mcview_eol (view, view->dpy_start); |
183 | 181 | if (view->text_wrap_mode) |
184 | 182 | new_offset = min (new_offset, view->dpy_start + view->data_area.width); |
185 | | view->dpy_start = new_offset; |
| 183 | if(new_offset<last_byte) view->dpy_start = new_offset; |
186 | 184 | } |
187 | 185 | } |
188 | 186 | } |