From 97bc4fa6a2f3d05b25f22268236b5fc627eae7e5 Mon Sep 17 00:00:00 2001 From: user202729 <25191436+user202729@users.noreply.github.com> Date: Sat, 13 Oct 2018 15:13:26 +0700 Subject: [PATCH] Add comment for explanation --- qutebrowser/browser/hints.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index c4b5f51af..cfd6f7c4e 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -454,10 +454,13 @@ class HintManager(QObject): # case. Usually we do not need all of these digits for every link # single hint, so we can show shorter hints for a few of the links. needed = max(min_chars, utils.ceil_log(len(elems), len(chars))) + # Short hints are the number of hints we can possibly show which are # (needed - 1) digits in length. if needed > min_chars and needed > 1: total_space = len(chars) ** needed + # For each 1 short link being added, len(chars) long links are + # removed, therefore the space removed is len(chars) - 1. short_count = (total_space - len(elems)) // (len(chars) - 1) else: short_count = 0