[texdoc-commits] [SCM] texdoc updated: r19 - trunk/script

karl at gnu.org.ua karl at gnu.org.ua
Mon Nov 6 01:03:14 CET 2017


Author: karl
Date: 2017-11-06 02:03:14 +0200 (Mon, 06 Nov 2017)
New Revision: 19

Modified:
   trunk/script/ChangeLog
   trunk/script/view.tlu
Log:
off-by-one error in finding last valid number

Modified: trunk/script/ChangeLog
===================================================================
--- trunk/script/ChangeLog	2017-11-04 23:32:07 UTC (rev 18)
+++ trunk/script/ChangeLog	2017-11-06 00:03:14 UTC (rev 19)
@@ -1,3 +1,8 @@
+2017-11-05  Karl Berry  <karl at freefriends.org>
+
+* view.tlu (print_menu): off-by-one error in finding last valid number.
+Report from Denis.
+
 2017-11-04  Karl Berry  <karl at freefriends.org>
 
 * view.tlu (print_menu): make just RET as input view first document in list.

Modified: trunk/script/view.tlu
===================================================================
--- trunk/script/view.tlu	2017-11-04 23:32:07 UTC (rev 18)
+++ trunk/script/view.tlu	2017-11-06 00:03:14 UTC (rev 19)
@@ -158,13 +158,13 @@
     end
     local i, doc, last_i
     for i, doc in ipairs (doclist) do
-        last_i = i -- save for test below
         if doc.quality == 'killed' then break end
         if doc.quality ~= 'good' and not showall then break end
         if config.machine_switch == true then
             print(name, doc.score, w32_path(doc.realpath),
             doc.lang or '', doc.details or '')
         else
+            last_i = i -- save for test below
             print(string.format('%2d %s', i, w32_path(doc.realpath)))
             if doc.details or doc.lang then
                 local line = '   = '
@@ -182,7 +182,7 @@
         -- We only want to default to viewing 1 on an empty line.
         -- Use Lua's faked ternary operator for fun and brevity:
         num = (num_str == "" and 1 or tonumber(num_str))
-        if num and doclist[num] and num < last_i then
+        if num and doclist[num] and num <= last_i then
             view_doc(doclist[num])
         end
     end



More information about the texdoc-commits mailing list