diff -urp mc-4.7.5.4/src/viewer/display.c mc-4.7.5.4.new/src/viewer/display.c
old
|
new
|
mcview_display_status (mcview_t * view) |
135 | 135 | const screen_dimen height = view->status_area.height; |
136 | 136 | const char *file_label; |
137 | 137 | screen_dimen file_label_width; |
| 138 | screen_dimen extra_space = 0; |
138 | 139 | |
139 | 140 | if (height < 1) |
140 | 141 | return; |
… |
… |
mcview_display_status (mcview_t * view) |
148 | 149 | if (width > 40) |
149 | 150 | { |
150 | 151 | char buffer[BUF_TINY]; |
151 | | widget_move (view, top, width - 32); |
152 | 152 | if (view->hex_mode) |
| 153 | { |
| 154 | widget_move (view, top, width - 32); |
153 | 155 | tty_printf ("0x%08" PRIxMAX, (uintmax_t) view->hex_cursor); |
| 156 | } |
154 | 157 | else |
155 | 158 | { |
156 | 159 | size_trunc_len (buffer, 5, mcview_get_filesize (view), 0, panels_options.kilobyte_si); |
| 160 | if (width - file_label_width - 32 > 6) |
| 161 | { |
| 162 | extra_space = width-file_label_width-32-4; |
| 163 | widget_move (view, top, width - 32 - extra_space); |
| 164 | tty_printf ("C:%ld L:", (ulong) view->dpy_text_column); |
| 165 | if (view->dpy_lines_status == -1) |
| 166 | tty_print_string("EOF"); |
| 167 | tty_printf ("%ld+%ld=%ld /%ld", (long) view->dpy_start_line, (ulong) view->dpy_visible_lines, (long) (view->dpy_start_line+view->dpy_visible_lines), view->dpy_lines_total); |
| 168 | if (view->dpy_lines_status != 1) |
| 169 | tty_print_string("+"); |
| 170 | } |
| 171 | widget_move (view, top, width - 32); |
157 | 172 | tty_printf ("%9" PRIuMAX "/%s%s %s", (uintmax_t) view->dpy_end, |
158 | 173 | buffer, mcview_may_still_grow (view) ? "+" : " ", |
159 | 174 | #ifdef HAVE_CHARSET |
… |
… |
mcview_display_status (mcview_t * view) |
166 | 181 | } |
167 | 182 | widget_move (view, top, left); |
168 | 183 | if (width > 40) |
169 | | tty_print_string (str_fit_to_term (file_label, width - 34, J_LEFT_FIT)); |
| 184 | tty_print_string (str_fit_to_term (file_label, width - 34 - extra_space, J_LEFT_FIT)); |
170 | 185 | else |
171 | 186 | tty_print_string (str_fit_to_term (file_label, width - 5, J_LEFT_FIT)); |
172 | 187 | if (width > 26) |
diff -urp mc-4.7.5.4/src/viewer/internal.h mc-4.7.5.4.new/src/viewer/internal.h
old
|
new
|
typedef struct mcview_struct |
138 | 138 | screen_dimen dpy_frame_size; /* Size of the frame surrounding the real viewer */ |
139 | 139 | off_t dpy_start; /* Offset of the displayed data */ |
140 | 140 | off_t dpy_end; /* Offset after the displayed data */ |
| 141 | off_t dpy_start_line; /* Line number of beginning of the displayed data */ |
| 142 | off_t dpy_visible_lines; /* Number of lines of the displayed data */ |
| 143 | off_t dpy_lines_total; /* Number of lines of entire file */ |
| 144 | int dpy_lines_status; /* 0: total count unknown |
| 145 | -1: counting back from EOF |
| 146 | 1: counting complete */ |
141 | 147 | off_t dpy_text_column; /* Number of skipped columns in non-wrap |
142 | 148 | * text mode */ |
143 | 149 | off_t hex_cursor; /* Hexview cursor position in file */ |
diff -urp mc-4.7.5.4/src/viewer/lib.c mc-4.7.5.4.new/src/viewer/lib.c
old
|
new
|
mcview_init (mcview_t * view) |
202 | 202 | view->dpy_start = 0; |
203 | 203 | view->dpy_text_column = 0; |
204 | 204 | view->dpy_end = 0; |
| 205 | view->dpy_start_line = 0; |
| 206 | view->dpy_visible_lines = 0; |
| 207 | view->dpy_lines_total = 0; |
| 208 | view->dpy_lines_status = 0; |
205 | 209 | view->hex_cursor = 0; |
206 | 210 | view->cursor_col = 0; |
207 | 211 | view->cursor_row = 0; |
diff -urp mc-4.7.5.4/src/viewer/mcviewer.c mc-4.7.5.4.new/src/viewer/mcviewer.c
old
|
new
|
mcview_load (mcview_t * view, const char |
390 | 390 | finish: |
391 | 391 | view->command = g_strdup (command); |
392 | 392 | view->dpy_start = 0; |
| 393 | view->dpy_start_line = 0; |
| 394 | view->dpy_visible_lines = 0; |
| 395 | view->dpy_lines_total = 0; |
| 396 | view->dpy_lines_status = 0; |
393 | 397 | view->search_start = 0; |
394 | 398 | view->search_end = 0; |
395 | 399 | view->dpy_text_column = 0; |
diff -urp mc-4.7.5.4/src/viewer/move.c mc-4.7.5.4.new/src/viewer/move.c
old
|
new
|
mcview_move_up (mcview_t * view, off_t l |
128 | 128 | * and move down all but the last rows */ |
129 | 129 | new_offset = view->dpy_start - (off_t) last_row_length; |
130 | 130 | } |
| 131 | view->dpy_start_line--; |
131 | 132 | } |
132 | 133 | else |
133 | 134 | { |
… |
… |
mcview_move_up (mcview_t * view, off_t l |
143 | 144 | /* if unwrapped -> current BOL equals dpy_start, just find BOL of previous line */ |
144 | 145 | new_offset = view->dpy_start - 1; |
145 | 146 | view->dpy_start = mcview_bol (view, new_offset, 0); |
| 147 | view->dpy_start_line--; |
146 | 148 | } |
147 | 149 | } |
148 | 150 | } |
… |
… |
mcview_move_down (mcview_t * view, off_t |
193 | 195 | else |
194 | 196 | new_offset = mcview_eol (view, view->dpy_start, last_byte); |
195 | 197 | if (new_offset < last_byte) |
| 198 | { |
196 | 199 | view->dpy_start = new_offset; |
| 200 | if(new_offset == mcview_bol (view, new_offset, new_offset - (off_t) 1)) |
| 201 | view->dpy_start_line++; |
| 202 | } |
197 | 203 | if (view->dpy_end >= last_byte) |
198 | 204 | break; |
199 | 205 | } |
… |
… |
mcview_move_down (mcview_t * view, off_t |
210 | 216 | else |
211 | 217 | new_offset = mcview_eol (view, view->dpy_start, last_byte); |
212 | 218 | if (new_offset < last_byte) |
| 219 | { |
213 | 220 | view->dpy_start = new_offset; |
| 221 | if(new_offset == mcview_bol (view, new_offset, new_offset - (off_t) 1)) |
| 222 | view->dpy_start_line++; |
| 223 | } |
214 | 224 | } |
215 | 225 | } |
216 | 226 | } |
… |
… |
void |
298 | 308 | mcview_moveto_top (mcview_t * view) |
299 | 309 | { |
300 | 310 | view->dpy_start = 0; |
| 311 | view->dpy_start_line = 0; |
301 | 312 | view->hex_cursor = 0; |
302 | 313 | view->dpy_text_column = 0; |
303 | 314 | mcview_movement_fixups (view, TRUE); |
| 315 | if (view->dpy_lines_status == -1) |
| 316 | view->dpy_lines_status = 0; |
304 | 317 | } |
305 | 318 | |
306 | 319 | /* --------------------------------------------------------------------------------------------- */ |
… |
… |
mcview_moveto_bottom (mcview_t * view) |
327 | 340 | const off_t datalines = view->data_area.height; |
328 | 341 | |
329 | 342 | view->dpy_start = filesize; |
| 343 | if (view->dpy_lines_status == 0) |
| 344 | view->dpy_lines_status = -1; |
| 345 | if (view->dpy_lines_status != 1) |
| 346 | view->dpy_start_line = 0; |
| 347 | else |
| 348 | view->dpy_start_line=view->dpy_lines_total; |
330 | 349 | mcview_move_up (view, datalines); |
331 | 350 | } |
332 | 351 | } |
diff -urp mc-4.7.5.4/src/viewer/plain.c mc-4.7.5.4.new/src/viewer/plain.c
old
|
new
|
mcview_display_text (mcview_t * view) |
84 | 84 | |
85 | 85 | /* Find the first displayable changed byte */ |
86 | 86 | from = view->dpy_start; |
| 87 | view->dpy_visible_lines = 0; |
87 | 88 | while ((curr != NULL) && (curr->offset < from)) |
88 | 89 | curr = curr->next; |
89 | 90 | |
… |
… |
mcview_display_text (mcview_t * view) |
101 | 102 | |
102 | 103 | c = mcview_get_utf (view, from, &cw, &read_res); |
103 | 104 | if (!read_res) |
| 105 | { |
| 106 | if (view->dpy_lines_status == 0) |
| 107 | view->dpy_lines_status = 1; |
104 | 108 | break; |
| 109 | } |
105 | 110 | } |
106 | 111 | else |
107 | 112 | #endif |
108 | 113 | if (!mcview_get_byte (view, from, &c)) |
| 114 | { |
| 115 | if (view->dpy_lines_status == 0) |
| 116 | view->dpy_lines_status = 1; |
109 | 117 | break; |
| 118 | } |
110 | 119 | |
111 | 120 | last_row = FALSE; |
112 | 121 | from++; |
… |
… |
mcview_display_text (mcview_t * view) |
130 | 139 | { |
131 | 140 | col = 0; |
132 | 141 | row++; |
| 142 | view->dpy_visible_lines++; |
133 | 143 | continue; |
134 | 144 | } |
135 | 145 | |
… |
… |
mcview_display_text (mcview_t * view) |
193 | 203 | #endif |
194 | 204 | } |
195 | 205 | |
| 206 | if (view->dpy_lines_status >= 0 && view->dpy_start_line+view->dpy_visible_lines>view->dpy_lines_total) |
| 207 | view->dpy_lines_total = view->dpy_start_line+view->dpy_visible_lines; |
| 208 | else if (view->dpy_lines_total<-view->dpy_start_line) |
| 209 | view->dpy_lines_total = -view->dpy_start_line; |
| 210 | if (view->dpy_start == 0 && view->dpy_lines_status == -1) |
| 211 | { |
| 212 | view->dpy_start_line = 0; |
| 213 | view->dpy_lines_status = 1; |
| 214 | } |
196 | 215 | view->dpy_end = from; |
197 | 216 | if (mcview_show_eof != NULL && mcview_show_eof[0] != '\0') |
198 | 217 | { |