mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-04 07:01:30 +03:00
* view.c (view_update_bytes_per_line): Use a local variable to
do the computation. Update view->bytes_per_line only once, after all computations have finished.
This commit is contained in:
parent
35b218fc69
commit
8bbf0d25fe
@ -1,3 +1,9 @@
|
||||
2005-07-11 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* view.c (view_update_bytes_per_line): Use a local variable to
|
||||
do the computation. Update view->bytes_per_line only once, after
|
||||
all computations have finished.
|
||||
|
||||
2005-07-09 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* info.c (info_show_info): Properly calculate the length of the
|
||||
|
13
src/view.c
13
src/view.c
@ -1414,19 +1414,20 @@ static void
|
||||
view_update_bytes_per_line (WView *view)
|
||||
{
|
||||
const screen_dimen cols = view->data_area.width;
|
||||
int bytes;
|
||||
|
||||
if (cols < 8)
|
||||
view->bytes_per_line = 0;
|
||||
bytes = 1;
|
||||
else if (cols < 80)
|
||||
view->bytes_per_line = ((cols - 8) / 17) * 4;
|
||||
bytes = ((cols - 8) / 17) * 4;
|
||||
else
|
||||
view->bytes_per_line = ((cols - 8) / 18) * 4;
|
||||
bytes = ((cols - 8) / 18) * 4;
|
||||
|
||||
if (view->bytes_per_line == 0)
|
||||
view->bytes_per_line++; /* To avoid division by 0 */
|
||||
if (bytes == 0)
|
||||
bytes = 1; /* To avoid division by 0 */
|
||||
|
||||
view->bytes_per_line = bytes;
|
||||
view->dirty = max_dirt_limit + 1; /* To force refresh */
|
||||
assert (view->bytes_per_line != 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
x
Reference in New Issue
Block a user