From dc0ce3c0c5831ad7081a0329abeb473cbf257fdc Mon Sep 17 00:00:00 2001 From: Manuel Pégourié-Gonnard Date: Mon, 28 Jul 2008 23:32:35 +0000 Subject: max_lines for the menu now configurable. And viewing from menu really launchs a veiwer now :-) git-svn-id: svn://tug.org/texlive/trunk@9856 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/texdoc.tlu | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'Master/texmf/scripts') diff --git a/Master/texmf/scripts/texlive/texdoc.tlu b/Master/texmf/scripts/texlive/texdoc.tlu index 14d5fe3becf..cfc64747680 100755 --- a/Master/texmf/scripts/texlive/texdoc.tlu +++ b/Master/texmf/scripts/texlive/texdoc.tlu @@ -488,7 +488,7 @@ function setup_config_from_defaults() } end end - -- then mode, alias, verbosity + -- then various stuff set_config_list { mode = 'view', verbose = 'false', @@ -651,26 +651,26 @@ end -- print a list of files as a menu (with an optional complementary list) function print_menu (files, comp) comp = comp or {} + max_lines = tonumber (config.max_lines) or 20 local f = #files if interactive then local n = f + #comp - if n > 20 then - io.write (n, "results. Display them all? (y/N) ") - local ans = io.read(1) + if n > max_lines then + io.write (n, " results. Display them all? (y/N) ") + local ans = io.read('*line') if not ((ans == 'y') or (ans == 'Y')) then return end end end display_table (files) display_table (comp, f) if interactive then - io.write ("Please enter the number of the file to view, or 0 to exit: ") - local num = io.read('*number') - if num and (num <= #files) and files[num] then - print ("Viewing file '"..files[num].."'.") + io.write ("Please enter the number of the file to view, ", + "anything else to skip: ") + local num = tonumber(io.read('*line')) + if num and (num <= f) and files[num] then + try_viewing (how_to_view (files[num])) elseif num and comp[num-f] then - print ("Viewing file '"..comp[num-f].."'.") - elseif num ~= 0 then - print ("Incorrect input, skipping.") + try_viewing (how_to_view (comp[num-f])) end end end -- cgit v1.2.3