# # # patch "ChangeLog" # from [81592d460f7a3f0d91bdc724a433e477bb18b612] # to [8f8c9cd0d722ecd5c74d89e94822638660fab84d] # # patch "ui.cc" # from [0dcd592fa535fa09f38e80661671815d6cc3edd0] # to [e3911a0054262d5b445af1a5e66ab699faeab8eb] # ============================================================ --- ChangeLog 81592d460f7a3f0d91bdc724a433e477bb18b612 +++ ChangeLog 8f8c9cd0d722ecd5c74d89e94822638660fab84d @@ -1,5 +1,14 @@ 2006-04-12 Richard Levitte + * ui.cc (compose_count): Simplify for count/total ticks. There's + no need to calculate the maximum size every time, since + write_ticks has a specific test with the exact same effect. + (tick_write_count::write_ticks): Specialise the test for the + count/total case, since we know the exact maximum and therefore + don't need to make space for a ludicrously large number. + +2006-04-12 Richard Levitte + * ui.hh (struct ticker): Add a member count_size to hold the size of the tick count output and a method set_count_size to modify it. ============================================================ --- ui.cc 0dcd592fa535fa09f38e80661671815d6cc3edd0 +++ ui.cc e3911a0054262d5b445af1a5e66ab699faeab8eb @@ -131,15 +131,7 @@ } else if (tick->use_total) { - // We know that we're going to eventually have 'total' displayed - // twice on screen, plus a slash. So we should pad out this field - // to that eventual size to avoid spurious re-issuing of the - // tick titles as we expand to the goal. - string complete = (F("%d/%d") % tick->total % tick->total).str(); - // xgettext: bytes - string current = (F("%d/%d") % ticks % tick->total).str(); - count.append(complete.size() - current.size(),' '); - count.append(current); + count = (F("%d/%d") % ticks % tick->total).str(); } else { @@ -161,14 +153,28 @@ { ticker * tick = i->second; - if (tick->count_size == 0) + if (tick->count_size == 0 && (tick->kilocount || tick->use_total)) { - // To find out what the maximum size can be, choose one the the - // dividers from compose_count, subtract one and have compose_count - // create the count string for that. Use the size of the returned - // count string as an initial size for this tick. - tick->set_count_size(display_width(utf8(compose_count(tick, - 1048575)))); + if (!tick->kilocount && tick->use_total) + { + // We know that we're going to eventually have 'total' + // displayed twice on screen, plus a slash. So we should + // pad out this field to that eventual size to avoid + // spurious re-issuing of the tick titles as we expand to + // the goal. + tick->set_count_size(display_width(utf8(compose_count(tick, + tick->total)))); + } + else + { + // To find out what the maximum size can be, choose one the + // the dividers from compose_count, subtract one and have + // compose_count create the count string for that. Use the + // size of the returned count string as an initial size for + // this tick. + tick->set_count_size(display_width(utf8(compose_count(tick, + 1048575)))); + } } string count(compose_count(tick));