diff options
48 files changed, 2021 insertions, 354 deletions
diff --git a/context/data/textadept/context/modules/textadept-context-files.lua b/context/data/textadept/context/modules/textadept-context-files.lua index 28cc794cb..ef016372e 100644 --- a/context/data/textadept/context/modules/textadept-context-files.lua +++ b/context/data/textadept/context/modules/textadept-context-files.lua @@ -71,41 +71,41 @@ do newmenu.file = { - title = '_File', + title = "_File", - { '_New', buffer.new }, - { '_Open', io.open_file }, - { 'Open _Recent', io.open_recent_file }, - { 'Re_load', io.reload_file }, - { '_Save', io.save_file }, - { 'Save _As', io.save_file_as }, - { 'Save All', io.save_all_files }, + { "_New", buffer.new }, + { "_Open", io.open_file }, + { "Open _Recent", io.open_recent_file }, + { "Re_load", io.reload_file }, + { "_Save", io.save_file }, + { "Save _As", io.save_file_as }, + { "Save All", io.save_all_files }, SEPARATOR, - { '_Close', io.close_buffer }, - { 'Close All', io.close_all_buffers }, + { "_Close", io.close_buffer }, + { "Close All", io.close_all_buffers }, -- SEPARATOR, - -- { 'Loa_d Session', textadept.session.load }, - -- { 'Sav_e Session', textadept.session.save }, + -- { "Loa_d Session", textadept.session.load }, + -- { "Sav_e Session", textadept.session.save }, SEPARATOR, - { _L['_Quit'], quit }, + { _L["_Quit"], quit }, } -- maybe just the same keys on all ... or duplicate on osx - newkeys[OSX and 'mn' or 'cn'] = buffer.new - newkeys[OSX and 'mo' or 'co'] = io.open_file - newkeys[OSX and 'cmo' or 'cao'] = io.open_recent_file - newkeys[OSX and 'ms' or 'cs'] = io.save_file - newkeys[OSX and 'mS' or 'cS'] = io.save_file_as - newkeys[OSX and 'mw' or 'cw'] = io.close_buffer - newkeys[OSX and 'mW' or 'cW'] = io.close_all_buffers + newkeys[OSX and "mn" or "cn"] = buffer.new + newkeys[OSX and "mo" or "co"] = io.open_file + newkeys[OSX and "cmo" or "cao"] = io.open_recent_file + newkeys[OSX and "ms" or "cs"] = io.save_file + newkeys[OSX and "mS" or "cS"] = io.save_file_as + newkeys[OSX and "mw" or "cw"] = io.close_buffer + newkeys[OSX and "mW" or "cW"] = io.close_all_buffers end @@ -117,80 +117,82 @@ do newmenu.edit = { - title = '_Edit', + title = "_Edit", SEPARATOR, - { '_Undo', buffer.undo }, - { '_Redo', buffer.redo }, + { "_Undo", buffer.undo }, + { "_Redo", buffer.redo }, SEPARATOR, - { 'Cu_t', buffer.cut }, - { '_Copy', buffer.copy }, - { '_Paste', buffer.paste }, - { '_Delete', buffer.clear }, - { 'Select _All', buffer.select_all }, + { "Cu_t", buffer.cut }, + { "_Copy", buffer.copy }, + { "_Paste", buffer.paste }, + { "_Delete", buffer.clear }, + { "Select _All", buffer.select_all }, SEPARATOR, - { 'Duplicate _Line', buffer.line_duplicate }, + { "Duplicate _Line", buffer.line_duplicate }, SEPARATOR, - { 'Toggle _Block Comment', textadept.editing.block_comment }, - { '_Upper Case Selection', buffer.upper_case }, - { '_Lower Case Selection', buffer.lower_case }, + { "Toggle _Block Comment", runner.blockcomment }, + { "_Upper Case Selection", buffer.upper_case }, + { "_Lower Case Selection", buffer.lower_case }, } - newkeys[OSX and 'mz' or 'cz'] = buffer.undo - newkeys[OSX and 'my' or 'cy'] = buffer.redo - newkeys[OSX and 'mx' or 'cx'] = buffer.cut - newkeys[OSX and 'mc' or 'cc'] = buffer.copy - newkeys[OSX and 'mv' or 'cv'] = buffer.paste - newkeys[OSX and 'ma' or 'ca'] = buffer.select_all + newkeys[OSX and "mz" or "cz"] = buffer.undo + newkeys[OSX and "my" or "cy"] = buffer.redo + newkeys[OSX and "mx" or "cx"] = buffer.cut + newkeys[OSX and "mc" or "cc"] = buffer.copy + newkeys[OSX and "mv" or "cv"] = buffer.paste + newkeys[OSX and "ma" or "ca"] = buffer.select_all - newkeys[OSX and 'mD' or 'cD'] = textadept.editing.select_word - newkeys[OSX and 'mN' or 'cN'] = textadept.editing.select_line - newkeys[OSX and 'mP' or 'cP'] = textadept.editing.select_paragraph + newkeys[OSX and "mD" or "cD"] = textadept.editing.select_word + newkeys[OSX and "mN" or "cN"] = textadept.editing.select_line + newkeys[OSX and "mP" or "cP"] = textadept.editing.select_paragraph - newkeys['del'] = buffer.clear - newkeys['cy'] = buffer.redo + newkeys["del"] = buffer.clear + newkeys["cy"] = buffer.redo - newkeys[OSX and 'md' or 'cd'] = buffer.line_duplicate - newkeys[OSX and 'cu' or 'cau'] = buffer.upper_case - newkeys[OSX and 'cU' or 'caU'] = buffer.lower_case + newkeys[OSX and "md" or "cd"] = buffer.line_duplicate + newkeys[OSX and "cu" or "cau"] = buffer.upper_case + newkeys[OSX and "cU" or "caU"] = buffer.lower_case - newkeys[OSX and 'mq' or 'cq'] = textadept.editing.block_comment + newkeys[OSX and "mq" or "cq"] = runner.blockcomment + + newkeys[OSX and "ml" or "cl"] = buffer.line_delete -- Do I ever use these? - -- newkeys['cf'] = buffer.char_right - -- newkeys['cF'] = buffer.char_right_extend - -- newkeys['cmf'] = buffer.word_right - -- newkeys['cmF'] = buffer.word_right_extend - -- newkeys['cb'] = buffer.char_left - -- newkeys['cB'] = buffer.char_left_extend - -- newkeys['cmb'] = buffer.word_left - -- newkeys['cmB'] = buffer.word_left_extend - -- newkeys['cn'] = buffer.line_down - -- newkeys['cN'] = buffer.line_down_extend - -- newkeys['cp'] = buffer.line_up - -- newkeys['cP'] = buffer.line_up_extend - -- newkeys['ca'] = buffer.vc_home - -- newkeys['cA'] = buffer.vc_home_extend - -- newkeys['ce'] = buffer.line_end - -- newkeys['cE'] = buffer.line_end_extend - -- newkeys['aright'] = buffer.word_right - -- newkeys['aleft'] = buffer.word_left - -- newkeys['cdv'] = buffer.clear - -- newkeys['ck'] = function() buffer:line_end_extend() buffer:cut() end - -- newkeys['cl'] = buffer.vertical_centre_caret + -- newkeys["cf"] = buffer.char_right + -- newkeys["cF"] = buffer.char_right_extend + -- newkeys["cmf"] = buffer.word_right + -- newkeys["cmF"] = buffer.word_right_extend + -- newkeys["cb"] = buffer.char_left + -- newkeys["cB"] = buffer.char_left_extend + -- newkeys["cmb"] = buffer.word_left + -- newkeys["cmB"] = buffer.word_left_extend + -- newkeys["cn"] = buffer.line_down + -- newkeys["cN"] = buffer.line_down_extend + -- newkeys["cp"] = buffer.line_up + -- newkeys["cP"] = buffer.line_up_extend + -- newkeys["ca"] = buffer.vc_home + -- newkeys["cA"] = buffer.vc_home_extend + -- newkeys["ce"] = buffer.line_end + -- newkeys["cE"] = buffer.line_end_extend + -- newkeys["aright"] = buffer.word_right + -- newkeys["aleft"] = buffer.word_left + -- newkeys["cdv"] = buffer.clear + -- newkeys["ck"] = function() buffer:line_end_extend() buffer:cut() end + -- newkeys["cl"] = buffer.vertical_centre_caret newkeys.fn = OSX and function() return true end or nil - newkeys[OSX and 'c@' or 'c '] = complete_symbol + newkeys[OSX and "c@" or "c "] = complete_symbol end @@ -216,47 +218,47 @@ do newmenu.search = { - title = '_Search', + title = "_Search", SEPARATOR, - { '_Find', find_in_file }, - { 'Find _Next', ui.find.find_next }, - { 'Find _Previous', ui.find.find_prev }, - { '_Replace', ui.find.replace }, - { 'Replace _All', ui.find.replace_all }, - { 'Find _Incremental', ui.find.find_incremental }, + { "_Find", find_in_file }, + { "Find _Next", ui.find.find_next }, + { "Find _Previous", ui.find.find_prev }, + { "_Replace", ui.find.replace }, + { "Replace _All", ui.find.replace_all }, + { "Find _Incremental", ui.find.find_incremental }, SEPARATOR, - { 'Find in Fi_les', find_in_files }, - { 'Goto Nex_t File Found', find_next_in_files }, - { 'Goto Previou_s File Found', find_previous_in_files }, + { "Find in Fi_les", find_in_files }, + { "Goto Nex_t File Found", find_next_in_files }, + { "Goto Previou_s File Found", find_previous_in_files }, SEPARATOR, - { '_Jump to', textadept.editing.goto_line } + { "_Jump to", textadept.editing.goto_line } } -- The few times I use osx I want the same keys ... better explicitly handle -- "not GUI" but I have to test the curses version first anyway. - newkeys[OSX and 'mf' or 'cf'] = find_in_file - newkeys[OSX and 'mg' or 'cg'] = ui.find.find_next - newkeys[OSX and 'mG' or 'cG'] = ui.find.find_prev - newkeys[OSX and 'mg' or 'cg'] = textadept.editing.goto_line + newkeys[OSX and "mf" or "cf"] = find_in_file + newkeys[OSX and "mg" or "cg"] = ui.find.find_next + newkeys[OSX and "mG" or "cG"] = ui.find.find_prev + newkeys[OSX and "mg" or "cg"] = textadept.editing.goto_line - newkeys['f3'] = not OSX and ui.find.find_next or nil - newkeys['sf3'] = not OSX and ui.find.find_prev or nil + newkeys["f3"] = not OSX and ui.find.find_next or nil + newkeys["sf3"] = not OSX and ui.find.find_prev or nil - newkeys[OSX and 'cr' or 'car'] = ui.find.replace - newkeys[OSX and 'cR' or 'caR'] = ui.find.replace_all - newkeys[OSX and 'cmf' or 'caf'] = ui.find.find_incremental + newkeys[OSX and "cr" or "car"] = ui.find.replace + newkeys[OSX and "cR" or "caR"] = ui.find.replace_all + newkeys[OSX and "cmf" or "caf"] = ui.find.find_incremental - newkeys[OSX and 'mF' or 'cF'] = find_in_files - newkeys[OSX and 'cmg' or 'cag'] = find_next_in_files - newkeys[OSX and 'cmG' or 'caG'] = find_previous_in_files + newkeys[OSX and "mF" or "cF"] = find_in_files + newkeys[OSX and "cmg" or "cag"] = find_next_in_files + newkeys[OSX and "cmG" or "caG"] = find_previous_in_files end @@ -265,7 +267,7 @@ do io.quick_open_max = 5000 local function isdir(path) - return path and path ~= "" and lfs.attributes(path,'mode') == 'directory' + return path and path ~= "" and lfs.attributes(path,"mode") == "directory" end local function resolveroot(path) @@ -327,52 +329,62 @@ do newmenu.tools = { - title = '_Tools', + title = "_Tools", SEPARATOR, - { 'Check Source', runner.check }, - { 'Process Source', runner.process }, - { 'Preview Result', runner.preview }, - { 'Show Log File', runner.install("logfile") }, - { 'Quit', runner.quit }, + { "Check Source", runner.check }, + { "Process Source", runner.process }, + { "Preview Result", runner.preview }, + { "Show Log File", runner.install("logfile") }, + { "Quit", runner.quit }, SEPARATOR, - { 'Open Current Directory', opencurrentdirectory }, - { 'Open User Directory', openuserdirectory }, - { 'Open Base Directory', openbasedirectory }, + { "Open Current Directory", opencurrentdirectory }, + { "Open User Directory", openuserdirectory }, + { "Open Base Directory", openbasedirectory }, SEPARATOR, - { 'Purge Files', runner.install("purge") }, - { 'Clear Cache', runner.install("clear") }, - { 'Generate File Database', runner.install("generate") }, - { 'Generate Font Database', runner.install("fonts") }, + { "Purge Files", runner.install("purge") }, + { "Clear Cache", runner.install("clear") }, + { "Generate File Database", runner.install("generate") }, + { "Generate Font Database", runner.install("fonts") }, SEPARATOR, - { 'Typeset Listing', runner.install("listing") }, - { 'Process and Arrange', runner.install("arrange") }, + { "Typeset Listing", runner.install("listing") }, + { "Process and Arrange", runner.install("arrange") }, SEPARATOR, - { 'Start Document Service', startservice }, - { 'Goto Document Service', showcommand }, + { "Start Document Service", startservice }, + { "Goto Document Service", showcommand }, SEPARATOR, - { 'Show Unicodes', runner.install("unicodes") }, + { "Show Unicodes", runner.unicodes }, - } + -- We need this bogus entry because otherwise we get a message due to macros.lua. I + -- might need to come up with some proper placeholder. Well, let's for now just + -- live with the crash. + + -- SEPARATOR, + -- + -- { "Select Co_mmand", textadept.editing.goto_line }, + +} - -- newkeys[OSX and 'mc' or 'cc'] = runner.check - newkeys[OSX and 'mr' or 'cr'] = runner.process - newkeys[OSX and 'mp' or 'cp'] = runner.preview - -- newkeys[OSX and 'mx' or 'cx'] = runner.quit -- makes no sense + -- newkeys[OSX and "mc" or "cc"] = runner.check + newkeys[OSX and "mr" or "cr"] = runner.process + newkeys[OSX and "mp" or "cp"] = runner.preview + -- newkeys[OSX and "mx" or "cx"] = runner.quit -- makes no sense - newkeys['f7'] = runner.process - newkeys['f12'] = runner.process + newkeys["f7"] = runner.process + newkeys["f12"] = runner.process + + newkeys["f2"] = runner.unicodes end @@ -408,19 +420,19 @@ do end function set_endoding_utf8() - set_encoding('UTF-8') + set_encoding("UTF-8") end function set_encoding_ascii() - set_encoding('ASCII') + set_encoding("ASCII") end function set_endoding_utf16le() - set_encoding('UTF-16LE') + set_encoding("UTF-16LE") end function set_endoding_utf16Be() - set_encoding('UTF-16BE') + set_encoding("UTF-16BE") end function goto_prev_buffer() @@ -433,50 +445,50 @@ do newmenu.buffer = { - title = '_Buffer', + title = "_Buffer", SEPARATOR, - { '_Previous Buffer', goto_prev_buffer }, - { '_Next Buffer', goto_next_buffer }, - { '_Switch to Buffer', ui.switch_buffer }, + { "_Previous Buffer", goto_prev_buffer }, + { "_Next Buffer", goto_next_buffer }, + { "_Switch to Buffer", ui.switch_buffer }, SEPARATOR, - { '_Toggle Use Tabs', use_tabs }, + { "_Toggle Use Tabs", use_tabs }, { - title = 'EOL Mode', + title = "EOL Mode", - { '_CRLF', set_eol_mode_crlf }, - { '_LF', set_eol_mode_lf }, + { "_CRLF", set_eol_mode_crlf }, + { "_LF", set_eol_mode_lf }, }, { - title = 'Encoding', + title = "Encoding", - { '_ASCII', set_encoding_ascii }, - { '_UTF-8', set_encoding_utf8 }, - { 'UTF-16-_BE', set_encoding_utf16le }, - { 'UTF-16-_LE', set_encoding_utf16be }, + { "_ASCII", set_encoding_ascii }, + { "_UTF-8", set_encoding_utf8 }, + { "UTF-16-_BE", set_encoding_utf16le }, + { "UTF-16-_LE", set_encoding_utf16be }, }, SEPARATOR, - { 'Toggle View _EOL', show_eol }, - { 'Toggle _Wrap Mode', wrap_mode }, - { 'Toggle View _Spacing', show_whitespace }, + { "Toggle View _EOL", show_eol }, + { "Toggle _Wrap Mode", wrap_mode }, + { "Toggle View _Spacing", show_whitespace }, SEPARATOR, - { 'Select _Lexer', textadept.file_types.select_lexer }, - { 'Refresh _Syntax Highlighting', update_lexing } + { "Select _Lexer", textadept.file_types.select_lexer }, + { "Refresh _Syntax Highlighting", update_lexing } } - newkeys['f5'] = update_lexing + newkeys["f5"] = update_lexing - newkeys[OSX and 'mp' or 'cs\t'] = goto_prev_buffer - newkeys[OSX and 'mn' or 'c\t'] = goto_next_buffer - newkeys[OSX and 'mb' or 'cb'] = ui.switch_buffer + newkeys[OSX and "mp" or "cs\t"] = goto_prev_buffer + newkeys[OSX and "mn" or "c\t"] = goto_next_buffer + newkeys[OSX and "mb" or "cb"] = ui.switch_buffer end @@ -502,34 +514,34 @@ do newmenu.view = { - title = '_View', + title = "_View", SEPARATOR, - { 'Toggle Current _Fold' , toggle_current_fold }, + { "Toggle Current _Fold" , toggle_current_fold }, SEPARATOR, - { 'Toggle Show In_dent Guides', toggle_show_guides }, - { 'Toggle _Virtual Space', toggle_virtual_space }, + { "Toggle Show In_dent Guides", toggle_show_guides }, + { "Toggle _Virtual Space", toggle_virtual_space }, SEPARATOR, - { 'Zoom _In', buffer.zoom_in }, - { 'Zoom _Out', buffer.zoom_out }, - { '_Reset Zoom', reset_zoom }, + { "Zoom _In", buffer.zoom_in }, + { "Zoom _Out", buffer.zoom_out }, + { "_Reset Zoom", reset_zoom }, } - newkeys[OSX and 'm=' or 'c='] = buffer.zoom_in - newkeys[OSX and 'm-' or 'c-'] = buffer.zoom_out - newkeys[OSX and 'm0' or 'c0'] = reset_zoom + newkeys[OSX and "m=" or "c="] = buffer.zoom_in + newkeys[OSX and "m-" or "c-"] = buffer.zoom_out + newkeys[OSX and "m0" or "c0"] = reset_zoom end do - -- It's a pitt y that we can't have a proper monospaced font here so we try to make the best of it: + -- It"s a pitt y that we can"t have a proper monospaced font here so we try to make the best of it: local template = "\n\trelease info: %s\t\n\n\tcopyright: %s\t\n\n\tvariant: ConTeXt related editing\t\n\n\tadapted by: Hans Hagen\t" @@ -541,27 +553,54 @@ do end local function open_url(url) -- adapted from non public open_page - local cmd = (WIN32 and 'start ""') or (OSX and 'open') or 'xdg-open' - spawn(format('%s "%s"', cmd, url)) + local cmd = (WIN32 and 'start ""') or (OSX and "open") or "xdg-open" + os.spawn(format('%s "%s"', cmd, url)) end newmenu.help = { - title = '_Help', + title = "_Help", SEPARATOR, - { 'ConTeXt garden wiki', function() open_url("http://www.contextgarden.net") end }, + { "ConTeXt garden wiki", function() open_url("http://www.contextgarden.net") end }, -- SEPARATOR, - { '_About', show_about } + { "_About", show_about } } end +do + + -- from shift F11 and startup script + + table.insert(textadept.menu.context_menu, SEPARATOR) + + table.insert(textadept.menu.context_menu, { "wrap", runner.wrap }) + table.insert(textadept.menu.context_menu, { "unwrap", runner.unwrap }) + table.insert(textadept.menu.context_menu, { "sort", runner.sort }) + -- table.insert(textadept.menu.context_menu, { "document", function() end }) + -- table.insert(textadept.menu.context_menu, { "quote", function() end }) + -- table.insert(textadept.menu.context_menu, { "compound", function() end }) + -- table.insert(textadept.menu.context_menu, { "add", function() end }) + -- table.insert(textadept.menu.context_menu, { "bidi", function() end }) + -- table.insert(textadept.menu.context_menu, { "strip", function() end }) + + + -- cM wrap + -- cR reset spelling + -- cI insert template + -- cE show log + -- c+ toggle strip + + newkeys[OSX and "mm" or "cm"] = runner.wrap + +end + do local function replace(oldmenu,newmenu) @@ -575,13 +614,13 @@ do end end - replace(textadept.menu.menubar [_L['_File']], newmenu.file) - replace(textadept.menu.menubar [_L['_Edit']], newmenu.edit) - replace(textadept.menu.menubar [_L['_Search']], newmenu.search) - replace(textadept.menu.menubar [_L['_Tools']], newmenu.tools) - replace(textadept.menu.menubar [_L['_Buffer']], newmenu.buffer) - replace(textadept.menu.menubar [_L['_View']], newmenu.view) - replace(textadept.menu.menubar [_L['_Help']], newmenu.help) + replace(textadept.menu.menubar [_L["_File"]], newmenu.file) + replace(textadept.menu.menubar [_L["_Edit"]], newmenu.edit) + replace(textadept.menu.menubar [_L["_Search"]], newmenu.search) + replace(textadept.menu.menubar [_L["_Tools"]], newmenu.tools) + replace(textadept.menu.menubar [_L["_Buffer"]], newmenu.buffer) + replace(textadept.menu.menubar [_L["_View"]], newmenu.view) + replace(textadept.menu.menubar [_L["_Help"]], newmenu.help) local char = string.char @@ -635,6 +674,19 @@ do keys[k] = v end + -- add helper to textadept-context-runner.lua instead + + events.connect(events.INITIALIZED, function() + for i=1,#_BUFFERS do + local buffer = _BUFFERS[i] + if buffer._type == OUTPUT_BUFFER then + view:goto_buffer(i) + io.close_buffer() + return + end + end + end) + end -- We have a different way to set up files and runners. Less distributed and morein the way we diff --git a/context/data/textadept/context/modules/textadept-context-runner.lua b/context/data/textadept/context/modules/textadept-context-runner.lua index d78a4f949..1181b13a3 100644 --- a/context/data/textadept/context/modules/textadept-context-runner.lua +++ b/context/data/textadept/context/modules/textadept-context-runner.lua @@ -28,7 +28,9 @@ local info = { -- Somehow the process hangs when I refresh the pdf viewer, this doesn't happen in scite so -- the underlying code is for the moment less reliant. -local match, gsub, find, format = string.match, string.gsub, string.find, string.format +local match, gsub, find, format, gmatch, rep = string.match, string.gsub, string.find, string.format, string.gmatch, string.rep +local char, lower, upper, sub = string.char, string.lower, string.upper, string.sub +local concat, sort = table.concat, table.sort local assert, type = assert, type local original = textadept.run @@ -82,10 +84,17 @@ local function print_output(str) print_buffer:append_text(str) print_buffer:goto_pos(buffer.length) print_buffer:set_save_point() - -- return true -- quits end +local function trace_output(str) + xbuffer = buffer + print_output(str) + if xbuffer then + view:goto_buffer(xbuffer) + end +end + local function clear_output() xbuffer = buffer local print_buffer = find_buffer(OUTPUT_BUFFER) @@ -99,8 +108,16 @@ local function is_output(buffer) end -- Instead of events we will have out own interceptors so that we don't have --- interference. The main problem is that we don't hav emuch control over the --- order. If we have much actions I can always come up with something. +-- interference. The main problem is that we don't have much control over the +-- order. If we have much actions I can always come up with something. + +-- The textadept console seems a bit slower than the one in scite (which does some +-- output pane parsing so it could be even faster). Maybe it relates to the way +-- the program is run. Scite provides some more control over this. It might have +-- to do with the way tex pipes to the console, because from a simple lua run it's +-- quite fast. Maybe calling cmd is not optimal. Anyhow, it means that for now I +-- should not use textadept when running performance test that need to compare with +-- the past. local function process(buffer,filename,action) if not filename then @@ -153,21 +170,21 @@ local function process(buffer,filename,action) local function emit_output(output) print_output(output) -- events.emit(RUNNER_EVENT,...) -- afaik there is no way to check if we're waiting for input (no input callback) - if quitter then - local quit, message = quitter(interceptor) - if quit then - if message then - print_output(format("\n\n> quit: %s\n",message)) - end - runner.quit() - end - end + if quitter then + local quit, message = quitter(interceptor) + if quit then + if message then + print_output(format("\n\n> quit: %s\n",message)) + end + runner.quit() + end + end end local function exit_output(status) print_output(format("\n\n> exit: %s, press esc to return to source\n",status)) -- events.emit(RUNNER_EVENT,...) end print_output(format("> command: %s\n",command)) -- events.emit(RUNNER_EVENT,...) - currentprocess = assert(spawn(command, pathpart, emit_output, emit_output, exit_output)) + currentprocess = assert(os.spawn(command, pathpart, emit_output, emit_output, exit_output)) end function runner.install(name) @@ -223,6 +240,208 @@ local function double_click() end end +-- + +local l2 = char(0xC0) +local l3 = char(0xE0) +local l4 = char(0xF0) + +local function utflen(str) + local n = 0 + local l = 0 + for s in gmatch(str,".") do + if l > 0 then + l = l - 1 + else + n = n + 1 + if s >= l4 then + l = 3 + elseif s >= l3 then + l = 2 + elseif s >= l2 then + l = 1 + end + end + end + return n +end + +local function prepare() + local startposition = buffer.selection_start + local endposition = buffer.selection_end + + if startposition == endposition then return end + + buffer.current_pos = startposition + buffer:home() + + buffer.current_pos = endposition + buffer:line_end_extend() + + local firstposition = buffer.selection_start + local lastposition = buffer.selection_end + + local firstline = buffer:line_from_position(startposition) + local lastline = buffer:line_from_position(endposition) + + local startcolumn = startposition - firstposition + local endcolumn = lastposition - endposition + 1 + local selection = buffer:get_sel_text() + + -- trace_output(firstposition .. " " .. startposition .. "\n") + -- trace_output(endposition .. " " .. lastposition .. "\n") + + return startposition, endposition, firstposition, lastposition, startcolumn, endcolumn, firstline, lastline, selection +end + +local function replace(startposition,lastposition,replacement) + if type(replacement) == "table" then + replacement = concat(replacement,"\n") + end + -- trace_output(replacement .. "\n") + + buffer.current_pos = startposition + + buffer:begin_undo_action() + buffer:set_target_range(startposition,lastposition) + buffer:replace_target(replacement) + buffer:end_undo_action() + + buffer.selection_start = startposition + buffer.selection_end = startposition +end + +-- This is old code, from my early lua days, so not that nice and optimal, but +-- no one sees it and performance is irrelevant here. + +local magicstring = rep("<ctx-crlf/>", 2) + +function runner.wrap() + + local startposition, endposition, firstposition, lastposition, startcolumn, endcolumn, firstline, lastline, selection = prepare() + + if not startposition then + return + end + + local wraplength = buffer.wrap_length + local length = tonumber(wraplength) or 80 + local replacement = { } + local templine = "" + local tempsize = 0 + local indentation = rep(' ',startcolumn) + + selection = gsub(selection,"[\n\r][\n\r]","\n") + selection = gsub(selection,"\n\n+"," " .. magicstring .. " ") + selection = gsub(selection,"^%s",'') + + for snippet in gmatch(selection,"%S+") do + if snippet == magicstring then + replacement[#replacement+1] = templine + replacement[#replacement+1] = "" + templine = "" + tempsize = 0 + else + local snipsize = utflen(snippet) + if tempsize + snipsize > length then + replacement[#replacement+1] = templine + templine = indentation .. snippet + tempsize = startcolumn + snipsize + elseif tempsize == 0 then + templine = indentation .. snippet + tempsize = tempsize + startcolumn + snipsize + else + templine = templine .. " " .. snippet + tempsize = tempsize + 1 + snipsize + end + end + end + + replacement[#replacement+1] = templine + replacement[1] = gsub(replacement[1],"^%s+","") + + if endcolumn == 0 then + replacement[#replacement+1] = "" + end + + replace(startposition,lastposition,replacement) + +end + +local magicstring = rep("<multiplelines/>", 2) + +function runner.unwrap() + + local startposition, endposition, firstposition, lastposition, startcolumn, endcolumn, selection, firstline, lastline = prepare() + + if not startposition then + return + end + + startposition = firstposition + endposition = lastposition + + local selection = gsub(selection,"[\n\r][\n\r]+", " " .. magicstring .. " ") + local replacement = { } + + for snippet in gmatch(selection,"%S+") do + replacement[#replacement+1] = snippet == magicstring and "" or snippet + end + + if endcolumn == 0 then + replacement[#replacement+1] = "" + end + + replace(startposition,lastposition,replacement) + +end + +-- This is real old crappy code which doesn't really pass my current qa standards but +-- it does the job so ... (hashing the blobs would work ok). + +local function grab(str,delimiter) + local list = { } + for snippet in gmatch(str,delimiter) do + list[#list+1] = snippet + end + return list +end + +local function alphacmp_yes(a,b) + return lower(gsub(sub(a,i),"0"," ")) < lower(gsub(sub(b,i),"0"," ")) +end + +local function alphacmp_nop(a,b) + return lower(a) < lower(b) +end + +local function alphasort(list,i) + sort(list,i and i > 0 and alphacmp_yes or alphacmp_nop) +end + +function runner.sort() + + local startposition, endposition, firstposition, lastposition, startcolumn, endcolumn, firstline, lastline, selection = prepare() + + if not startposition then + return + end + + startposition = firstposition + endposition = lastposition + + local list = grab(selection,"[^\n\r]+") + + alphasort(list,startcolumn) + + if endcolumn == 0 then + list[#list+1] = "" + end + + replace(startposition,lastposition,list) + +end + -- Tricky: we can't reset an event (because we need to know the function which is -- local. So, a first solution injected a false into the table which will trigger -- a break and then I found out that returning true has the same effect. Then I @@ -235,6 +454,609 @@ events.connect(events.CHAR_ADDED, char_added, 1) events.connect(events.KEYPRESS, key_press, 1) events.connect(events.DOUBLE_CLICK, double_click, 1) +-- We need to get rid of the crash due to macros.lua event crash in +-- +-- -- textadept.menu.menubar[_L['_Tools']][_L['Select Co_mmand']][2], + +-- for i=1,#_VIEWS do +-- if _VIEWS[i].buffer._type == "[Message Buffer]" then +-- ui.goto_view(_VIEWS[i]) +-- buffer.current_pos = buffer.current_pos +-- io.close_buffer() +-- break +-- end +-- end +-- for i = 1, #_BUFFERS do +-- if _BUFFERS[i]._type == "[Message Buffer]" then +-- view:goto_buffer(_BUFFERS[i]) +-- buffer.current_pos = buffer.current_pos +-- io.close_buffer() +-- break +-- end +-- end + +-- I don't want the indentation. I also want an extra space which in turn means +-- a more extensive test. I also don't care about a suffix. Adapted a bit to +-- match the code above. + +function runner.blockcomment() + local buffer = buffer + local comment = textadept.editing.comment_string[buffer:get_lexer(true)] + + if not comment or comment == "" then + return + end + + local prefix = comment:match('^([^|]+)|?([^|]*)$') + local usedprefix = prefix + + if not prefix then + return + end + + if not find(prefix,"%s$") then + usedprefix = prefix .. " " + end + + local n_prefix = #prefix + local n_usedprefix = #usedprefix + + local startposition = buffer.selection_start + local endposition = buffer.selection_end + local firstline = buffer:line_from_position(startposition) + local lastline = buffer:line_from_position(endposition) + + if firstline ~= lastline and endposition == buffer:position_from_line(lastline) then + lastline = lastline - 1 + end + + startposition = buffer.line_end_position[startposition] - startposition + endposition = buffer.length - endposition + + buffer:begin_undo_action() + + for line=firstline,lastline do + local p = buffer:position_from_line(line) + if buffer:text_range(p, p + n_usedprefix) == usedprefix then + buffer:delete_range(p, n_usedprefix) + elseif buffer:text_range(p, p + n_prefix) == prefix then + buffer:delete_range(p, n_prefix) + else + buffer:insert_text(p, usedprefix) + end + end + + buffer:end_undo_action() + + startposition = buffer.line_end_position[firstline] - startposition + endposition = buffer.length - endposition + + -- whatever ... + + local start_pos = buffer:position_from_line(firstline) + + if start_pos > startposition then + startposition = start_pos + end + if start_pos > endposition then + endposition = start_pos + end + + if firstline ~= lastline then + buffer:set_sel(startposition, endposition) + else + buffer:goto_pos(endposition) + end +end + +-- This only works partially as for some reason scite shows proper math symbols while +-- here we don't see them. I need to look into that. + +local textlists = { -- taken from sort-lan.lua + en = { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", + "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", + "u", "v", "w", "x", "y", "z", + + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", + "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", + "U", "V", "W", "X", "Y", "Z", + }, + nl = { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", + "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", + "u", "v", "w", "x", "y", "z", + + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", + "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", + "U", "V", "W", "X", "Y", "Z", + }, + fr = { + "a", "æ", "b", "c", "ç", "d", "e", "è", "é", "ê", + "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", + "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", + "z", + + "A", "Æ", "B", "C", "Ç", "D", "E", "È", "É", "Ê", + "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", + "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", + "Z", + + }, + de = { + "a", "ä", "b", "c", "d", "e", "f", "g", "h", "i", + "j", "k", "l", "m", "n", "o", "ö", "p", "q", "r", + "s", "ß", "t", "u", "ü", "v", "w", "x", "y", "z", + + "A", "Ä", "B", "C", "D", "E", "F", "G", "H", "I", + "J", "K", "L", "M", "N", "O", "Ö", "P", "Q", "R", + "S", "SS", "T", "U", "Ü", "V", "W", "X", "Y", "Z", + }, + fi = { -- finish + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", + "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", + "u", "v", "w", "x", "y", "z", "å", "ä", "ö", + + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", + "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", + "U", "V", "W", "X", "Y", "Z", "Å", "Ä", "Ö", + }, + sl = { -- slovenian + "a", "b", "c", "č", "ć", "d", "đ", "e", "f", "g", "h", "i", + "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "š", "t", + "u", "v", "w", "x", "y", "z", "ž", + + "A", "B", "C", "Č", "Ć", "D", "Đ", "E", "F", "G", "H", "I", + "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "Š", "T", + "U", "V", "W", "X", "Y", "Z", "Ž", + }, + ru = { -- rusian + "а", "б", "в", "г", "д", "е", "ё", "ж", "з", "и", + "і", "й", "к", "л", "м", "н", "о", "п", "р", "с", + "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ы", + "ь", "ѣ", "э", "ю", "я", "ѳ", "ѵ", + + "А", "Б", "В", "Г", "Д", "Е", "Ё", "Ж", "З", "И", + "І", "Й", "К", "Л", "М", "Н", "О", "П", "Р", "С", + "Т", "У", "Ф", "Х", "Ц", "Ч", "Ш", "Щ", "Ъ", "Ы", + "Ь", "Ѣ", "Э", "Ю", "Я", "Ѳ", "Ѵ", + }, + uk = { -- ukraninuan + "а", "б", "в", "г", "ґ", "д", "е", "є", "ж", "з", "и", "і", + "ї", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", + "ф", "х", "ц", "ч", "ш", "щ", "ь", "ю", "я", + + "А", "Б", "В", "Г", "Ґ", "Д", "Е", "Є", "Ж", "З", "И", "І", + "Ї", "Й", "К", "Л", "М", "Н", "О", "П", "Р", "С", "Т", "У", + "Ф", "Х", "Ц", "Ч", "Ш", "Щ", "Ь", "Ю", "Я", + }, + be = { -- belarusia + "а", "б", "в", "г", "д", "е", "ё", "ж", "з", "і", + "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", + "у", "ў", "ф", "х", "ц", "ч", "ш", "ы", "ь", "э", + "ю", "я", + + "А", "Б", "В", "Г", "Д", "Е", "Ё", "Ж", "З", "І", + "Й", "К", "Л", "М", "Н", "О", "П", "Р", "С", "Т", + "У", "Ў", "Ф", "Х", "Ц", "Ч", "Ш", "Ы", "Ь", "Э", + "Ю", "Я", + }, + bg = { -- bulgarian + "а", "б", "в", "г", "д", "е", "ж", "з","и", "й", + "к", "a", "л", "a", "м", "н", "о", "п", "р", "с", + "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ъ", "ь", + "ю", "я", + + "А", "Б", "В", "Г", "Д", "Е", "Ж", "З","И", "Й", + "К", "A", "Л", "A", "М", "Н", "О", "П", "Р", "С", + "Т", "У", "Ф", "Х", "Ц", "Ч", "Ш", "Щ", "Ъ", "Ь", + "Ю", "Я", + }, + pl = { -- polish + "a", "ą", "b", "c", "ć", "d", "e", "ę", "f", "g", + "h", "i", "j", "k", "l", "ł", "m", "n", "ń", "o", + "ó", "p", "q", "r", "s", "ś", "t", "u", "v", "w", + "x", "y", "z", "ź", "ż", + + "A", "Ą", "B", "C", "Ć", "D", "E", "Ę", "F", "G", + "H", "I", "J", "K", "L", "Ł", "M", "N", "Ń", "O", + "Ó", "P", "Q", "R", "S", "Ś", "T", "U", "V", "W", + "X", "Y", "Z", "Ź", "Ż", + }, + cz = { -- czech + "a", "á", "b", "c", "č", "d", "ď", "e", "é", "ě", + "f", "g", "h", "i", "í", "j", "k", "l", "m", + "n", "ň", "o", "ó", "p", "q", "r", "ř", "s", "š", + "t", "ť", "u", "ú", "ů", "v", "w", "x", "y", "ý", + "z", "ž", + + "A", "Á", "B", "C", "Č", "D", "Ď", "E", "É", "Ě", + "F", "G", "H", "I", "Í", "J", "K", "L", "M", + "N", "Ň", "O", "Ó", "P", "Q", "R", "Ř", "S", "Š", + "T", "Ť", "U", "Ú", "Ů", "V", "W", "X", "Y", "Ý", + "Z", "Ž", + }, + sk = { -- slovak + "a", "á", "ä", "b", "c", "č", "d", "ď", + "e", "é", "f", "g", "h", ch, "i", "í", "j", "k", + "l", "ĺ", "ľ", "m", "n", "ň", "o", "ó", "ô", "p", + "q", "r", "ŕ", "s", "š", "t", "ť", "u", "ú", "v", + "w", "x", "y", "ý", "z", "ž", + + "A", "Á", "Ä", "B", "C", "Č", "D", "Ď", + "E", "É", "F", "G", "H", "I", "Í", "J", "K", + "L", "Ĺ", "Ľ", "M", "N", "Ň", "O", "Ó", "Ô", "P", + "Q", "R", "Ŕ", "S", "Š", "T", "Ť", "U", "Ú", "V", + "W", "X", "Y", "Ý", "Z", "Ž", + }, + hr = { -- croatian + "a", "b", "c", "č", "ć", "d", "đ", "e", "f", + "g", "h", "i", "j", "k", "l", "m", "n", + "o", "p", "r", "s", "š", "t", "u", "v", "z", "ž", + + "A", "B", "C", "Č", "Ć", "D", "Đ", "E", "F", + "G", "H", "I", "J", "K", "L", "M", "N", + "O", "P", "R", "S", "Š", "T", "U", "V", "Z", "Ž", + }, + sr = { -- serbian + "а", "б", "в", "г", "д", "ђ", "е", "ж", "з", "и", + "ј", "к", "л", "љ", "м", "н", "њ", "о", "п", "р", + "с", "т", "ћ", "у", "ф", "х", "ц", "ч", "џ", "ш", + + "А", "Б", "В", "Г", "Д", "Ђ", "Е", "Ж", "З", "И", + "Ј", "К", "Л", "Љ", "М", "Н", "Њ", "О", "П", "Р", + "С", "Т", "Ћ", "У", "Ф", "Х", "Ц", "Ч", "Џ", "Ш", + }, + no = { -- norwegian + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", + "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", + "u", "v", "w", "x", "y", "z", "æ", "ø", "å", + + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", + "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", + "U", "V", "W", "X", "Y", "Z", "Æ", "Ø", "Å", + }, + da = { --danish + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", + "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", + "u", "v", "w", "x", "y", "z", "æ", "ø", "å", + + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", + "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", + "U", "V", "W", "X", "Y", "Z", "Æ", "Ø", "Å", + }, + sv = { -- swedish + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", + "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", + "u", "v", "w", "x", "y", "z", "å", "ä", "ö", + + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", + "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", + "U", "V", "W", "X", "Y", "Z", "Å", "Ä", "Ö", + }, + is = { -- islandic + "a", "á", "b", "d", "ð", "e", "é", "f", "g", "h", + "i", "í", "j", "k", "l", "m", "n", "o", "ó", "p", + "r", "s", "t", "u", "ú", "v", "x", "y", "ý", "þ", + "æ", "ö", + + "A", "Á", "B", "D", "Ð", "E", "É", "F", "G", "H", + "I", "Í", "J", "K", "L", "M", "N", "O", "Ó", "P", + "R", "S", "T", "U", "Ú", "V", "X", "Y", "Ý", "Þ", + "Æ", "Ö", + }, + -- gr = { -- greek + -- "α", "ά", "ὰ", "ᾶ", "ᾳ", "ἀ", "ἁ", "ἄ", "ἂ", "ἆ", + -- "ἁ", "ἅ", "ἃ", "ἇ", "ᾁ", "ᾴ", "ᾲ", "ᾷ", "ᾄ", "ᾂ", + -- "ᾅ", "ᾃ", "ᾆ", "ᾇ", "β", "γ", "δ", "ε", "έ", "ὲ", + -- "ἐ", "ἔ", "ἒ", "ἑ", "ἕ", "ἓ", "ζ", "η", "η", "ή", + -- "ὴ", "ῆ", "ῃ", "ἠ", "ἤ", "ἢ", "ἦ", "ᾐ", "ἡ", "ἥ", + -- "ἣ", "ἧ", "ᾑ", "ῄ", "ῂ", "ῇ", "ᾔ", "ᾒ", "ᾕ", "ᾓ", + -- "ᾖ", "ᾗ", "θ", "ι", "ί", "ὶ", "ῖ", "ἰ", "ἴ", "ἲ", + -- "ἶ", "ἱ", "ἵ", "ἳ", "ἷ", "ϊ", "ΐ", "ῒ", "ῗ", "κ", + -- "λ", "μ", "ν", "ξ", "ο", "ό", "ὸ", "ὀ", "ὄ", "ὂ", + -- "ὁ", "ὅ", "ὃ", "π", "ρ", "ῤ", "ῥ", "σ", "ς", "τ", + -- "υ", "ύ", "ὺ", "ῦ", "ὐ", "ὔ", "ὒ", "ὖ", "ὑ", "ὕ", + -- "ὓ", "ὗ", "ϋ", "ΰ", "ῢ", "ῧ", "φ", "χ", "ψ", "ω", + -- "ώ", "ὼ", "ῶ", "ῳ", "ὠ", "ὤ", "ὢ", "ὦ", "ᾠ", "ὡ", + -- "ὥ", "ὣ", "ὧ", "ᾡ", "ῴ", "ῲ", "ῷ", "ᾤ", "ᾢ", "ᾥ", + -- "ᾣ", "ᾦ", "ᾧ", + -- + -- "Α", "Ά", "Ὰ", "Α͂", "Ἀ", "Ἁ", "Ἄ", "Ἂ", "Ἆ", + -- "Ἁ", "Ἅ", "Ἃ", "Ἇ", + -- "Β", "Γ", "Δ", "Ε", "Έ", "Ὲ", + -- "Ἐ", "Ἔ", "Ἒ", "Ἑ", "Ἕ", "Ἓ", "Ζ", "Η", "Η", "Ή", + -- "Ὴ", "Η͂", "Ἠ", "Ἤ", "Ἢ", "Ἦ", "Ἡ", "Ἥ", + -- "Ἣ", "Ἧ", + -- "Θ", "Ι", "Ί", "Ὶ", "Ι͂", "Ἰ", "Ἴ", "Ἲ", + -- "Ἶ", "Ἱ", "Ἵ", "Ἳ", "Ἷ", "Ϊ", "Ϊ́", "Ϊ̀", "Ϊ͂", "Κ", + -- "Λ", "Μ", "Ν", "Ξ", "Ο", "Ό", "Ὸ", "Ὀ", "Ὄ", "Ὂ", + -- "Ὁ", "Ὅ", "Ὃ", "Π", "Ρ", "Ρ̓", "Ῥ", "Σ", "Σ", "Τ", + -- "Υ", "Ύ", "Ὺ", "Υ͂", "Υ̓", "Υ̓́", "Υ̓̀", "Υ̓͂", "Ὑ", "Ὕ", + -- "Ὓ", "Ὗ", "Ϋ", "Ϋ́", "Ϋ̀", "Ϋ͂", "Φ", "Χ", "Ψ", "Ω", + -- "Ώ", "Ὼ", "Ω͂", "Ὠ", "Ὤ", "Ὢ", "Ὦ", "Ὡ", + -- "Ὥ", "Ὣ", "Ὧ", + -- }, + gr = { -- greek + "α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", + "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "ς", "τ", "υ", + "φ", "χ", "ψ", "ω", + + "Α", "Β", "Γ", "Δ", "Ε", "Ζ", "Η", "Θ", "Ι", "Κ", + "Λ", "Μ", "Ν", "Ξ", "Ο", "Π", "Ρ", "Σ", "Τ", "Υ", + "Χ", "Ψ", "Ω", + }, + la = { -- latin + "a", "ā", "ă", "b", "c", "d", "e", "ē", "ĕ", "f", + "g", "h", "i", "ī", "ĭ", "j", "k", "l", "m", "n", + "o", "ō", "ŏ", "p", "q", "r", "s", "t", "u", "ū", + "ŭ", "v", "w", "x", "y", "ȳ", "y̆", "z", "æ", + + "A", "Ā", "Ă", "B", "C", "D", "E", "Ē", "Ĕ", "F", + "G", "H", "I", "Ī", "Ĭ", "J", "K", "L", "M", "N", + "O", "Ō", "Ŏ", "P", "Q", "R", "S", "T", "U", "Ū", + "Ŭ", "V", "W", "X", "Y", "Ȳ", "Y̆", "Z", "Æ", + }, + it = { -- italian + "a", "á", "b", "c", "d", "e", "é", "è", "f", "g", + "h", "i", "í", "ì", "j", "k", "l", "m", "n", "o", + "ó", "ò", "p", "q", "r", "s", "t", "u", "ú", "ù", + "v", "w", "x", "y", "z", + + "A", "Á", "B", "C", "D", "E", "É", "È", "F", "G", + "H", "I", "Í", "Ì", "J", "K", "L", "M", "N", "O", + "Ó", "Ò", "P", "Q", "R", "S", "T", "U", "Ú", "Ù", + "V", "W", "X", "Y", "Z", + }, + ro = { -- romanian + "a", "ă", "â", "b", "c", "d", "e", "f", "g", "h", + "i", "î", "j", "k", "l", "m", "n", "o", "p", "q", + "r", "s", "ș", "t", "ț", "u", "v", "w", "x", "y", + "z", + + "A", "Ă", "Â", "B", "C", "D", "E", "F", "G", "H", + "I", "Î", "J", "K", "L", "M", "N", "O", "P", "Q", + "R", "S", "Ș", "T", "Ț", "U", "V", "W", "X", "Y", + "Z", + }, + es = { -- spanish + "a", "á", "b", "c", "d", "e", "é", "f", "g", "h", + "i", "í", "j", "k", "l", "m", "n", "ñ", "o", "ó", + "p", "q", "r", "s", "t", "u", "ú", "ü", "v", "w", + "x", "y", "z", + + "A", "Á", "B", "C", "D", "E", "É", "F", "G", "H", + "I", "Í", "J", "K", "L", "M", "N", "Ñ", "O", "Ó", + "P", "Q", "R", "S", "T", "U", "Ú", "Ü", "V", "W", + "X", "Y", "Z", + }, + pt = { -- portuguese + "a", "á", "â", "ã", "à", "b", "c", "ç", "d", "e", + "é", "ê", "f", "g", "h", "i", "í", "j", "k", "l", + "m", "n", "o", "ó", "ô", "õ", "p", "q", "r", "s", + "t", "u", "ú", "ü", "v", "w", "x", "y", "z", + + "A", "Á", "Â", "Ã", "À", "B", "C", "Ç", "D", "E", + "É", "Ê", "F", "G", "H", "I", "Í", "J", "K", "L", + "M", "N", "O", "Ó", "Ô", "Õ", "P", "Q", "R", "S", + "T", "U", "Ú", "Ü", "V", "W", "X", "Y", "Z", + }, + lt = { -- lithuanian + "a", "ą", "b", "c", "ch", "č", "d", "e", "ę", "ė", + "f", "g", "h", "i", "į", "y", "j", "k", "l", "m", + "n", "o", "p", "r", "s", "š", "t", "u", "ų", "ū", + "v", "z", "ž", + + "A", "Ą", "B", "C", "CH", "Č", "D", "E", "Ę", "Ė", + "F", "G", "H", "I", "Į", "Y", "J", "K", "L", "M", + "N", "O", "P", "R", "S", "Š", "T", "U", "Ų", "Ū", + "V", "Z", "Ž", + }, + lv = { -- latvian + "a", "ā", "b", "c", "č", "d", "e", "ē", "f", "g", + "ģ", "h", "i", "ī", "j", "k", "ķ", "l", "ļ", "m", + "n", "ņ", "o", "ō", "p", "r", "ŗ", "s", "š", "t", + "u", "ū", "v", "z", "ž", + + "A", "Ā", "B", "C", "Č", "D", "E", "Ē", "F", "G", + "Ģ", "H", "I", "Ī", "J", "K", "Ķ", "L", "Ļ", "M", + "N", "Ņ", "O", "Ō", "P", "R", "Ŗ", "S", "Š", "T", + "U", "Ū", "V", "Z", "Ž", + }, + hu = { -- hungarian + "a", "á", "b", "c", "d", "e", "é", + "f", "g", "h", "i", "í", "j", "k", "l", + "m", "n", "o", "ó", "ö", "ő", "p", "q", "r", + "s", "t", "u", "ú", "ü", "ű", "v", "w", + "x", "y", "z", + + "A", "Á", "B", "C", "D", "E", "É", + "F", "G", "H", "I", "Í", "J", "K", "L", + "M", "N", "O", "Ó", "Ö", "Ő", "P", "Q", "R", + "S", "T", "U", "Ú", "Ü", "Ű", "V", "W", + "X", "Y", "Z", + }, + et = { -- estonian + "a", "b", "d", "e", "f", "g", "h", "i", "j", "k", + "l", "m", "n", "o", "p", "r", "s", "š", "z", "ž", + "t", "u", "v", "w", "õ", "ä", "ö", "ü", "x", "y", + + "A", "B", "D", "E", "F", "G", "H", "I", "J", "K", + "L", "M", "N", "O", "P", "R", "S", "Š", "Z", "Ž", + "T", "U", "V", "W", "Õ", "Ä", "Ö", "Ü", "X", "Y", + }, + -- jp = { -- japanese + -- "あ", "い", "う", "え", "お", "か", "き", "く", "け", "こ", + -- "さ", "し", "す", "せ", "そ", "た", "ち", "つ", "て", "と", + -- "な", "に", "ぬ", "ね", "の", "は", "ひ", "ふ", "へ", "ほ", + -- "ま", "み", "む", "め", "も", "や", "ゆ", "よ", + -- "ら", "り", "る", "れ", "ろ", "わ", "ゐ", "ゑ", "を", "ん", + -- }, +} + +local textselector = { } +for k, v in next, textlists do + textselector[#textselector+1] = k +end +sort(textselector) + +local mathsets = { + { "tf", { + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", + "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" + }, }, + { "bf", { + "𝐛", "𝐜", "𝐝", "𝐞", "𝐟", "𝐠", "𝐡", "𝐢", "𝐣", "𝐤", "𝐥", "𝐦", "𝐧", "𝐨", "𝐩", "𝐪", "𝐫", "𝐬", "𝐭", "𝐮", "𝐯", "𝐰", "𝐱", "𝐲", "𝐳", + "𝐀", "𝐁", "𝐂", "𝐃", "𝐄", "𝐅", "𝐆", "𝐇", "𝐈", "𝐉", "𝐊", "𝐋", "𝐌", "𝐍", "𝐎", "𝐏", "𝐐", "𝐑", "𝐒", "𝐓", "𝐔", "𝐕", "𝐖", "𝐗", "𝐘", "𝐙", "𝐚", + "𝟎", "𝟏", "𝟐", "𝟑", "𝟒", "𝟓", "𝟔", "𝟕", "𝟖", "𝟗" + }, }, + { "it", { + "𝑎", "𝑏", "𝑐", "𝑑", "𝑒", "𝑓", "𝑔", "ℎ", "𝑖", "𝑗", "𝑘", "𝑙", "𝑚", "𝑛", "𝑜", "𝑝", "𝑞", "𝑟", "𝑠", "𝑡", "𝑢", "𝑣", "𝑤", "𝑥", "𝑦", "𝑧", + "𝐴", "𝐵", "𝐶", "𝐷", "𝐸", "𝐹", "𝐺", "𝐻", "𝐼", "𝐽", "𝐾", "𝐿", "𝑀", "𝑁", "𝑂", "𝑃", "𝑄", "𝑅", "𝑆", "𝑇", "𝑈", "𝑉", "𝑊", "𝑋", "𝑌", "𝑍", + }, }, + { "bi", { + "𝒂", "𝒃", "𝒄", "𝒅", "𝒆", "𝒇", "𝒈", "𝒉", "𝒊", "𝒋", "𝒌", "𝒍", "𝒎", "𝒏", "𝒐", "𝒑", "𝒒", "𝒓", "𝒔", "𝒕", "𝒖", "𝒗", "𝒘", "𝒙", "𝒚", "𝒛", + "𝑨", "𝑩", "𝑪", "𝑫", "𝑬", "𝑭", "𝑮", "𝑯", "𝑰", "𝑱", "𝑲", "𝑳", "𝑴", "𝑵", "𝑶", "𝑷", "𝑸", "𝑹", "𝑺", "𝑻", "𝑼", "𝑽", "𝑾", "𝑿", "𝒀", "𝒁", + }, }, + { "sc", { + "𝒵", "𝒶", "𝒷", "𝒸", "𝒹", "ℯ", "𝒻", "ℊ", "𝒽", "𝒾", "𝒿", "𝓀", "𝓁", "𝓂", "𝓃", "ℴ", "𝓅", "𝓆", "𝓇", "𝓈", "𝓉", "𝓊", "𝓋", "𝓌", "𝓍", "𝓎", "𝓏", + "𝒜", "ℬ", "𝒞", "𝒟", "ℰ", "ℱ", "𝒢", "ℋ", "ℐ", "𝒥", "𝒦", "ℒ", "ℳ", "𝒩", "𝒪", "𝒫", "𝒬", "ℛ", "𝒮", "𝒯", "𝒰", "𝒱", "𝒲", "𝒳", "𝒴", + }, }, + { "sc bf", { + "𝓪", "𝓫", "𝓬", "𝓭", "𝓮", "𝓯", "𝓰", "𝓱", "𝓲", "𝓳", "𝓴", "𝓵", "𝓶", "𝓷", "𝓸", "𝓹", "𝓺", "𝓻", "𝓼", "𝓽", "𝓾", "𝓿", "𝔀", "𝔁", "𝔂", "𝔃", + "𝓐", "𝓑", "𝓒", "𝓓", "𝓔", "𝓕", "𝓖", "𝓗", "𝓘", "𝓙", "𝓚", "𝓛", "𝓜", "𝓝", "𝓞", "𝓟", "𝓠", "𝓡", "𝓢", "𝓣", "𝓤", "𝓥", "𝓦", "𝓧", "𝓨", "𝓩", + }, }, + { "fr", { + "𝔞", "𝔟", "𝔠", "𝔡", "𝔢", "𝔣", "𝔤", "𝔥", "𝔦", "𝔧", "𝔨", "𝔩", "𝔪", "𝔫", "𝔬", "𝔭", "𝔮", "𝔯", "𝔰", "𝔱", "𝔲", "𝔳", "𝔴", "𝔵", "𝔶", "𝔷", + "𝔄", "𝔅", "ℭ", "𝔇", "𝔈", "𝔉", "𝔊", "ℌ", "ℑ", "𝔍", "𝔎", "𝔏", "𝔐", "𝔑", "𝔒", "𝔓", "𝔔", "ℜ", "𝔖", "𝔗", "𝔘", "𝔙", "𝔚", "𝔛", "𝔜", "ℨ", + }, }, + { "ds", { + "𝕓", "𝕔", "𝕕", "𝕖", "𝕗", "𝕘", "𝕙", "𝕚", "𝕛", "𝕜", "𝕝", "𝕞", "𝕟", "𝕠", "𝕡", "𝕢", "𝕣", "𝕤", "𝕥", "𝕦", "𝕧", "𝕨", "𝕩", "𝕪", "𝕫", + "𝔸", "𝔹", "ℂ", "𝔻", "𝔼", "𝔽", "𝔾", "ℍ", "𝕀", "𝕁", "𝕂", "𝕃", "𝕄", "ℕ", "𝕆", "ℙ", "ℚ", "ℝ", "𝕊", "𝕋", "𝕌", "𝕍", "𝕎", "𝕏", "𝕐", "ℤ", "𝕒", + "𝟘", "𝟙", "𝟚", "𝟛", "𝟜", "𝟝", "𝟞", "𝟟", "𝟠", "𝟡" + }, }, + { "fr bf", { + "𝕬", "𝕭", "𝕮", "𝕯", "𝕰", "𝕱", "𝕲", "𝕳", "𝕴", "𝕵", "𝕶", "𝕷", "𝕸", "𝕹", "𝕺", "𝕻", "𝕼", "𝕽", "𝕾", "𝕿", "𝖀", "𝖁", "𝖂", "𝖃", + "𝖄", "𝖅", "𝖆", "𝖇", "𝖈", "𝖉", "𝖊", "𝖋", "𝖌", "𝖍", "𝖎", "𝖏", "𝖐", "𝖑", "𝖒", "𝖓", "𝖔", "𝖕", "𝖖", "𝖗", "𝖘", "𝖙", "𝖚", "𝖛", "𝖜", "𝖝", "𝖞", "𝖟" + }, }, + { "ss tf", { + "𝖺", "𝖻", "𝖼", "𝖽", "𝖾", "𝖿", "𝗀", "𝗁", "𝗂", "𝗃", "𝗄", "𝗅", "𝗆", "𝗇", "𝗈", "𝗉", "𝗊", "𝗋", "𝗌", "𝗍", "𝗎", "𝗏", "𝗐", "𝗑", "𝗒", "𝗓", + "𝖠", "𝖡", "𝖢", "𝖣", "𝖤", "𝖥", "𝖦", "𝖧", "𝖨", "𝖩", "𝖪", "𝖫", "𝖬", "𝖭", "𝖮", "𝖯", "𝖰", "𝖱", "𝖲", "𝖳", "𝖴", "𝖵", "𝖶", "𝖷", "𝖸", "𝖹", + "𝟢", "𝟣", "𝟤", "𝟥", "𝟦", "𝟧", "𝟨", "𝟩", "𝟪", "𝟫" + }, }, + { "ss bf", { + "𝗮", "𝗯", "𝗰", "𝗱", "𝗲", "𝗳", "𝗴", "𝗵", "𝗶", "𝗷", "𝗸", "𝗹", "𝗺", "𝗻", "𝗼", "𝗽", "𝗾", "𝗿", "𝘀", "𝘁", "𝘂", "𝘃", "𝘄", "𝘅", "𝘆", "𝘇", + "𝗔", "𝗕", "𝗖", "𝗗", "𝗘", "𝗙", "𝗚", "𝗛", "𝗜", "𝗝", "𝗞", "𝗟", "𝗠", "𝗡", "𝗢", "𝗣", "𝗤", "𝗥", "𝗦", "𝗧", "𝗨", "𝗩", "𝗪", "𝗫", "𝗬", "𝗭", + "𝟬", "𝟭", "𝟮", "𝟯", "𝟰", "𝟱", "𝟲", "𝟳", "𝟴", "𝟵", + }, }, + { "ss it", { + "𝘢", "𝘣", "𝘤", "𝘥", "𝘦", "𝘧", "𝘨", "𝘩", "𝘪", "𝘫", "𝘬", "𝘭", "𝘮", "𝘯", "𝘰", "𝘱", "𝘲", "𝘳", "𝘴", "𝘵", "𝘶", "𝘷", "𝘸", "𝘹", "𝘺", "𝘻", + "𝘈", "𝘉", "𝘊", "𝘋", "𝘌", "𝘍", "𝘎", "𝘏", "𝘐", "𝘑", "𝘒", "𝘓", "𝘔", "𝘕", "𝘖", "𝘗", "𝘘", "𝘙", "𝘚", "𝘛", "𝘜", "𝘝", "𝘞", "𝘟", "𝘠", "𝘡", + }, }, + { "ss bi", { + "𝙖", "𝙗", "𝙘", "𝙙", "𝙚", "𝙛", "𝙜", "𝙝", "𝙞", "𝙟", "𝙠", "𝙡", "𝙢", "𝙣", "𝙤", "𝙥", "𝙦", "𝙧", "𝙨", "𝙩", "𝙪", "𝙫", "𝙬", "𝙭", "𝙮", "𝙯", + "𝘼", "𝘽", "𝘾", "𝘿", "𝙀", "𝙁", "𝙂", "𝙃", "𝙄", "𝙅", "𝙆", "𝙇", "𝙈", "𝙉", "𝙊", "𝙋", "𝙌", "𝙍", "𝙎", "𝙏", "𝙐", "𝙑", "𝙒", "𝙓", "𝙔", "𝙕", + }, }, + { "tt", { + "𝚊", "𝚋", "𝚌", "𝚍", "𝚎", "𝚏", "𝚐", "𝚑", "𝚒", "𝚓", "𝚔", "𝚕", "𝚖", "𝚗", "𝚘", "𝚙", "𝚚", "𝚛", "𝚜", "𝚝", "𝚞", "𝚟", "𝚠", "𝚡", "𝚢", "𝚣", + "𝙰", "𝙱", "𝙲", "𝙳", "𝙴", "𝙵", "𝙶", "𝙷", "𝙸", "𝙹", "𝙺", "𝙻", "𝙼", "𝙽", "𝙾", "𝙿", "𝚀", "𝚁", "𝚂", "𝚃", "𝚄", "𝚅", "𝚆", "𝚇", "𝚈", "𝚉", + "𝟶", "𝟷", "𝟸", "𝟹", "𝟺", "𝟻", "𝟼", "𝟽", "𝟾", "𝟿" + }, }, + { "gr tf", { + "α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "ς", "σ", "τ", "υ", "φ", "χ", "ψ", "ω", + "Α", "Β", "Γ", "Δ", "Ε", "Ζ", "Η", "Θ", "Ι", "Κ", "Λ", "Μ", "Ν", "Ξ", "Ο", "Π", "Ρ", "", "Σ", "Τ", "Υ", "Φ", "Χ", "Ψ", "Ω", + }, }, + { "gr bf", { + "𝛂", "𝛃", "𝛄", "𝛅", "𝛆", "𝛇", "𝛈", "𝛉", "𝛊", "𝛋", "𝛌", "𝛍", "𝛎", "𝛏", "𝛐", "𝛑", "𝛒", "𝛓", "𝛔", "𝛕", "𝛖", "𝛗", "𝛘", "𝛙", "𝛚", + "𝚨", "𝚩", "𝚪", "𝚫", "𝚬", "𝚭", "𝚮", "𝚯", "𝚰", "𝚱", "𝚲", "𝚳", "𝚴", "𝚵", "𝚶", "𝚷", "𝚸", "𝚹", "𝚺", "𝚻", "𝚼", "𝚽", "𝚾", "𝚿", "𝛀", + }, }, + { "gr it", { + "𝛼", "𝛽", "𝛾", "𝛿", "𝜀", "𝜁", "𝜂", "𝜃", "𝜄", "𝜅", "𝜆", "𝜇", "𝜈", "𝜉", "𝜊", "𝜋", "𝜌", "𝜍", "𝜎", "𝜏", "𝜐", "𝜑", "𝜒", "𝜓", "𝜔", + "𝛢", "𝛣", "𝛤", "𝛥", "𝛦", "𝛧", "𝛨", "𝛩", "𝛪", "𝛫", "𝛬", "𝛭", "𝛮", "𝛯", "𝛰", "𝛱", "𝛲", "𝛳", "𝛴", "𝛵", "𝛶", "𝛷", "𝛸", "𝛹", "𝛺", + }, }, + { "gr bi", { + "𝜶", "𝜷", "𝜸", "𝜹", "𝜺", "𝜻", "𝜼", "𝜽", "𝜾", "𝜿", "𝝀", "𝝁", "𝝂", "𝝃", "𝝄", "𝝅", "𝝆", "𝝇", "𝝈", "𝝉", "𝝊", "𝝋", "𝝌", "𝝍", "𝝎", + "𝜜", "𝜝", "𝜞", "𝜟", "𝜠", "𝜡", "𝜢", "𝜣", "𝜤", "𝜥", "𝜦", "𝜧", "𝜨", "𝜩", "𝜪", "𝜫", "𝜬", "𝜭", "𝜮", "𝜯", "𝜰", "𝜱", "𝜲", "𝜳", "𝜴", + }, }, + { "gr ss bf", { + "𝝰", "𝝱", "𝝲", "𝝳", "𝝴", "𝝵", "𝝶", "𝝷", "𝝸", "𝝹", "𝝺", "𝝻", "𝝼", "𝝽", "𝝾", "𝝿", "𝞀", "𝞁", "𝞂", "𝞃", "𝞄", "𝞅", "𝞆", "𝞇", "𝞈", + "𝝖", "𝝗", "𝝘", "𝝙", "𝝚", "𝝛", "𝝜", "𝝝", "𝝞", "𝝟", "𝝠", "𝝡", "𝝢", "𝝣", "𝝤", "𝝥", "𝝦", "𝝧", "𝝨", "𝝩", "𝝪", "𝝫", "𝝬", "𝝭", "𝝮", + }, }, + { "gr ss bi", { + "𝞪", "𝞫", "𝞬", "𝞭", "𝞮", "𝞯", "𝞰", "𝞱", "𝞲", "𝞳", "𝞴", "𝞵", "𝞶", "𝞷", "𝞸", "𝞹", "𝞺", "𝞻", "𝞼", "𝞽", "𝞾", "𝞿", "𝟀", "𝟁", "𝟂", + "𝞐", "𝞑", "𝞒", "𝞓", "𝞔", "𝞕", "𝞖", "𝞗", "𝞘", "𝞙", "𝞚", "𝞛", "𝞜", "𝞝", "𝞞", "𝞟", "𝞠", "𝞡", "𝞢", "𝞣", "𝞤", "𝞥", "𝞦", "𝞧", "𝞨", + }, }, + { "op", { + }, }, + { "sy a", { + }, }, + { "sy b", { + }, }, + { "sy c", { + }, }, +} + +local mathlists = { } +local mathselector = { } + +for i=1,#mathsets do + local mathset = mathsets[i] + mathselector[#mathselector+1] = mathset[1] + mathlists[mathset[1]] = mathset[2] +end + +local enabled = 0 +local usedlists = { + { name = "text", current = "en", lists = textlists, selector = textselector }, + { name = "math", current = "tf", lists = mathlists, selector = mathselector }, +} + +-- I haven't found out yet how to create a strip as in scite. + +-- local function make_strip() +-- local used = usedlists[enabled] +-- local lists = used.lists +-- local alphabet = lists[used.current] +-- local selector = "(hide)(" .. concat(used.selector,")(") .. ")" +-- local alphabet = "(" .. used.current .. ":)(" .. concat(alphabet,")(") .. ")" +-- -- scite.StripShow(selector .. "\n" .. alphabet) +-- end +-- +-- local function hide_strip() +-- -- scite.StripShow("") +-- end +-- +-- local function process_strip(control) +-- -- local value = scite.StripValue(control) +-- -- if value == "hide" then +-- -- hide_strip() +-- -- return +-- -- elseif find(value,".+:") then +-- -- return +-- -- end +-- -- local used = usedlists[enabled] +-- -- if used.lists[value] then +-- -- used.current = value +-- -- make_strip() +-- -- else +-- -- editor:insert(editor.CurrentPos,value) +-- -- end +-- end +-- +-- local function ignore_strip() +-- end + +function runner.unicodes(name) +-- enabled = enabled + 1 +-- if usedlists[enabled] then +-- make_strip() +-- else +-- enabled = 0 +-- hide_strip() +-- end +end + return runner -- The ui.print function is a bit heavy as each flush will parse the whole list of buffers. diff --git a/context/data/textadept/context/modules/textadept-context-settings.lua b/context/data/textadept/context/modules/textadept-context-settings.lua index 4a5be38da..6a9f49d51 100644 --- a/context/data/textadept/context/modules/textadept-context-settings.lua +++ b/context/data/textadept/context/modules/textadept-context-settings.lua @@ -61,6 +61,7 @@ if context then buffer.tab_indents = true buffer.back_space_un_indents = true buffer.indentation_guides = not CURSES and buffer.IV_LOOKBOTH or buffer.IV_NONE + buffer.wrap_length = 80 buffer.sel_eol_filled = true -- buffer.sel_alpha = diff --git a/context/data/textadept/context/modules/textadept-context-types.lua b/context/data/textadept/context/modules/textadept-context-types.lua index 552aa4e5f..97fb2e17c 100644 --- a/context/data/textadept/context/modules/textadept-context-types.lua +++ b/context/data/textadept/context/modules/textadept-context-types.lua @@ -21,7 +21,7 @@ local quitter = function(output) end local listing = { - command = [[mtxrun --autogenerate --script context --extra=listing --scite --compact "%basename%"]], -- --autopdf + command = [[mtxrun --autogenerate --script context --autopdf --extra=listing --scite --compact "%basename%"]], quitter = quitter, } @@ -30,14 +30,16 @@ install { suffixes = { "tex", "mkii", - "mkiv", "mkvi", "mkix", "mkxi" + "mkiv", "mkvi", "mkix", "mkxi", + "mkic", "mkci", + }, check = { command = [[mtxrun --autogenerate --script check "%basename%"]], quitter = quitter, }, process = { - command = [[mtxrun --autogenerate --script context "%basename%"]], -- --autopdf, + command = [[mtxrun --autogenerate --script context --autopdf "%basename%"]], quitter = quitter, }, listing = listing, @@ -67,7 +69,7 @@ install { }, check = [[tidy -quiet -utf8 -xml -errors "%basename%"]], process = { - command = [[mtxrun --autogenerate --script context "%basename%"]], -- --autopdf]], + command = [[mtxrun --autogenerate --script context --autopdf "%basename%"]], -- --autopdf]], quitter = quitter, }, listing = listing, diff --git a/context/data/textadept/context/textadept-context.cmd b/context/data/textadept/context/textadept-context.cmd index 716b4896c..633020a88 100644 --- a/context/data/textadept/context/textadept-context.cmd +++ b/context/data/textadept/context/textadept-context.cmd @@ -1,2 +1,56 @@ +@echo off + +rem This script starts textadept in an adapted mode, stripped from all the stuff we don't need, +rem geared at the file formats that context deals with. The reason for this is that first of +rem all we come from scite, but also because the average user doesn't need that much and can +rem get confused by all kind of options that are irrelevant for editing text files. + +rem This startup script assumes that the files can be found relative to this script. It's kind +rem of tricky because textadept, while being quite configurable, is not really made for such a +rem real bare startup situation but after some trial and error, so far it works out ok. There +rem are still some issues due to assumptions in the original code. In the meantime processing +rem a file from within the editing sessions works ok which is a huge improvement over earlier +rem versions of textadept (it was actually a show stopper) so now textadept can be used as a +rem drop in for scite. We're getting there! + +rem Although I like the idea of textadept, it is no longer a simple Lua binding to scintilla +rem and the claim that it is small is no longer true. The number of Lua lines doesn't really +rem say much if there are many third party dll dependencies (at least I see many files in the +rem zip and most of them probably relate to parts of the graphical interface and therefore most +rem is probably not used at all. The more dependencies there are, the less interesting it is to +rem officially support it as one of the reference editors for context, given that tex and friends +rem aim at long term stability. It's huge and unless I'm mistaken there is no minimal lightweight +rem variant for building a stripped down variant (in editing with mono spaced fonts we don't need +rem all that stuff). A small static stripped binary would be really nice to have (and I'd +rem probably default to using textadept then). I might at some point decide to strip more and just +rem provide what we only need (which is less than is there now). We'll see how it evolves. + +rem In the meantime support for scintillua has been dropped which makes scite vulnerable as there +rem is no default scite (yet) with lpeg built in. Anyway, it means that we will not provide an +rem installer for scite or textadept which does the reference highlighting we've been using for +rem decades. It is up to the user: use lightweight scite or a more dependent but also more +rem configurable texadept. It would be really nice to have multiple options for editing (read: if +rem scite would have scintillua on board.) The same is true for notepad++. Each of them has its +rem advantage (and each is used by context users). + +rem Unless the textadept api changes fundamentally (as happened a couple of times before) this +rem should work: + start textadept -u %~dp0 %* +rem I still need to port some of the extra functionality that we have in scite to textadept, which +rem will happen in due time. We use our own lexers because they are more efficient and have some +rem extra options (they were also much faster at that time and could handle very large files; they +rem also build on already existing code in context verbatim mode). By the way, editing char-def.lua +rem in textadept is actually now faster than in scite (using the same lpeg lexers), which is nice. +rem There is no language strip functionality yet as there is no strip (bottom area) as in scite. + +rem The macros.lua file has some hard coded assumptions wrt menu items and the event crashes with a +rem error message that we can't get rid of. I need to figure out a way to close that buffer but +rem somehow the first buffer is closed anyway which is kind of weird. One way out is to just +rem comment: +rem +rem -- textadept.menu.menubar[_L['_Tools']][_L['Select Co_mmand']][2], +rem +rem Maybe I should just copy all the files and remove code we don't need but ... let's delay that +rem as it might get fixed. I'm in no hurry.
\ No newline at end of file diff --git a/doc/context/documents/general/manuals/musings.pdf b/doc/context/documents/general/manuals/musings.pdf Binary files differindex 9d83dd555..26b421a03 100644 --- a/doc/context/documents/general/manuals/musings.pdf +++ b/doc/context/documents/general/manuals/musings.pdf diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf Binary files differindex 2b1a2622c..9912dcbc4 100644 --- a/doc/context/documents/general/qrcs/setup-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf Binary files differindex 357501e49..7e4d7e80d 100644 --- a/doc/context/documents/general/qrcs/setup-de.pdf +++ b/doc/context/documents/general/qrcs/setup-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf Binary files differindex fd58e5805..746f0fb36 100644 --- a/doc/context/documents/general/qrcs/setup-en.pdf +++ b/doc/context/documents/general/qrcs/setup-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf Binary files differindex 8dce1fdc1..983caae19 100644 --- a/doc/context/documents/general/qrcs/setup-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf Binary files differindex 6f10683f4..3eabbcce5 100644 --- a/doc/context/documents/general/qrcs/setup-it.pdf +++ b/doc/context/documents/general/qrcs/setup-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf Binary files differindex 0499538f3..12c1a80ea 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf Binary files differindex 63e8b8585..70d6fdf5f 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-de.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-de.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf Binary files differindex 1f5124d5e..c4fdc96d5 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-en.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-en.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf Binary files differindex 526271805..37da56c95 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf Binary files differindex 6663131d2..8dfb417a2 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-it.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-it.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf Binary files differindex b1b4151cd..a983fbf7b 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf Binary files differindex 9769c32c6..5fa4a71f0 100644 --- a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf Binary files differindex a6051bbb1..8d10733dd 100644 --- a/doc/context/documents/general/qrcs/setup-nl.pdf +++ b/doc/context/documents/general/qrcs/setup-nl.pdf diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf Binary files differindex c6c7bee9d..0672c84f2 100644 --- a/doc/context/documents/general/qrcs/setup-ro.pdf +++ b/doc/context/documents/general/qrcs/setup-ro.pdf diff --git a/doc/context/sources/general/manuals/musings/musings-plain.tex b/doc/context/sources/general/manuals/musings/musings-plain.tex new file mode 100644 index 000000000..757f7300c --- /dev/null +++ b/doc/context/sources/general/manuals/musings/musings-plain.tex @@ -0,0 +1,553 @@ +% language=uk + +% \showfontkerns + +\startcomponent musings-manuals + +\environment musings-style + +\definetyping[narrowtyping][style=\ttx] + +\startchapter[title={About what \CONTEXT\ isn't}] + +\startsection[title={Introduction}] + +It really puzzles me why, when someone someplace asks if \CONTEXT\ is suitable +for her or is his needs, there are answers like: \quotation {You need to think of +\CONTEXT\ as being kind of plain \TEX: you have to define everything yourself.} +That answer probably stems from the fact that for \LATEX\ you load some style +that defines a lot, which you then might need to undefine or redefine, but that's +not part of the answer. + +In the following sections I will go into a bit more detail of what plain \TEX\ is +and how it influences macro packages, especially \CONTEXT . I'm sure I have +discussed this before so consider this another go at it. + +The \type {plain.tex} file start with the line: + +\starttyping +% This is the plain TeX format that's described in The TeXbook. +\stoptyping + +A few lines later we read: + +\starttyping +% And don't modify the file under any circumstances. +\stoptyping + +So, this format related to the \TEX\ reference. It serves as a template for what +is called a macro package. Here I will not go into the details of macro programming +but an occasional snippet of code can be illustrative. + +\stopsection + +\startsection[title={Getting started}] + +The first code we see in the plain file is: + +\startnarrowtyping +\catcode`\{=1 % left brace is begin-group character +\catcode`\}=2 % right brace is end-group character +\catcode`\$=3 % dollar sign is math shift +\catcode`\&=4 % ampersand is alignment tab +\catcode`\#=6 % hash mark is macro parameter character +\catcode`\^=7 \catcode`\^^K=7 % circumflex and uparrow are for superscripts +\catcode`\_=8 \catcode`\^^A=8 % underline and downarrow are for subscripts +\catcode`\^^I=10 % ascii tab is a blank space +\chardef\active=13 \catcode`\~=\active % tilde is active +\catcode`\^^L=\active \outer\def^^L{\par} % ascii form-feed is "\outer\par" +\stopnarrowtyping + +Assigning catcodes to the braces and hash are needed in order to make it possible +to define macros. The dollar is set to enter math mode and the ampersand becomes +a separator in tables. The superscript and subscript also relate to math. Nothing +demands these bindings but they are widely accepted. In this respect \CONTEXT\ is +indeed like plain. + +The tab is made equivalent to a space and a tilde is made active which means that +later on we need to give it some meaning. It is quite normal to make that an +unbreakable space, and one with the width of a digit when we're doing tables. +Now, nothing demands that we have to assume \ASCII\ input but for practical +reasons the formfeed character is made equivalent to a \type {\par}. + +Now what do these \type {^^K} and similar triplets represent? The \type {^^A} +represents character zero and normally all these control characters below decimal +32 (space) are special. The \type {^^I} is the \ASCII\ tab character, and \type +{^^L} the formfeed. But, the ones referred to as uparrow and downarrow in the +comments have only meaning on certain keyboards. So these are typical definitions +that only made sense for Don Knuth at that time and are not relevant in other +macro packages that aim at standardized input media. + +\startnarrowtyping +% We had to define the \catcodes right away, before the message line, since +% \message uses the { and } characters. When INITEX (the TeX initializer) starts +% up, it has defined the following \catcode values: +% +% \catcode`\^^@=9 % ascii null is ignored +% \catcode`\^^M=5 % ascii return is end-line +% \catcode`\\=0 % backslash is TeX escape character +% \catcode`\%=14 % percent sign is comment character +% \catcode`\ =10 % ascii space is blank space +% \catcode`\^^?=15 % ascii delete is invalid +% \catcode`\A=11 ... \catcode`\Z=11 % uppercase letters +% \catcode`\a=11 ... \catcode`\z=11 % lowercase letters +% all others are type 12 (other) +\stopnarrowtyping + +The comments above speak for themselves. Changing catcodes is one way to adapt +interpretation. For instance, in verbatim mode most catcodes can best be made +letter or other. In \CONTEXT\ we always had so called catcode regimes: for +defining macros, for normal text, for \XML, for verbatim, etc. In \MKIV\ this +mechanism was adapted to the new catcode table mechanism available in that +engine. It was one of the first things we added to \LUATEX. So, again, although +we follow some standards (expectations) \CONTEXT\ differs from plain. + +\startnarrowtyping +% We make @ signs act like letters, temporarily, to avoid conflict between user +% names and internal control sequences of plain format. + +\catcode`@=11 +\stopnarrowtyping + +In \CONTEXT\ we went a step further and when defining macros also adapted +the catcode of \type {!} and \type {?} and later in \MKIV\ \type {_}. When +we're in unprotected mode this applies. In addition to regular text +input math is dealt with: + +\startnarrowtyping +% INITEX sets up \mathcode x=x, for x=0..255, except that +% +% \mathcode x=x+"7100, for x = `A to `Z and `a to `z; +% \mathcode x=x+"7000, for x = `0 to `9. + +% The following changes define internal codes as recommended in Appendix C of +% The TeXbook: + +\mathcode`\^^@="2201 % \cdot +\mathcode`\^^A="3223 % \downarrow +\mathcode`\^^B="010B % \alpha +\mathcode`\^^C="010C % \beta +.................... +\mathcode`\|="026A +\mathcode`\}="5267 +\mathcode`\^^?="1273 % \smallint +\stopnarrowtyping + +Here we see another set of definitions but the alphabetic ones are not defined in +\CONTEXT, they are again bindings to the authors special keyboard. + +\startnarrowtyping +% INITEX sets \sfcode x=1000 for all x, except that \sfcode`X=999 for uppercase +% letters. The following changes are needed: + +\sfcode`\)=0 \sfcode`\'=0 \sfcode`\]=0 + +% The \nonfrenchspacing macro will make further changes to \sfcode values. +\stopnarrowtyping + +Definitions like this depend on the language. Because original \TEX\ was mostly +meant for typesetting English, these things are hard coded. In \CONTEXT\ such +definitions relate to languages. + +I show these definitions because they also illustrate what \TEX\ is about: +typesetting math: + +\startnarrowtyping +% Finally, INITEX sets all \delcode values to -1, except \delcode`.=0 + +\delcode`\(="028300 +\delcode`\)="029301 +\delcode`\[="05B302 +\delcode`\]="05D303 +\delcode`\<="26830A +\delcode`\>="26930B +\delcode`\/="02F30E +\delcode`\|="26A30C +\delcode`\\="26E30F + +% N.B. { and } should NOT get delcodes; otherwise parameter grouping fails! +\stopnarrowtyping + +Watch the last comment. One of the complications of \TEX\ is that because some +characters have special meanings, we also need to deal with exceptions. It also +means that arbitrary input is not possible. For instance, unless the percent +character is made a letter, everything following it till the end of a line will +be discarded. This is an areas where macro packages can differ but in \MKII\ we +followed these rules. In \MKIV\ we made what we called \type {\nonknuthmode} +default which means that ampersands are just that and scripts are only special in +math (there was also \type {\donknuthmode}). So, \CONTEXT\ is not like plain +there. + +\stopsection + +\startsection[title=Housekeeping] + +The next section defines some numeric shortcuts. Here the fact is used that a +defined symbolic character can act as counter value. When the number is larger +than 255 a math character is to be used. In \LUATEX, which is a \UNICODE\ engine +character codes can be much larger. + +\startnarrowtyping +% To make the plain macros more efficient in time and space, several constant +% values are declared here as control sequences. If they were changed, anything +% could happen; so they are private symbols. + +\chardef\@ne=1 +\chardef\tw@=2 +\chardef\thr@@=3 +\chardef\sixt@@n=16 +\chardef\@cclv=255 +\mathchardef\@cclvi=256 +\mathchardef\@m=1000 +\mathchardef\@M=10000 +\mathchardef\@MM=20000 +\stopnarrowtyping + +In \CONTEXT\ we still support these shortcuts but never use them ourselves. We +have plenty more variables and constants and nowadays always use verbose names. +(There was indeed a time when each extra characters depleted string memory more +and more so then using short command names made sense.) The comment is right that +using such variables is more efficient, for instance once loaded a macro is a +sequence of tokens, so \type {\@one} takes one memory slot. In the case of the +first three the saving is zero and even interpreting a single character token +\type {3} is not less efficient than \type {\thr@@}, but in the case of \type +{\@cclv} the three tokens \type {255} take more memory and also trigger the number +scanner which is much slower than simply taking the meaning of the \type +{\chardef}'d token. However, the \CONTEXT\ variable \type {\plusone} is as +efficient as the \type {\@ne} and it looks prettier in code too (and I'm very +sensitive for that). So, here \CONTEXT\ is definitely different! + +It makes no sense to show the next section here: it deals with managing +registers, like counters and dimensions and token lists. Traditional \TEX\ has +255 registers per category. Associating a control sequence (name) with a specific +counter is done with \type {\countdef} but I don't think that you will find a +macro package that expects a user to use that primitive. Instead it will provide +a \type {\newcount} macro. So yes, here \CONTEXT\ is like plain. + +Understanding these macros is a test case for understanding \TEX. Take the +following snippet: + +\startnarrowtyping +\let\newtoks=\relax % we do this to allow plain.tex to be read in twice +\outer\def\newhelp#1#2{\newtoks#1#1\expandafter{\csname#2\endcsname}} +\outer\def\newtoks{\alloc@5\toks\toksdef\@cclvi} +\stopnarrowtyping + +The \type {\outer} prefix flags macros as to be used at the outermost level and +because the \type {\newtoks} is in the macro body of \type {\newtoks} it has to +be relaxed first. Don't worry if you don't get it. In \CONTEXT\ we have no outer +macros so the definitions differ there. + +The plain format assumes that the first 10 registers are used for scratch +purposes, so best also assume this to be the case in other macro packages. There +is no need for \CONTEXT\ to differ from plain here. The definitions of box +registers and inserts are special: there is no \type {\boxdef} and inserts use +multiple registers. Especially the allocation of inserts is macro package +specific. Anyway, \CONTEXT\ users never see such details because inserts are used +as building blocks deep down. + +Right after defining the allocators some more constants are defined: + +\startnarrowtyping +% Here are some examples of allocation. + +\newdimen\maxdimen \maxdimen=16383.99999pt % the largest legal <dimen> +\stopnarrowtyping + +We do have that one, as it's again a standard but we do have more such constants. +This definition is kind of interesting as it assumes knowledge about what is +acceptable for \TEX\ as dimension: + +\startbuffer +{\maxdimen=16383.99999pt \the\maxdimen \quad \number\maxdimen} +{\maxdimen=16383.99998pt \the\maxdimen \quad \number\maxdimen} +\stopbuffer + +\typebuffer + +\startlines +\getbuffer +\stoplines + +Indeed it is the largest legal dimension but the real largest one is slighly +less. We could also have said the following, which also indicates what the +maximum cardinal is: + +\startnarrowtyping +\newdimen\maxdimen \maxdimen=1073741823sp +\stopnarrowtyping + +We dropped some of the others defined in plain. So, \CONTEXT\ is a bit like plain +but differs substantially. In fact, \MKII\ already used a different allocator +implementation and \MKIV\ is even more different. We also have more \type {\new} +things. + +The \type {\newif} definition also differs. Now that definition is quite special +in plain \TEX, so if you want a challenge, look it up. It defines three macros as +the comment says: + +\startnarrowtyping +% For example, \newif\iffoo creates \footrue, \foofalse to go with \iffoo. +\stopnarrowtyping + +The \type {\iffoo} is either equivalent to \type {\iftrue} or \type {\iffalse} +because that is what \TEX\ needs to see in order to be able to skip nested +conditional branches. In \CONTEXT\ we have so called conditionals, which are more +efficient. So, yes, you will find such defined ifs in the \CONTEXT\ source but +way less than you'd expect in such a large macro package: \CONTEXT\ code doesn't +look much like plain code I fear. + +\stopsection + +\startsection[title=Parameters] + +A next stage sets the internal parameters: + +\startnarrowtyping +% All of TeX's numeric parameters are listed here, but the code is commented out +% if no special value needs to be set. INITEX makes all parameters zero except +% where noted. +\stopnarrowtyping + +We use different values for many of them. The reason is that the plain \TEX\ format +is set up for a 10 point Computer Modern font system, and for a particular kind +of layout, so we use different values for: + +\startnarrowtyping +\hsize=6.5in +\vsize=8.9in +\maxdepth=4pt +\stopnarrowtyping + +and + +\startnarrowtyping +\abovedisplayskip=12pt plus 3pt minus 9pt +\abovedisplayshortskip=0pt plus 3pt +\belowdisplayskip=12pt plus 3pt minus 9pt +\belowdisplayshortskip=7pt plus 3pt minus 4pt +\stopnarrowtyping + +No, here \CONTEXT\ is not like plain. But, there is one aspect that we do inherit and +that is the ratio. Here a 10 point relates to 12 point and this 1.2 factor is carried +over in some defaults in \CONTEXT. So, in the end we're a bit like plain. + +After setting up the internal quantities plain does this: + +% We also define special registers that function like parameters: + +\startnarrowtyping +\newskip\smallskipamount \smallskipamount=3pt plus 1pt minus 1pt +\newskip\medskipamount \medskipamount=6pt plus 2pt minus 2pt +\newskip\bigskipamount \bigskipamount=12pt plus 4pt minus 4pt +\newskip\normalbaselineskip \normalbaselineskip=12pt +\newskip\normallineskip \normallineskip=1pt +\newdimen\normallineskiplimit \normallineskiplimit=0pt +\newdimen\jot \jot=3pt +\newcount\interdisplaylinepenalty \interdisplaylinepenalty=100 +\newcount\interfootnotelinepenalty \interfootnotelinepenalty=100 +\stopnarrowtyping + +The first three as well as the following three related variables are not internal +quantities but preallocated registers. These are not used in the engine but in +macros. In \CONTEXT\ we do provide them but the first three are never used that +way. The last three are not defined at all. So, \CONTEXT\ provides a bit what +plain provides, just in case. + +\stopsection + +\startsection[title=Fonts] + +The font section is quite interesting. I assume that one reason why some want to +warn users against using \CONTEXT\ is because it supports some of the font +switching commands found in plain. We had no reasons to come up with different ones +but they do different things anyway, for instance adapting to situations. So, in +\CONTEXT\ you will not find the plain definitions: + +\startnarrowtyping +\font\tenrm=cmr10 % roman text +\font\preloaded=cmr9 +\font\preloaded=cmr8 +\font\sevenrm=cmr7 +\font\preloaded=cmr6 +\font\fiverm=cmr5 +\stopnarrowtyping + +There is another thing going on here. Some fonts are defined \type {\preloaded}. So, +\type {cmr9} is defined, and then \type {cmr8} and \type {cmr6}. But they all use the +same name. Later on we see: + +\startnarrowtyping +\let\preloaded=\undefined % preloaded fonts must be declared anew later. +\stopnarrowtyping + +If you never ran into the relevant part of the \TEX\ book or read the program +source of \TEX, you won't realize that preloading means that it stays in memory +which in turn means that when it gets (re)defined later, the font data doesn't +come from disk. In fact, as the plain format is normally dumped for faster reload +later on, the font data is also retained. So, preloading is a speed up hack. In +\CONTEXT\ font loading has always been delayed till the moment a font is really +used. This permits plenty of definitions and gives less memory usage. Of course +we do reuse fonts once loaded. All this, plus the fact that we have a a system of +related sizes, collections of families, support multiple font encodings +alongside, collect definitions in so called typescript, etc. makes that the +\CONTEXT\ font subsystem is far from what plain provides. Only some of the +command stick, like \type {\rm} and \type {\bf}. + +The same is true for math fonts, where we can have different math font setups in +one document. Definitely in \MKII\ times, we also had to work around limitations +in the number of available math families, which again complicated the code. In +\MKIV\ things are even more different, one can even consider the implementation +somewhat alien for a standard macro package, but that's for another article (if +at all). + +\stopsection + +\startsection[title=Macros] + +Of course \CONTEXT\ comes with macros, but these are organized in setups, +environments, instances, etc. The whole process and setup is keyword driven. Out +of the box all things work: nothing needs to be loaded. If you want it different, +you change some settings, but you don't need to load something. Maybe that last +aspect is what is meant with \CONTEXT\ being like plain: you don't (normally) +load extra stuff. You just adapt the system to your needs. So there we proudly +follow up on plain \TEX. + +In the plain macro section we find definitions like: + +\startnarrowtyping +\def\frenchspacing{\sfcode`\.\@m \sfcode`\?\@m \sfcode`\!\@m + \sfcode`\:\@m \sfcode`\;\@m \sfcode`\,\@m} +\def\nonfrenchspacing{\sfcode`\.3000\sfcode`\?3000\sfcode`\!3000% + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 } +\stopnarrowtyping + +and: + +\startnarrowtyping +\def\space{ } +\def\empty{} +\def\null{\hbox{}} + +\let\bgroup={ +\let\egroup=} +\stopnarrowtyping + +and: + +\startnarrowtyping +\def\nointerlineskip{\prevdepth-1000\p@} +\def\offinterlineskip{\baselineskip-1000\p@ + \lineskip\z@ \lineskiplimit\maxdimen} +\stopnarrowtyping + +Indeed we also provide these, but apart from the two grouping related aliases +their implementation is different in \CONTEXT. There is no need to reinvent +names. + +For a while we kept (and did in \MKII) some of the plain helper macros, for +instance those that deal with tabs, but we have several more extensive table +models that are normally used. We always had our own code for float placement, +and we also have more options there. Footnotes are supported but again we have +multiple classes, placements, options, etc. Idem for itemized lists, one of the +oldest mechanisms in \CONTEXT. We don't have \type {\beginsection} but of course +we do have sectioning commands, and have no \type {\proclaim} but provide lots of +descriptive alternatives, so many that I forgot about most of them by now (so +plain is a winner in terms of knowing a macro package inside out). + +The fact that we use tables, floats and footnotes indeed makes \CONTEXT\ to act +like plain, but that's then also true for other macro packages. A fact is that +plain sets the standard for how to think about these matters! The same is true +for naming characters: + +\startnarrowtyping +\chardef\%=`\% +\chardef\&=`\& +\chardef\#=`\# +\chardef\$=`\$ +\chardef\ss="19 +\chardef\ae="1A +\chardef\oe="1B +\chardef\o="1C +\chardef\AE="1D +\chardef\OE="1E +\chardef\O="1F +\chardef\i="10 \chardef\j="11 % dotless letters +\stopnarrowtyping + +But we have many more and understandable the numbers are different in \CONTEXT\ +because we use different font (encodings). Their implementation is more adaptive. +The same is true for accented characters: + +\startnarrowtyping +\def\`#1{{\accent18 #1}} +\def\'#1{{\accent19 #1}} +\stopnarrowtyping + +The definitions in \MKII\ are different (in most cases we use native glyphs) and +in \MKIV\ we use \UNICODE\ anyway. I think that the \type {\accent} command is +only used in a few exceptional cases (like very limited fonts) in \MKII\ and never +in \MKIV. The implementation of for instance accents (and other pasted together +symbols) in math is also quite different. + +There are also definitions that seem to be commonly used in macro packages but +that we never use in \CONTEXT\ because they interfere badly with all kind of +other mechanisms, so you will find no usage of + +\startnarrowtyping +\def\leavevmode{\unhbox\voidb@x} % begins a paragraph, if necessary +\stopnarrowtyping + +in \CONTEXT. In order to stress that we provide \type {\dontleavehmode}, a wink +to not using the one above. + +The macro section ends with lots of math definitions. Most of the names used are +kind of standard so again here \CONTEXT\ is like plain, but the implementation +can differ as does the level of control. + +\stopsection + +\startsection[title=Output] + +Once a page is ready it gets wrapped up and shipped out. Here \CONTEXT\ is very +different from plain. The amount of code in plain is not that large but the +possibilities aren't either, which is exactly what the objectives demand: a +simple (example) format that can be described in the \TEX book. But, as with +other aspects of plain, it steered the way macro packages started out as it +showed the way. As did many examples in the \TEX\ book. + +\stopsection + +\startsection[title=Hyphenation] + +As an afterthought, the plain format ends with loading hyphenation patterns, that +is the English ones. That said it will be clear that \CONTEXT\ is not like plain: +we support many languages, and the subsystem deals with labels, specific +typesetting properties, etc.\ too. + +\startnarrowtyping +\lefthyphenmin=2 \righthyphenmin=3 % disallow x- or -xx breaks +\input hyphen +\stopnarrowtyping + +We don't even use these patterns as we switched to \UTF\ long ago (also in \MKII) +if only because we had to deal with a mix of font encodings. But we did preload the +lot there. In \MKIV\ again things are much different. + +\stopsection + +\startsection[title=Conclusion] + +The plain format does (and provides) what it is supposed to do. It is a showcase +of possibilities and part of the specification. In that respect it's nice that +\CONTEXT\ is considered to be like plain. But if it wasn't more, there was no +reason for its existence. Like more assumptions about \CONTEXT\ it demonstrates +that those coming up with answers and remarks like that probably missed something +in assessing \CONTEXT. Just let users find out themselves what suits best (and +for some that actually might be plain \TEX). + +\stopsection + +\stopchapter + +\stopcomponent diff --git a/doc/context/sources/general/manuals/musings/musings.tex b/doc/context/sources/general/manuals/musings/musings.tex index 3b6327f59..64d505df1 100644 --- a/doc/context/sources/general/manuals/musings/musings.tex +++ b/doc/context/sources/general/manuals/musings/musings.tex @@ -17,6 +17,7 @@ \component musings-stability \component musings-roadmap % \component musings-names + \component musings-plain \stopbodymatter \stopproduct diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index f7e67d91e..3d975f94e 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -12798,7 +12798,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 32618, stripped down to: 20935 +-- original size: 32638, stripped down to: 20935 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -14682,7 +14682,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 20101, stripped down to: 12871 +-- original size: 20184, stripped down to: 12874 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -15145,8 +15145,8 @@ if io then end if os then overload(os.execute,binaryrunner,"os.execute") - overload(os.spawn,dummyrunner,"os.spawn") - overload(os.exec,dummyrunner,"os.exec") + overload(os.spawn,dummyrunner,"os.spawn") + overload(os.exec,dummyrunner,"os.exec") overload(os.resultof,binaryrunner,"os.resultof") overload(os.pipeto,binaryrunner,"os.pipeto") overload(os.rename,filehandlertwo,"os.rename") @@ -25646,8 +25646,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1022759 --- stripped bytes : 405078 +-- original bytes : 1022862 +-- stripped bytes : 405178 -- end library merge @@ -26150,8 +26150,7 @@ end report() io.flush() end - -- no os.exec because otherwise we get the wrong return value - local code = os.execute(command) -- maybe spawn + local code = os.execute(command) if code == 0 then return true else @@ -26194,7 +26193,7 @@ function runners.execute_program(fullname) report() report() io.flush() - local code = os.execute(command) -- (fullname,unpack(after)) does not work / maybe spawn + local code = os.execute(command) return code == 0 end end diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index f7e67d91e..3d975f94e 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -12798,7 +12798,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 32618, stripped down to: 20935 +-- original size: 32638, stripped down to: 20935 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -14682,7 +14682,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 20101, stripped down to: 12871 +-- original size: 20184, stripped down to: 12874 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -15145,8 +15145,8 @@ if io then end if os then overload(os.execute,binaryrunner,"os.execute") - overload(os.spawn,dummyrunner,"os.spawn") - overload(os.exec,dummyrunner,"os.exec") + overload(os.spawn,dummyrunner,"os.spawn") + overload(os.exec,dummyrunner,"os.exec") overload(os.resultof,binaryrunner,"os.resultof") overload(os.pipeto,binaryrunner,"os.pipeto") overload(os.rename,filehandlertwo,"os.rename") @@ -25646,8 +25646,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1022759 --- stripped bytes : 405078 +-- original bytes : 1022862 +-- stripped bytes : 405178 -- end library merge @@ -26150,8 +26150,7 @@ end report() io.flush() end - -- no os.exec because otherwise we get the wrong return value - local code = os.execute(command) -- maybe spawn + local code = os.execute(command) if code == 0 then return true else @@ -26194,7 +26193,7 @@ function runners.execute_program(fullname) report() report() io.flush() - local code = os.execute(command) -- (fullname,unpack(after)) does not work / maybe spawn + local code = os.execute(command) return code == 0 end end diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index f7e67d91e..3d975f94e 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -12798,7 +12798,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 32618, stripped down to: 20935 +-- original size: 32638, stripped down to: 20935 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -14682,7 +14682,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 20101, stripped down to: 12871 +-- original size: 20184, stripped down to: 12874 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -15145,8 +15145,8 @@ if io then end if os then overload(os.execute,binaryrunner,"os.execute") - overload(os.spawn,dummyrunner,"os.spawn") - overload(os.exec,dummyrunner,"os.exec") + overload(os.spawn,dummyrunner,"os.spawn") + overload(os.exec,dummyrunner,"os.exec") overload(os.resultof,binaryrunner,"os.resultof") overload(os.pipeto,binaryrunner,"os.pipeto") overload(os.rename,filehandlertwo,"os.rename") @@ -25646,8 +25646,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1022759 --- stripped bytes : 405078 +-- original bytes : 1022862 +-- stripped bytes : 405178 -- end library merge @@ -26150,8 +26150,7 @@ end report() io.flush() end - -- no os.exec because otherwise we get the wrong return value - local code = os.execute(command) -- maybe spawn + local code = os.execute(command) if code == 0 then return true else @@ -26194,7 +26193,7 @@ function runners.execute_program(fullname) report() report() io.flush() - local code = os.execute(command) -- (fullname,unpack(after)) does not work / maybe spawn + local code = os.execute(command) return code == 0 end end diff --git a/scripts/context/stubs/win64/mtxrun.lua b/scripts/context/stubs/win64/mtxrun.lua index f7e67d91e..3d975f94e 100644 --- a/scripts/context/stubs/win64/mtxrun.lua +++ b/scripts/context/stubs/win64/mtxrun.lua @@ -12798,7 +12798,7 @@ do -- create closure to overcome 200 locals limit package.loaded["trac-log"] = package.loaded["trac-log"] or true --- original size: 32618, stripped down to: 20935 +-- original size: 32638, stripped down to: 20935 if not modules then modules={} end modules ['trac-log']={ version=1.001, @@ -14682,7 +14682,7 @@ do -- create closure to overcome 200 locals limit package.loaded["util-sbx"] = package.loaded["util-sbx"] or true --- original size: 20101, stripped down to: 12871 +-- original size: 20184, stripped down to: 12874 if not modules then modules={} end modules ['util-sbx']={ version=1.001, @@ -15145,8 +15145,8 @@ if io then end if os then overload(os.execute,binaryrunner,"os.execute") - overload(os.spawn,dummyrunner,"os.spawn") - overload(os.exec,dummyrunner,"os.exec") + overload(os.spawn,dummyrunner,"os.spawn") + overload(os.exec,dummyrunner,"os.exec") overload(os.resultof,binaryrunner,"os.resultof") overload(os.pipeto,binaryrunner,"os.pipeto") overload(os.rename,filehandlertwo,"os.rename") @@ -25646,8 +25646,8 @@ end -- of closure -- used libraries : l-bit32.lua l-lua.lua l-macro.lua l-sandbox.lua l-package.lua l-lpeg.lua l-function.lua l-string.lua l-table.lua l-io.lua l-number.lua l-set.lua l-os.lua l-file.lua l-gzip.lua l-md5.lua l-sha.lua l-url.lua l-dir.lua l-boolean.lua l-unicode.lua l-math.lua util-str.lua util-tab.lua util-fil.lua util-sac.lua util-sto.lua util-prs.lua util-fmt.lua util-soc-imp-reset.lua util-soc-imp-socket.lua util-soc-imp-copas.lua util-soc-imp-ltn12.lua util-soc-imp-mime.lua util-soc-imp-url.lua util-soc-imp-headers.lua util-soc-imp-tp.lua util-soc-imp-http.lua util-soc-imp-ftp.lua util-soc-imp-smtp.lua trac-set.lua trac-log.lua trac-inf.lua trac-pro.lua util-lua.lua util-deb.lua util-tpl.lua util-sbx.lua util-mrg.lua util-env.lua luat-env.lua util-zip.lua lxml-tab.lua lxml-lpt.lua lxml-mis.lua lxml-aux.lua lxml-xml.lua trac-xml.lua data-ini.lua data-exp.lua data-env.lua data-tmp.lua data-met.lua data-res.lua data-pre.lua data-inp.lua data-out.lua data-fil.lua data-con.lua data-use.lua data-zip.lua data-tre.lua data-sch.lua data-lua.lua data-aux.lua data-tmf.lua data-lst.lua util-lib.lua luat-sta.lua luat-fmt.lua -- skipped libraries : - --- original bytes : 1022759 --- stripped bytes : 405078 +-- original bytes : 1022862 +-- stripped bytes : 405178 -- end library merge @@ -26150,8 +26150,7 @@ end report() io.flush() end - -- no os.exec because otherwise we get the wrong return value - local code = os.execute(command) -- maybe spawn + local code = os.execute(command) if code == 0 then return true else @@ -26194,7 +26193,7 @@ function runners.execute_program(fullname) report() report() io.flush() - local code = os.execute(command) -- (fullname,unpack(after)) does not work / maybe spawn + local code = os.execute(command) return code == 0 end end diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index ce041e206..605229e98 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2019.06.01 19:11} +\newcontextversion{2019.06.05 15:39} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index eac363a55..b8d1ff737 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2019.06.01 19:11} +\edef\contextversion{2019.06.05 15:39} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii index 4208b1406..ef0bd047c 100644 --- a/tex/context/base/mkii/mult-fr.mkii +++ b/tex/context/base/mkii/mult-fr.mkii @@ -570,6 +570,7 @@ \setinterfacevariable{temporary}{temporaire} \setinterfacevariable{test}{test} \setinterfacevariable{text}{texte} +\setinterfacevariable{textnote}{textnote} \setinterfacevariable{three}{trois} \setinterfacevariable{thursday}{jeudi} \setinterfacevariable{tight}{tight} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 590dbdf6b..4af95a2c0 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2019.06.01 19:11} +\newcontextversion{2019.06.05 15:39} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index d0cf6ec89..5189d1246 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2019.06.01 19:11} +\edef\contextversion{2019.06.05 15:39} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/driv-shp.lua b/tex/context/base/mkiv/driv-shp.lua index 26bb06b39..b9298176a 100644 --- a/tex/context/base/mkiv/driv-shp.lua +++ b/tex/context/base/mkiv/driv-shp.lua @@ -338,7 +338,9 @@ flush_character = function(current,font,char,factor,vfcommands,pos_h,pos_v,pos_r width, height, depth, factor = getwhd(current,true) naturalwidth = width if factor ~= 0 then - width = (1.0 + factor/1000000.0) * width + -- width = (1.0 + factor/1000000.0) * width + width = width + width * factor/1000000.0 + -- width = width + width * 0.000001 * factor end else width = data.width or 0 @@ -369,10 +371,10 @@ flush_character = function(current,font,char,factor,vfcommands,pos_h,pos_v,pos_r pos_v = pos_v + y end pushorientation(orientation,pos_h,pos_v) - flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,factor,naturalwidth,f,e) + flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,naturalwidth,factor,width,f,e) poporientation(orientation,pos_h,pos_v) else - flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,factor,naturalwidth,f,e) + flushcharacter(current,pos_h,pos_v,pos_r,font,char,data,naturalwidth,factor,width,f,e) end end return width, height, depth @@ -1280,6 +1282,8 @@ function lpdf.convert(box,smode,objnum,specification) -- temp name objectnumber = objnum, } + lastfont = nil -- this forces a sync each page / object + if getid(box) == vlist_code then vlist_out(box) else diff --git a/tex/context/base/mkiv/font-imp-quality.lua b/tex/context/base/mkiv/font-imp-quality.lua index 5152d212f..b3ea73f02 100644 --- a/tex/context/base/mkiv/font-imp-quality.lua +++ b/tex/context/base/mkiv/font-imp-quality.lua @@ -520,13 +520,18 @@ implement { local function initialize(tfmdata,value) local properties = tfmdata.properties + local parameters = tfmdata.parameters if properties then value = tonumber(value) if value then if value < 0 then value = 0 - elseif value > 100 then - value = 100 + elseif value > 10 then + report_expansions("threshold for %a @ %p limited to 10 pct",properties.fontname,parameters.size) + value = 10 + end + if value > 5 then + report_expansions("threshold for %a @ %p exceeds 5 pct",properties.fontname,parameters.size) end end properties.threshold = value or nil -- nil enforces default diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua index 3c30910ab..8530fc264 100644 --- a/tex/context/base/mkiv/font-osd.lua +++ b/tex/context/base/mkiv/font-osd.lua @@ -418,15 +418,6 @@ local basic_shaping_forms = { } local valid = { - -- akhn = true, -- malayalam - -- rphf = true, - -- pref = true, - -- half = true, - -- blwf = true, - -- pstf = true, - -- pres = true, -- malayalam - -- blws = true, -- malayalam - -- psts = true, -- malayalam abvs = true, akhn = true, blwf = true, @@ -619,43 +610,88 @@ local function initializedevanagi(tfmdata) end end -- - -- needs checking: this might be needed per instance ? + -- The following presets need checking (by Kai). Most of these scripts share a common + -- handling (some need less but that doesn't hurt). The question is: what to enable. -- - if script == "deva" or script == "knda" then - sharedfeatures["dv04"] = true -- dv04_remove_joiners - elseif script == "dev2" or script == "knd2" then - sharedfeatures["dv01"] = true -- dv01_reorder_matras - sharedfeatures["dv02"] = true -- dv02_reorder_reph - sharedfeatures["dv03"] = true -- dv03_reorder_pre_base_reordering_consonants - sharedfeatures["dv04"] = true -- dv04_remove_joiners - -- elseif script == "knda" then -- see deva, needs checking by Kai - -- elseif script == "knd2" then -- see dev2, needs checking by Kai + -- dv01_reorder_matras + -- dv02_reorder_reph + -- dv03_reorder_pre_base_reordering_consonants + -- dv04_remove_joiners + -- + if script == "deva" then + sharedfeatures["dv04"] = true + elseif script == "dev2" then + sharedfeatures["dv01"] = true + sharedfeatures["dv02"] = true + sharedfeatures["dv03"] = true + sharedfeatures["dv04"] = true + + elseif script == "knda" then + -- needs checking + sharedfeatures["dv04"] = true + elseif script == "knd2" then + -- needs checking + sharedfeatures["dv01"] = true + sharedfeatures["dv02"] = true + sharedfeatures["dv03"] = true + sharedfeatures["dv04"] = true + + elseif script == "beng" then + -- needs checking + sharedfeatures["dv04"] = true + elseif script == "bng2" then + -- needs checking + sharedfeatures["dv01"] = true + sharedfeatures["dv02"] = true + sharedfeatures["dv03"] = true + sharedfeatures["dv04"] = true + + elseif script == "gurj" then + -- needs checking + sharedfeatures["dv04"] = true + elseif script == "grj2" then + -- needs checking + sharedfeatures["dv01"] = true + sharedfeatures["dv02"] = true + sharedfeatures["dv03"] = true + sharedfeatures["dv04"] = true + + elseif script == "guru" then + -- needs checking + sharedfeatures["dv04"] = true + elseif script == "gur2" then + -- needs checking + sharedfeatures["dv01"] = true + sharedfeatures["dv02"] = true + sharedfeatures["dv03"] = true + sharedfeatures["dv04"] = true + + elseif script == "telu" then + -- needs checking + sharedfeatures["dv04"] = true + elseif script == "tel2" then + -- needs checking + sharedfeatures["dv01"] = true + sharedfeatures["dv02"] = true + sharedfeatures["dv03"] = true + sharedfeatures["dv04"] = true + elseif script == "mlym" then sharedfeatures["pstf"] = true elseif script == "mlm2" then sharedfeatures["pstf"] = true sharedfeatures["pref"] = true - sharedfeatures["dv03"] = true -- dv03_reorder_pre_base_reordering_consonants - gsubfeatures ["dv03"] = two_defaults -- reorder pre base reordering consonants + sharedfeatures["dv03"] = true + gsubfeatures ["dv03"] = two_defaults insert(sequences,insertindex,sequence_reorder_pre_base_reordering_consonants) - -- elseif script == "beng" then - -- elseif script == "bng2" then - -- elseif script == "gujr" then - -- elseif script == "gjr2" then - -- elseif script == "guru" then - -- elseif script == "gur2" then + elseif script == "taml" then - sharedfeatures["dv04"] = true -- dv04_remove_joiners -sharedfeatures["pstf"] = true + -- needs checking + sharedfeatures["dv04"] = true + sharedfeatures["pstf"] = true elseif script == "tml2" then --- sharedfeatures["pstf"] = true --- sharedfeatures["pref"] = true --- sharedfeatures["dv01"] = true -- dv01_reorder_matras --- sharedfeatures["dv02"] = true -- dv02_reorder_reph --- sharedfeatures["dv03"] = true -- dv03_reorder_pre_base_reordering_consonants --- sharedfeatures["dv04"] = true -- dv04_remove_joiners - -- elseif script == "telu" then - -- elseif script == "tel2" then + -- needs checking + else report("todo: enable the right features for script %a",script) end diff --git a/tex/context/base/mkiv/font-ott.lua b/tex/context/base/mkiv/font-ott.lua index 10420f6ee..c9e467f22 100644 --- a/tex/context/base/mkiv/font-ott.lua +++ b/tex/context/base/mkiv/font-ott.lua @@ -27,14 +27,19 @@ local statistics = otf.statistics or { } otf.statistics = statistics local scripts = allocate { + ["adlm"] = "adlam", + ["aghb"] = "caucasian albanian", + ["ahom"] = "ahom", ["arab"] = "arabic", ["armi"] = "imperial aramaic", ["armn"] = "armenian", ["avst"] = "avestan", ["bali"] = "balinese", ["bamu"] = "bamum", + ["bass"] = "bassa vah", ["batk"] = "batak", ["beng"] = "bengali", + ["bhks"] = "bhaiksuki", ["bng2"] = "bengali variant 2", ["bopo"] = "bopomofo", ["brah"] = "brahmi", @@ -50,23 +55,33 @@ local scripts = allocate { ["copt"] = "coptic", ["cprt"] = "cypriot syllabary", ["cyrl"] = "cyrillic", - ["deva"] = "devanagari", ["dev2"] = "devanagari variant 2", + ["deva"] = "devanagari", + ["dogr"] = "dogra", ["dsrt"] = "deseret", + ["dupl"] = "duployan", ["egyp"] = "egyptian heiroglyphs", + ["elba"] = "elbasan", ["ethi"] = "ethiopic", ["geor"] = "georgian", + ["gjr2"] = "gujarati variant 2", ["glag"] = "glagolitic", + ["gong"] = "gunjala gondi", + ["gonm"] = "masaram gondi", ["goth"] = "gothic", + ["gran"] = "grantha", ["grek"] = "greek", ["gujr"] = "gujarati", - ["gjr2"] = "gujarati variant 2", - ["guru"] = "gurmukhi", ["gur2"] = "gurmukhi variant 2", + ["guru"] = "gurmukhi", ["hang"] = "hangul", ["hani"] = "cjk ideographic", ["hano"] = "hanunoo", + ["hatr"] = "hatran", ["hebr"] = "hebrew", + ["hluw"] = "anatolian hieroglyphs", + ["hmng"] = "pahawh hmong", + ["hung"] = "old hungarian", ["ital"] = "old italic", ["jamo"] = "hangul jamo", ["java"] = "javanese", @@ -74,49 +89,77 @@ local scripts = allocate { ["kana"] = "hiragana and katakana", ["khar"] = "kharosthi", ["khmr"] = "khmer", - ["knda"] = "kannada", + ["khoj"] = "khojki", ["knd2"] = "kannada variant 2", + ["knda"] = "kannada", ["kthi"] = "kaithi", ["lana"] = "tai tham", ["lao" ] = "lao", ["latn"] = "latin", ["lepc"] = "lepcha", ["limb"] = "limbu", + ["lina"] = "linear a", ["linb"] = "linear b", ["lisu"] = "lisu", ["lyci"] = "lycian", ["lydi"] = "lydian", + ["mahj"] = "mahajani", + ["maka"] = "makasar", ["mand"] = "mandaic and mandaean", + ["mani"] = "manichaean", + ["marc"] = "marchen", ["math"] = "mathematical alphanumeric symbols", + ["medf"] = "medefaidrin", + ["mend"] = "mende kikakui", ["merc"] = "meroitic cursive", ["mero"] = "meroitic hieroglyphs", - ["mlym"] = "malayalam", ["mlm2"] = "malayalam variant 2", + ["mlym"] = "malayalam", + ["modi"] = "modi", ["mong"] = "mongolian", + ["mroo"] = "mro", ["mtei"] = "meitei Mayek", + ["mult"] = "multani", ["musc"] = "musical symbols", ["mym2"] = "myanmar variant 2", ["mymr"] = "myanmar", + ["narb"] = "old north arabian", + ["nbat"] = "nabataean", + ["newa"] = "newa", ["nko" ] = 'n"ko', + ["nshu"] = "nüshu", ["ogam"] = "ogham", ["olck"] = "ol chiki", ["orkh"] = "old turkic and orkhon runic", - ["orya"] = "oriya", ["ory2"] = "odia variant 2", + ["orya"] = "oriya", + ["osge"] = "osage", ["osma"] = "osmanya", + ["palm"] = "palmyrene", + ["pauc"] = "pau cin hau", + ["perm"] = "old permic", ["phag"] = "phags-pa", ["phli"] = "inscriptional pahlavi", + ["phlp"] = "psalter pahlavi", ["phnx"] = "phoenician", + ["plrd"] = "miao", ["prti"] = "inscriptional parthian", ["rjng"] = "rejang", + ["rohg"] = "hanifi rohingya", ["runr"] = "runic", ["samr"] = "samaritan", ["sarb"] = "old south arabian", ["saur"] = "saurashtra", + ["sgnw"] = "sign writing", ["shaw"] = "shavian", ["shrd"] = "sharada", + ["sidd"] = "siddham", + ["sind"] = "khudawadi", ["sinh"] = "sinhala", + ["sogd"] = "sogdian", + ["sogo"] = "old sogdian", ["sora"] = "sora sompeng", + ["soyo"] = "soyombo", ["sund"] = "sundanese", ["sylo"] = "syloti nagri", ["syrc"] = "syriac", @@ -125,20 +168,24 @@ local scripts = allocate { ["tale"] = "tai le", ["talu"] = "tai lu", ["taml"] = "tamil", + ["tang"] = "tangut", ["tavt"] = "tai viet", - ["telu"] = "telugu", ["tel2"] = "telugu variant 2", + ["telu"] = "telugu", ["tfng"] = "tifinagh", ["tglg"] = "tagalog", ["thaa"] = "thaana", ["thai"] = "thai", ["tibt"] = "tibetan", + ["tirh"] = "tirhuta", ["tml2"] = "tamil variant 2", ["ugar"] = "ugaritic cuneiform", ["vai" ] = "vai", + ["wara"] = "warang citi", ["xpeo"] = "old persian cuneiform", ["xsux"] = "sumero-akkadian cuneiform", ["yi" ] = "yi", + ["zanb"] = "zanabazar square", } local languages = allocate { @@ -208,12 +255,15 @@ local languages = allocate { ["brm" ] = "burmese", ["brx" ] = "bodo", ["bsh" ] = "bashkir", + ["bsk" ] = "burushaski", ["bti" ] = "beti", ["bts" ] = "batak simalungun", ["bug" ] = "bugis", + ["byv" ] = "medumba", ["cak" ] = "kaqchikel", ["cat" ] = "catalan", ["cbk" ] = "zamboanga chavacano", + ["cchn"] = "chinantec", ["ceb" ] = "cebuano", ["cgg" ] = "chiga", ["cha" ] = "chamorro", @@ -228,6 +278,8 @@ local languages = allocate { ["chr" ] = "cherokee", ["chu" ] = "chuvash", ["chy" ] = "cheyenne", + ["cja" ] = "western cham", + ["cjm" ] = "eastern cham", ["cmr" ] = "comorian", ["cop" ] = "coptic", ["cor" ] = "cornish", @@ -283,6 +335,7 @@ local languages = allocate { ["fin" ] = "finnish", ["fji" ] = "fijian", ["fle" ] = "dutch (flemish)", + ["fmp" ] = "fe’fe’", ["fne" ] = "forest nenets", ["fon" ] = "fon", ["fos" ] = "faroese", @@ -361,6 +414,7 @@ local languages = allocate { ["jan" ] = "japanese", ["jav" ] = "javanese", ["jbo" ] = "lojban", + ["jct" ] = "krymchak", ["jii" ] = "yiddish", ["jud" ] = "ladino", ["jul" ] = "jula", @@ -397,6 +451,7 @@ local languages = allocate { ["kmn" ] = "kumaoni", ["kmo" ] = "komo", ["kms" ] = "komso", + ["kmz" ] = "khorasani turkic", ["knr" ] = "kanuri", ["kod" ] = "kodagu", ["koh" ] = "korean old hangul", @@ -473,6 +528,7 @@ local languages = allocate { ["mar" ] = "marathi", ["maw" ] = "marwari", ["mbn" ] = "mbundu", + ["mbo" ] = "mbo", ["mch" ] = "manchu", ["mcr" ] = "moose cree", ["mde" ] = "mende", @@ -489,6 +545,7 @@ local languages = allocate { ["mle" ] = "male", ["mlg" ] = "malagasy", ["mln" ] = "malinke", + ["mlr" ] = "malayalam reformed", ["mly" ] = "malay", ["mnd" ] = "mandinka", ["mng" ] = "mongolian", @@ -542,6 +599,7 @@ local languages = allocate { ["nto" ] = "esperanto", ["nym" ] = "nyamwezi", ["nyn" ] = "norwegian nynorsk", + ["nza" ] = "mbembe tigon", ["oci" ] = "occitan", ["ocr" ] = "oji-cree", ["ojb" ] = "ojibway", @@ -605,6 +663,7 @@ local languages = allocate { ["say" ] = "sayisi", ["scn" ] = "sicilian", ["sco" ] = "scots", + ["scs" ] = "north slavey", ["sek" ] = "sekota", ["sel" ] = "selkup", ["sga" ] = "old irish", @@ -649,6 +708,9 @@ local languages = allocate { ["sxu" ] = "upper saxon", ["syl" ] = "sylheti", ["syr" ] = "syriac", + ["syre"] = "estrangela syriac", + ["syrj"] = "western syriac", + ["syrn"] = "eastern syriac", ["szl" ] = "silesian", ["tab" ] = "tabasaran", ["taj" ] = "tajiki", @@ -680,6 +742,7 @@ local languages = allocate { ["tsj" ] = "tshangla", ["tua" ] = "turoyo aramaic", ["tul" ] = "tulu", + ["tum" ] = "tulu", ["tuv" ] = "tuvin", ["tvl" ] = "tuvalu", ["twi" ] = "twi", @@ -705,6 +768,7 @@ local languages = allocate { ["wel" ] = "welsh", ["wlf" ] = "wolof", ["wln" ] = "walloon", + ["wtm" ] = "mewati", ["xbd" ] = "lü", ["xhs" ] = "xhosa", ["xjb" ] = "minjangbal", @@ -730,6 +794,7 @@ local languages = allocate { ["zza" ] = "zazaki", } + local features = allocate { ["aalt"] = "access all alternates", ["abvf"] = "above-base forms", @@ -869,6 +934,7 @@ local features = allocate { ["vkna"] = "vertical kana alternates", ["vkrn"] = "vertical kerning", ["vpal"] = "proportional alternate vertical metrics", + ["vrtr"] = "vertical alternates for rotation", ["vrt2"] = "vertical rotation", ["zero"] = "slashed zero", @@ -879,8 +945,9 @@ local features = allocate { ["cv.."] = "character variant ..", ["js.."] = "justification ..", - ["dv.."] = "devanagari ..", - ["ml.."] = "malayalam ..", + ["dv.."] = "devanagari ..", -- for internal use + ["ml.."] = "malayalam ..", -- for internal use + } local baselines = allocate { diff --git a/tex/context/base/mkiv/l-pdfview.lua b/tex/context/base/mkiv/l-pdfview.lua index d2add9188..29dfaf81f 100644 --- a/tex/context/base/mkiv/l-pdfview.lua +++ b/tex/context/base/mkiv/l-pdfview.lua @@ -28,8 +28,6 @@ local allcalls -- a table with templates that close all open pdf documents local runner -- runner function local expander -- filename cleanup function --- maybe spawn/execute spec in calls - if os.type == "windows" then -- os.setenv("path",os.getenv("path") .. ";" .. "c:/data/system/pdf-xchange") diff --git a/tex/context/base/mkiv/lpdf-lmt.lua b/tex/context/base/mkiv/lpdf-lmt.lua index 156d3486f..0c6f1f3e4 100644 --- a/tex/context/base/mkiv/lpdf-lmt.lua +++ b/tex/context/base/mkiv/lpdf-lmt.lua @@ -7,7 +7,7 @@ if not modules then modules = { } end modules ['lpdf-lmt'] = { } -- The code below was originally in back-lpd.lua but it makes more sense in --- this namespace. +-- this namespace. I will rename variables. if CONTEXTLMTXMODE == 0 then return @@ -22,14 +22,15 @@ end -- https://www.youtube.com/watch?v=TYuTE_1jvvE -- https://www.youtube.com/watch?v=nnicGKX3lvM -- --- For the moment we have to support the built in backend as well as the alternative. So the --- next interface is suboptimal and will change at some time. +-- For the moment we have to support the built in backend as well as the alternative. So +-- the next interface is suboptimal and will change at some time. At that moment I will +-- also optimize and extend. local type, next, unpack, tonumber = type, next, unpack, tonumber local char, rep, find = string.char, string.rep, string.find local formatters, splitupstring = string.formatters, string.splitup local band, extract = bit32.band, bit32.extract -local concat, keys, sortedhash = table.concat, table.keys, table.sortedhash +local concat, sortedhash = table.concat, table.sortedhash local setmetatableindex = table.setmetatableindex local bpfactor = number.dimenfactors.bp @@ -38,9 +39,6 @@ local md5HEX = md5.HEX local osuuid = os.uuid local zlibcompress = flate.zip_compress or zlib.compress -local starttiming = statistics.starttiming -local stoptiming = statistics.stoptiming - local nuts = nodes.nuts local tonut = nodes.tonut @@ -128,10 +126,6 @@ local function reset_variables(specification) usedxforms = { } usedximages = { } boundingbox = specification.boundingbox - -- --- if overload then --- overload() --- end end -- buffer @@ -140,18 +134,9 @@ local buffer = { } local b = 0 local function reset_buffer() - -- buffer = { } - b = 0 -end - -local function flush_buffer() b = 0 end -local function show_buffer() - print(concat(buffer,"\n",1,b)) -end - -- fonts local fontcharacters @@ -159,11 +144,11 @@ local fontparameters local fontproperties local usedcharacters = setmetatableindex("table") local pdfcharacters + local horizontalmode = true ----- widefontmode = true local scalefactor = 1 ------ threshold = 655360 / (10 * 5) -- default is 5 -local threshold = 655360 * 50 / 100 +local threshold = 655360 * 5 / 100 local tjfactor = 100 / 65536 lpdf.usedcharacters = usedcharacters @@ -178,8 +163,7 @@ local function updatefontstate(font) horizontalmode = fontparameters.writingmode ~= "vertical" -- widefontmode = fontproperties.encodingbytes == 2 scalefactor = (designsize/size) * tjfactor - -- threshold = designsize / (10 * (fontproperties.threshold or 5)) - threshold = designsize * (fontproperties.threshold or 50) / 100 + threshold = size * (fontproperties.threshold or 5) / 100 end -- helpers @@ -393,6 +377,10 @@ local flushcharacter do local round = math.round + -- across pages ... todo: clean up because we don't need to pass the font + -- as fontparameters already has checked / set it we can also have a variable + -- for it so + local function setup_fontparameters(font,factor,f,e) local slant = (fontparameters.slantfactor or 0) / 1000 local extend = (fontparameters.extendfactor or 1000) / 1000 @@ -472,13 +460,13 @@ local flushcharacter do -- local f_char = formatters["%c"] local f_hex = formatters["%04X"] - local h_hex = setmetatableindex(function(t,k) + local h_hex = setmetatableindex(function(t,k) -- we already have this somewhere local v = f_hex(k) t[k] = v return v end) - flushcharacter = function(current,pos_h,pos_v,pos_r,font,char,data,factor,width,f,e) + flushcharacter = function(current,pos_h,pos_v,pos_r,font,char,data,naturalwidth,factor,width,f,e) if need_tf or font ~= f_cur or f_pdf ~= f_pdf_cur or fs ~= fs_cur or mode == "page" then pdf_goto_textmode() setup_fontparameters(font,factor,f,e) @@ -488,10 +476,15 @@ local flushcharacter do need_tm = true end local move = calc_pdfpos(pos_h,pos_v) + + -- report( + -- "factor %i, width %p, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p", + -- factor,width,naturalwidth,move,need_tm,pos_h,tj_delta,threshold,cw + -- ) + if move or need_tm then if not need_tm then if horizontalmode then --- print(tj_delta,threshold) if (saved_text_pos_v + tmty) ~= pdf_v then need_tm = true elseif tj_delta >= threshold or tj_delta <= -threshold then @@ -512,23 +505,13 @@ local flushcharacter do move = calc_pdfpos(pos_h,pos_v) end if move then - -- local d = round(tj_delta * scalefactor) - -- if d ~= 0 then local d = tj_delta * scalefactor - if d <= -0.5 or d >= 0.5 then + if d <= -0.5 or d >= 0.5 then -- 0.25 if mode == "char" then end_charmode() end - -- b = b + 1 ; buffer[b] = f_skip(d) - -- b = b + 1 ; buffer[b] = d - b = b + 1 ; buffer[b] = round(d) + b = b + 1 ; buffer[b] = round(d) -- or f_skip(d) end --- if d <= -0.25 or d >= 0.25 then --- if mode == "char" then --- end_charmode() --- end --- b = b + 1 ; buffer[b] = f_skip(d) --- end cw = cw - tj_delta end end @@ -550,9 +533,8 @@ local flushcharacter do -- buffer[b] = f_char(char) -- end - cw = cw + width + cw = cw + naturalwidth - -- pdfcharacters[fontcharacters[char].index or char] = true pdfcharacters[index] = true end @@ -1242,12 +1224,6 @@ local wrapup, registerpage do wrapup = function() - -- local includechar = lpdf.includecharlist - -- - -- for font, list in next, usedcharacters do - -- includechar(font,keys(list)) - -- end - -- hook (to reshuffle pages) local pagetree = { } local parent = nil diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex 16d4d5c9d..1c524b8d1 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex 41badc3d8..f6553771d 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkiv/syst-aux.mkiv b/tex/context/base/mkiv/syst-aux.mkiv index 924043849..8336800fc 100644 --- a/tex/context/base/mkiv/syst-aux.mkiv +++ b/tex/context/base/mkiv/syst-aux.mkiv @@ -8526,12 +8526,12 @@ \let\elapsedseconds \elapsedtime \newcount\c_syst_helpers_test_feature_n -\chardef \c_syst_helpers_test_feature_m\zerocount +\newcount\c_syst_helpers_test_feature_m \def\currentfeaturetest{\number\c_syst_helpers_test_feature_n} \unexpanded\def\testfeature#1#2% - {\chardef\c_syst_helpers_test_feature_m#1\relax + {\c_syst_helpers_test_feature_m#1\relax \def\syst_helpers_test_feature_yes {\advance\c_syst_helpers_test_feature_n\plusone \ifnum\c_syst_helpers_test_feature_n>\c_syst_helpers_test_feature_m\else diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv index 7664074c5..24397ecbf 100644 --- a/tex/context/base/mkiv/syst-ini.mkiv +++ b/tex/context/base/mkiv/syst-ini.mkiv @@ -412,7 +412,7 @@ \newdimen \zeropoint \zeropoint 0pt \newdimen \onepoint \onepoint 1pt \newdimen \halfapoint \halfapoint 0.5pt -\newdimen \maxdimen \maxdimen 16383.99999pt +\newdimen \maxdimen \maxdimen 16383.99999pt % 1073741823sp \newcount \maxcount \maxcount 2147483647 \newdimen \onebasepoint \onebasepoint 1bp \newdimen \scaledpoint \scaledpoint 1sp diff --git a/tex/context/base/mkiv/trac-log.lua b/tex/context/base/mkiv/trac-log.lua index e76c9f684..fd7b5016a 100644 --- a/tex/context/base/mkiv/trac-log.lua +++ b/tex/context/base/mkiv/trac-log.lua @@ -395,7 +395,7 @@ if runningtex and texio then status_yes = f.status_yes status_nop = f.status_nop if variant == "ansi" then - useluawrites() -- because tex escapes ^^ + useluawrites() -- because tex escapes ^^, not needed in lmtx end settarget(whereto) end diff --git a/tex/context/base/mkiv/util-sbx.lua b/tex/context/base/mkiv/util-sbx.lua index d5cf691ce..196c816d0 100644 --- a/tex/context/base/mkiv/util-sbx.lua +++ b/tex/context/base/mkiv/util-sbx.lua @@ -307,8 +307,8 @@ end -- runners can be strings or tables -- -- os.execute : string --- os.exec : string or table with program in [0|1] --- os.spawn : string or table with program in [0|1] +-- os.exec : string or table with program in [0|1] -- no longer there +-- os.spawn : string or table with program in [0|1] -- no longer there -- -- our execute: registered program with specification @@ -609,8 +609,8 @@ end if os then overload(os.execute, binaryrunner, "os.execute") - overload(os.spawn, dummyrunner, "os.spawn") - overload(os.exec, dummyrunner, "os.exec") + overload(os.spawn, dummyrunner, "os.spawn") -- no longer there + overload(os.exec, dummyrunner, "os.exec") -- no longer there overload(os.resultof, binaryrunner, "os.resultof") overload(os.pipeto, binaryrunner, "os.pipeto") overload(os.rename, filehandlertwo,"os.rename") diff --git a/tex/context/interface/mkii/keys-fr.xml b/tex/context/interface/mkii/keys-fr.xml index ef9dc8ee8..cc820098b 100644 --- a/tex/context/interface/mkii/keys-fr.xml +++ b/tex/context/interface/mkii/keys-fr.xml @@ -573,6 +573,7 @@ <cd:variable name='temporary' value='temporaire'/> <cd:variable name='test' value='test'/> <cd:variable name='text' value='texte'/> + <cd:variable name='textnote' value='textnote'/> <cd:variable name='three' value='trois'/> <cd:variable name='thursday' value='jeudi'/> <cd:variable name='tight' value='tight'/> diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf Binary files differindex fd58e5805..746f0fb36 100644 --- a/tex/context/interface/mkiv/i-context.pdf +++ b/tex/context/interface/mkiv/i-context.pdf diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf Binary files differindex c13794faa..847353e60 100644 --- a/tex/context/interface/mkiv/i-readme.pdf +++ b/tex/context/interface/mkiv/i-readme.pdf diff --git a/tex/context/modules/mkiv/s-maps.mkiv b/tex/context/modules/mkiv/s-maps.mkiv index bc0bcbaa0..af646b2e1 100644 --- a/tex/context/modules/mkiv/s-maps.mkiv +++ b/tex/context/modules/mkiv/s-maps.mkiv @@ -181,7 +181,7 @@ \unexpanded\def\hfonti {\ssbfa} \unexpanded\def\hfontii {\ssbf} \unexpanded\def\hfontiii {\rm\bi} -\unexpanded\def\runin #1{#1} +\unexpanded\def\runin #1{#1.} \setuphead [section,subject] [style=\hfonti, @@ -576,8 +576,6 @@ \continueifinputfile{s-maps.mkiv} -% \enabletrackers[mixedcolumns.*] - % \enablemode[nosubsub] % if you need at most two levels of sectioning % \enablemode[onecolumn] % for symmetric single-column layout % \enablemode[asym] % for asymmetric single-column layout, left aligned diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 81e00d12e..bafaac767 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 06/01/19 19:11:40 +-- merge date : 06/05/19 15:39:40 do -- begin closure to overcome local limits and interference @@ -12426,14 +12426,19 @@ otf.tables=tables local statistics=otf.statistics or {} otf.statistics=statistics local scripts=allocate { + ["adlm"]="adlam", + ["aghb"]="caucasian albanian", + ["ahom"]="ahom", ["arab"]="arabic", ["armi"]="imperial aramaic", ["armn"]="armenian", ["avst"]="avestan", ["bali"]="balinese", ["bamu"]="bamum", + ["bass"]="bassa vah", ["batk"]="batak", ["beng"]="bengali", + ["bhks"]="bhaiksuki", ["bng2"]="bengali variant 2", ["bopo"]="bopomofo", ["brah"]="brahmi", @@ -12449,23 +12454,33 @@ local scripts=allocate { ["copt"]="coptic", ["cprt"]="cypriot syllabary", ["cyrl"]="cyrillic", - ["deva"]="devanagari", ["dev2"]="devanagari variant 2", + ["deva"]="devanagari", + ["dogr"]="dogra", ["dsrt"]="deseret", + ["dupl"]="duployan", ["egyp"]="egyptian heiroglyphs", + ["elba"]="elbasan", ["ethi"]="ethiopic", ["geor"]="georgian", + ["gjr2"]="gujarati variant 2", ["glag"]="glagolitic", + ["gong"]="gunjala gondi", + ["gonm"]="masaram gondi", ["goth"]="gothic", + ["gran"]="grantha", ["grek"]="greek", ["gujr"]="gujarati", - ["gjr2"]="gujarati variant 2", - ["guru"]="gurmukhi", ["gur2"]="gurmukhi variant 2", + ["guru"]="gurmukhi", ["hang"]="hangul", ["hani"]="cjk ideographic", ["hano"]="hanunoo", + ["hatr"]="hatran", ["hebr"]="hebrew", + ["hluw"]="anatolian hieroglyphs", + ["hmng"]="pahawh hmong", + ["hung"]="old hungarian", ["ital"]="old italic", ["jamo"]="hangul jamo", ["java"]="javanese", @@ -12473,49 +12488,77 @@ local scripts=allocate { ["kana"]="hiragana and katakana", ["khar"]="kharosthi", ["khmr"]="khmer", - ["knda"]="kannada", + ["khoj"]="khojki", ["knd2"]="kannada variant 2", + ["knda"]="kannada", ["kthi"]="kaithi", ["lana"]="tai tham", ["lao" ]="lao", ["latn"]="latin", ["lepc"]="lepcha", ["limb"]="limbu", + ["lina"]="linear a", ["linb"]="linear b", ["lisu"]="lisu", ["lyci"]="lycian", ["lydi"]="lydian", + ["mahj"]="mahajani", + ["maka"]="makasar", ["mand"]="mandaic and mandaean", + ["mani"]="manichaean", + ["marc"]="marchen", ["math"]="mathematical alphanumeric symbols", + ["medf"]="medefaidrin", + ["mend"]="mende kikakui", ["merc"]="meroitic cursive", ["mero"]="meroitic hieroglyphs", - ["mlym"]="malayalam", ["mlm2"]="malayalam variant 2", + ["mlym"]="malayalam", + ["modi"]="modi", ["mong"]="mongolian", + ["mroo"]="mro", ["mtei"]="meitei Mayek", + ["mult"]="multani", ["musc"]="musical symbols", ["mym2"]="myanmar variant 2", ["mymr"]="myanmar", + ["narb"]="old north arabian", + ["nbat"]="nabataean", + ["newa"]="newa", ["nko" ]='n"ko', + ["nshu"]="nüshu", ["ogam"]="ogham", ["olck"]="ol chiki", ["orkh"]="old turkic and orkhon runic", - ["orya"]="oriya", ["ory2"]="odia variant 2", + ["orya"]="oriya", + ["osge"]="osage", ["osma"]="osmanya", + ["palm"]="palmyrene", + ["pauc"]="pau cin hau", + ["perm"]="old permic", ["phag"]="phags-pa", ["phli"]="inscriptional pahlavi", + ["phlp"]="psalter pahlavi", ["phnx"]="phoenician", + ["plrd"]="miao", ["prti"]="inscriptional parthian", ["rjng"]="rejang", + ["rohg"]="hanifi rohingya", ["runr"]="runic", ["samr"]="samaritan", ["sarb"]="old south arabian", ["saur"]="saurashtra", + ["sgnw"]="sign writing", ["shaw"]="shavian", ["shrd"]="sharada", + ["sidd"]="siddham", + ["sind"]="khudawadi", ["sinh"]="sinhala", + ["sogd"]="sogdian", + ["sogo"]="old sogdian", ["sora"]="sora sompeng", + ["soyo"]="soyombo", ["sund"]="sundanese", ["sylo"]="syloti nagri", ["syrc"]="syriac", @@ -12524,20 +12567,24 @@ local scripts=allocate { ["tale"]="tai le", ["talu"]="tai lu", ["taml"]="tamil", + ["tang"]="tangut", ["tavt"]="tai viet", - ["telu"]="telugu", ["tel2"]="telugu variant 2", + ["telu"]="telugu", ["tfng"]="tifinagh", ["tglg"]="tagalog", ["thaa"]="thaana", ["thai"]="thai", ["tibt"]="tibetan", + ["tirh"]="tirhuta", ["tml2"]="tamil variant 2", ["ugar"]="ugaritic cuneiform", ["vai" ]="vai", + ["wara"]="warang citi", ["xpeo"]="old persian cuneiform", ["xsux"]="sumero-akkadian cuneiform", ["yi" ]="yi", + ["zanb"]="zanabazar square", } local languages=allocate { ["aba" ]="abaza", @@ -12606,12 +12653,15 @@ local languages=allocate { ["brm" ]="burmese", ["brx" ]="bodo", ["bsh" ]="bashkir", + ["bsk" ]="burushaski", ["bti" ]="beti", ["bts" ]="batak simalungun", ["bug" ]="bugis", + ["byv" ]="medumba", ["cak" ]="kaqchikel", ["cat" ]="catalan", ["cbk" ]="zamboanga chavacano", + ["cchn"]="chinantec", ["ceb" ]="cebuano", ["cgg" ]="chiga", ["cha" ]="chamorro", @@ -12626,6 +12676,8 @@ local languages=allocate { ["chr" ]="cherokee", ["chu" ]="chuvash", ["chy" ]="cheyenne", + ["cja" ]="western cham", + ["cjm" ]="eastern cham", ["cmr" ]="comorian", ["cop" ]="coptic", ["cor" ]="cornish", @@ -12681,6 +12733,7 @@ local languages=allocate { ["fin" ]="finnish", ["fji" ]="fijian", ["fle" ]="dutch (flemish)", + ["fmp" ]="fe’fe’", ["fne" ]="forest nenets", ["fon" ]="fon", ["fos" ]="faroese", @@ -12759,6 +12812,7 @@ local languages=allocate { ["jan" ]="japanese", ["jav" ]="javanese", ["jbo" ]="lojban", + ["jct" ]="krymchak", ["jii" ]="yiddish", ["jud" ]="ladino", ["jul" ]="jula", @@ -12795,6 +12849,7 @@ local languages=allocate { ["kmn" ]="kumaoni", ["kmo" ]="komo", ["kms" ]="komso", + ["kmz" ]="khorasani turkic", ["knr" ]="kanuri", ["kod" ]="kodagu", ["koh" ]="korean old hangul", @@ -12871,6 +12926,7 @@ local languages=allocate { ["mar" ]="marathi", ["maw" ]="marwari", ["mbn" ]="mbundu", + ["mbo" ]="mbo", ["mch" ]="manchu", ["mcr" ]="moose cree", ["mde" ]="mende", @@ -12887,6 +12943,7 @@ local languages=allocate { ["mle" ]="male", ["mlg" ]="malagasy", ["mln" ]="malinke", + ["mlr" ]="malayalam reformed", ["mly" ]="malay", ["mnd" ]="mandinka", ["mng" ]="mongolian", @@ -12940,6 +12997,7 @@ local languages=allocate { ["nto" ]="esperanto", ["nym" ]="nyamwezi", ["nyn" ]="norwegian nynorsk", + ["nza" ]="mbembe tigon", ["oci" ]="occitan", ["ocr" ]="oji-cree", ["ojb" ]="ojibway", @@ -13003,6 +13061,7 @@ local languages=allocate { ["say" ]="sayisi", ["scn" ]="sicilian", ["sco" ]="scots", + ["scs" ]="north slavey", ["sek" ]="sekota", ["sel" ]="selkup", ["sga" ]="old irish", @@ -13047,6 +13106,9 @@ local languages=allocate { ["sxu" ]="upper saxon", ["syl" ]="sylheti", ["syr" ]="syriac", + ["syre"]="estrangela syriac", + ["syrj"]="western syriac", + ["syrn"]="eastern syriac", ["szl" ]="silesian", ["tab" ]="tabasaran", ["taj" ]="tajiki", @@ -13078,6 +13140,7 @@ local languages=allocate { ["tsj" ]="tshangla", ["tua" ]="turoyo aramaic", ["tul" ]="tulu", + ["tum" ]="tulu", ["tuv" ]="tuvin", ["tvl" ]="tuvalu", ["twi" ]="twi", @@ -13103,6 +13166,7 @@ local languages=allocate { ["wel" ]="welsh", ["wlf" ]="wolof", ["wln" ]="walloon", + ["wtm" ]="mewati", ["xbd" ]="lü", ["xhs" ]="xhosa", ["xjb" ]="minjangbal", @@ -13246,6 +13310,7 @@ local features=allocate { ["vkna"]="vertical kana alternates", ["vkrn"]="vertical kerning", ["vpal"]="proportional alternate vertical metrics", + ["vrtr"]="vertical alternates for rotation", ["vrt2"]="vertical rotation", ["zero"]="slashed zero", ["trep"]="traditional tex replacements", @@ -29582,24 +29647,59 @@ local function initializedevanagi(tfmdata) end end end - if script=="deva" or script=="knda" then - sharedfeatures["dv04"]=true - elseif script=="dev2" or script=="knd2" then - sharedfeatures["dv01"]=true - sharedfeatures["dv02"]=true - sharedfeatures["dv03"]=true + if script=="deva" then + sharedfeatures["dv04"]=true + elseif script=="dev2" then + sharedfeatures["dv01"]=true + sharedfeatures["dv02"]=true + sharedfeatures["dv03"]=true + sharedfeatures["dv04"]=true + elseif script=="knda" then + sharedfeatures["dv04"]=true + elseif script=="knd2" then + sharedfeatures["dv01"]=true + sharedfeatures["dv02"]=true + sharedfeatures["dv03"]=true + sharedfeatures["dv04"]=true + elseif script=="beng" then + sharedfeatures["dv04"]=true + elseif script=="bng2" then + sharedfeatures["dv01"]=true + sharedfeatures["dv02"]=true + sharedfeatures["dv03"]=true + sharedfeatures["dv04"]=true + elseif script=="gurj" then + sharedfeatures["dv04"]=true + elseif script=="grj2" then + sharedfeatures["dv01"]=true + sharedfeatures["dv02"]=true + sharedfeatures["dv03"]=true + sharedfeatures["dv04"]=true + elseif script=="guru" then + sharedfeatures["dv04"]=true + elseif script=="gur2" then + sharedfeatures["dv01"]=true + sharedfeatures["dv02"]=true + sharedfeatures["dv03"]=true + sharedfeatures["dv04"]=true + elseif script=="telu" then + sharedfeatures["dv04"]=true + elseif script=="tel2" then + sharedfeatures["dv01"]=true + sharedfeatures["dv02"]=true + sharedfeatures["dv03"]=true sharedfeatures["dv04"]=true elseif script=="mlym" then sharedfeatures["pstf"]=true elseif script=="mlm2" then sharedfeatures["pstf"]=true sharedfeatures["pref"]=true - sharedfeatures["dv03"]=true - gsubfeatures ["dv03"]=two_defaults + sharedfeatures["dv03"]=true + gsubfeatures ["dv03"]=two_defaults insert(sequences,insertindex,sequence_reorder_pre_base_reordering_consonants) elseif script=="taml" then - sharedfeatures["dv04"]=true -sharedfeatures["pstf"]=true + sharedfeatures["dv04"]=true + sharedfeatures["pstf"]=true elseif script=="tml2" then else report("todo: enable the right features for script %a",script) |