diff options
author | 2020-08-22 18:10:05 -0400 | |
---|---|---|
committer | 2020-08-22 18:10:05 -0400 | |
commit | e78ff8b5f6fb724c34cc8e599e6b60592a3b8fe2 (patch) | |
tree | 37ed24534c536bb1cf7800cad233e3cf14fffc84 /core/ui.lua | |
parent | 37ead6cf4b781a3b3153cff4a2fb6ecddf41118d (diff) | |
download | textadept-e78ff8b5f6fb724c34cc8e599e6b60592a3b8fe2.tar.gz textadept-e78ff8b5f6fb724c34cc8e599e6b60592a3b8fe2.zip |
Improve handling of print buffers and splits.
Always split a single view if `ui.tabs` is `false` and prefer another split
view if switching to an existing print buffer.
Diffstat (limited to 'core/ui.lua')
-rw-r--r-- | core/ui.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/ui.lua b/core/ui.lua index 6416094a..3aded622 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -49,10 +49,14 @@ local function _print(buffer_type, ...) buffer = _G.buffer.new() buffer._type = buffer_type elseif not ui.silent_print then + if not ui.tabs and #_VIEWS == 1 then view:split() end for _, view in ipairs(_VIEWS) do if view.buffer._type == buffer_type then ui.goto_view(view) break end end - if view.buffer._type ~= buffer_type then view:goto_buffer(buffer) end + if view.buffer._type ~= buffer_type then + if #_VIEWS > 1 then ui.goto_view(1) end + view:goto_buffer(buffer) + end end local args, n = {...}, select('#', ...) for i = 1, n do args[i] = tostring(args[i]) end |