Mercurial > prosody-hg
comparison plugins/mod_admin_shell.lua @ 13938:88f5ea4c28ce
mod_admin_shell: Skip adding margin for tables in non-repl use
Since it is there to account for the '| ' prefix added by the shell in
interactive mode it is not needed when in non-interactive mode.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 31 Aug 2025 00:41:59 +0200 |
| parents | f44f2a8a8c37 |
| children | b1e7d3f571b1 |
comparison
equal
deleted
inserted
replaced
| 13937:cfe3e85e715f | 13938:88f5ea4c28ce |
|---|---|
| 343 event.origin.shell_session = session; | 343 event.origin.shell_session = session; |
| 344 end | 344 end |
| 345 | 345 |
| 346 local default_width = 132; -- The common default of 80 is a bit too narrow for e.g. s2s:show(), 132 was another common width for hardware terminals | 346 local default_width = 132; -- The common default of 80 is a bit too narrow for e.g. s2s:show(), 132 was another common width for hardware terminals |
| 347 local margin = 2; -- To account for '| ' when lines are printed | 347 local margin = 2; -- To account for '| ' when lines are printed |
| 348 session.width = (tonumber(event.stanza.attr.width) or default_width)-margin; | 348 session.width = tonumber(event.stanza.attr.width) or default_width; |
| 349 | 349 |
| 350 local line = event.stanza:get_text(); | 350 local line = event.stanza:get_text(); |
| 351 local useglobalenv; | 351 local useglobalenv; |
| 352 | 352 |
| 353 session.repl = event.stanza.attr.repl ~= "0"; | 353 session.repl = event.stanza.attr.repl ~= "0"; |
| 354 if session.repl then | |
| 355 session.width = session.width - margin; | |
| 356 end | |
| 354 | 357 |
| 355 local result = st.stanza("repl-result"); | 358 local result = st.stanza("repl-result"); |
| 356 | 359 |
| 357 if line:match("^>") then | 360 if line:match("^>") then |
| 358 line = line:gsub("^>", ""); | 361 line = line:gsub("^>", ""); |
