summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/texdoc
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-11-04 23:33:04 +0000
committerKarl Berry <karl@freefriends.org>2017-11-04 23:33:04 +0000
commitafa2ebdbcdfb509df8996f46f209860c7c28be67 (patch)
treee405e2a6aa91b28587028e8be372a5e77144b3a3 /Master/texmf-dist/scripts/texdoc
parente6aafd3e1d0c3a1dc17e5ade3df9c244b38c8588 (diff)
RET in view mode views first document, texdoc r18
git-svn-id: svn://tug.org/texlive/trunk@45693 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/texdoc')
-rw-r--r--Master/texmf-dist/scripts/texdoc/view.tlu17
1 files changed, 11 insertions, 6 deletions
diff --git a/Master/texmf-dist/scripts/texdoc/view.tlu b/Master/texmf-dist/scripts/texdoc/view.tlu
index 45e7c9df395..484cfe34344 100644
--- a/Master/texmf-dist/scripts/texdoc/view.tlu
+++ b/Master/texmf-dist/scripts/texdoc/view.tlu
@@ -156,8 +156,9 @@ function print_menu(name, doclist, showall)
end
end
end
- local i, doc
+ 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
@@ -174,16 +175,20 @@ function print_menu(name, doclist, showall)
end
end
if config.interact_switch then
- io.write ("Please enter the number of the file to view, ",
- "anything else to skip: ")
- local num = tonumber(io.read('*line'))
- if num and doclist[num] then
+ io.write ("Enter number of file to view, ",
+ "RET to view 1, anything else to skip: ")
+ local num_str = io.read('*line')
+ -- That returns the empty string on an empty line, nil on EOF.
+ -- 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
view_doc(doclist[num])
end
end
end
------------------------ deliver results base on mode ----------------------
+----------------------- deliver results based on mode ---------------------
function deliver_results(name, doclist, many)
-- ensure that results were found or apologize