fix(ui): correct output buf
This commit is contained in:
parent
13d931ed19
commit
7d8d00c5ad
2 changed files with 15 additions and 1 deletions
|
|
@ -216,7 +216,16 @@ function M.setup_problem(problem_id, language)
|
|||
return
|
||||
end
|
||||
|
||||
local old_problem_id = state.get_problem_id()
|
||||
state.set_problem_id(problem_id)
|
||||
|
||||
if old_problem_id ~= problem_id then
|
||||
local io_state = state.get_io_view_state()
|
||||
if io_state and io_state.output_buf and vim.api.nvim_buf_is_valid(io_state.output_buf) then
|
||||
local utils = require('cp.utils')
|
||||
utils.update_buffer_content(io_state.output_buf, {}, nil, nil)
|
||||
end
|
||||
end
|
||||
local config = config_module.get_config()
|
||||
local lang = language
|
||||
or (config.platforms[platform] and config.platforms[platform].default_language)
|
||||
|
|
@ -369,6 +378,12 @@ function M.navigate_problem(direction, language)
|
|||
end
|
||||
end
|
||||
|
||||
local io_state = state.get_io_view_state()
|
||||
if io_state and io_state.output_buf and vim.api.nvim_buf_is_valid(io_state.output_buf) then
|
||||
local utils = require('cp.utils')
|
||||
utils.update_buffer_content(io_state.output_buf, {}, nil, nil)
|
||||
end
|
||||
|
||||
M.setup_contest(platform, contest_id, problems[new_index].id, lang)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -736,7 +736,6 @@ function M.toggle_panel(panel_opts)
|
|||
end
|
||||
end
|
||||
end
|
||||
state.set_io_view_state(nil)
|
||||
end
|
||||
|
||||
local session_file = vim.fn.tempname()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue