feat(ui): fix alignment
This commit is contained in:
parent
92ffa41ed0
commit
038fcd36f8
3 changed files with 42 additions and 25 deletions
|
|
@ -378,9 +378,9 @@ Example: Setting up and solving AtCoder contest ABC324
|
|||
==============================================================================
|
||||
I/O VIEW *cp-io-view*
|
||||
|
||||
The I/O view provides the main view aggregate view into test input and
|
||||
program output. Used time/memory per test case are appended to the output.
|
||||
The |cp-panel| offers more fine-grained analysis into each test case.
|
||||
The I/O view provides lightweight test feedback in persistent side splits.
|
||||
All test outputs are concatenated with verdict summaries at the bottom.
|
||||
The |cp-panel| offers more fine-grained analysis with diff modes.
|
||||
|
||||
Access the I/O view with :CP run [n]
|
||||
|
||||
|
|
@ -388,24 +388,33 @@ Layout ~
|
|||
|
||||
The I/O view appears as 30% width splits on the right side: >
|
||||
|
||||
┌──────────────────────────┬──────────────────────────┐
|
||||
│ │ Output │
|
||||
│ │ Test 1: AC (42ms, 8MB) │
|
||||
│ │ Test 2: AC (38ms, 8MB) │
|
||||
│ Solution Code │ Test 3: WA (45ms, 8MB) │
|
||||
│ │ Test 4: AC (51ms, 9MB) │
|
||||
│ ├──────────────────────────┤
|
||||
│ │ Input │
|
||||
│ │ 5 3 │
|
||||
│ │ 1 2 3 4 5 │
|
||||
│ │ 2 1 │
|
||||
│ │ 10 20 │
|
||||
└──────────────────────────┴──────────────────────────┘
|
||||
┌──────────────────────────┬─────────────────────────────────────────────┐
|
||||
│ │ Output (Top Split) │
|
||||
│ │ 5 510 │
|
||||
│ │ │
|
||||
│ │ 7 714 │
|
||||
│ Solution Code │ │
|
||||
│ │ Test 1: WA | 212.07/2000 ms | 1/512 MB |...│
|
||||
│ │ Test 2: WA | 81.94/2000 ms | 1/512 MB |...│
|
||||
│ ├─────────────────────────────────────────────┤
|
||||
│ │ Input (Bottom Split) │
|
||||
│ │ 1 2 3 │
|
||||
│ │ │
|
||||
│ │ 4 5 6 │
|
||||
└──────────────────────────┴─────────────────────────────────────────────┘
|
||||
<
|
||||
The output split shows:
|
||||
1. Concatenated test outputs (separated by blank lines)
|
||||
2. Space-aligned verdict summary with:
|
||||
- Test number and status (AC/WA/TLE/MLE/RTE with color highlighting)
|
||||
- Runtime: actual/limit in milliseconds
|
||||
- Memory: actual/limit in megabytes
|
||||
- Exit code (with signal name for crashes)
|
||||
|
||||
Usage ~
|
||||
|
||||
:CP run Run all tests
|
||||
:CP run 3 Run test 3
|
||||
:CP run 3 Run test 3 only
|
||||
|
||||
Buffer Customization ~
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,14 @@ function M.pad_right(text, width)
|
|||
return text .. string.rep(' ', pad)
|
||||
end
|
||||
|
||||
function M.pad_left(text, width)
|
||||
local pad = width - #text
|
||||
if pad <= 0 then
|
||||
return text
|
||||
end
|
||||
return string.rep(' ', pad) .. text
|
||||
end
|
||||
|
||||
function M.center(text, width)
|
||||
local pad = width - #text
|
||||
if pad <= 0 then
|
||||
|
|
|
|||
|
|
@ -380,13 +380,13 @@ function M.run_io_view(test_index)
|
|||
local time_actual = tc.time_ms and string.format('%.2f', tc.time_ms) or '—'
|
||||
local time_limit = test_state.constraints and tostring(test_state.constraints.timeout_ms)
|
||||
or '—'
|
||||
local time_str = time_actual .. '/' .. time_limit .. ' ms'
|
||||
local time_data = time_actual .. '/' .. time_limit
|
||||
|
||||
local mem_actual = tc.rss_mb and string.format('%.0f', tc.rss_mb) or '—'
|
||||
local mem_limit = test_state.constraints
|
||||
and string.format('%.0f', test_state.constraints.memory_mb)
|
||||
or '—'
|
||||
local mem_str = mem_actual .. '/' .. mem_limit .. ' MB'
|
||||
local mem_data = mem_actual .. '/' .. mem_limit
|
||||
|
||||
local exit_code = tc.code or 0
|
||||
local signal_name = exit_code >= 128 and require('cp.constants').signal_codes[exit_code] or nil
|
||||
|
|
@ -395,15 +395,15 @@ function M.run_io_view(test_index)
|
|||
|
||||
widths.test_num = math.max(widths.test_num, #('Test ' .. idx .. ':'))
|
||||
widths.status = math.max(widths.status, #status.text)
|
||||
widths.time = math.max(widths.time, #time_str)
|
||||
widths.memory = math.max(widths.memory, #mem_str)
|
||||
widths.time = math.max(widths.time, #(time_data .. ' ms'))
|
||||
widths.memory = math.max(widths.memory, #(mem_data .. ' MB'))
|
||||
widths.exit = math.max(widths.exit, #('exit: ' .. exit_str))
|
||||
|
||||
table.insert(verdict_data, {
|
||||
idx = idx,
|
||||
status = status,
|
||||
time_str = time_str,
|
||||
mem_str = mem_str,
|
||||
time_data = time_data,
|
||||
mem_data = mem_data,
|
||||
exit_str = exit_str,
|
||||
})
|
||||
|
||||
|
|
@ -420,8 +420,8 @@ function M.run_io_view(test_index)
|
|||
for _, vd in ipairs(verdict_data) do
|
||||
local test_num_part = helpers.pad_right('Test ' .. vd.idx .. ':', widths.test_num)
|
||||
local status_part = helpers.pad_right(vd.status.text, widths.status)
|
||||
local time_part = helpers.pad_right(vd.time_str, widths.time)
|
||||
local mem_part = helpers.pad_right(vd.mem_str, widths.memory)
|
||||
local time_part = helpers.pad_right(vd.time_data, widths.time - 3) .. ' ms'
|
||||
local mem_part = helpers.pad_right(vd.mem_data, widths.memory - 3) .. ' MB'
|
||||
local exit_part = helpers.pad_right('exit: ' .. vd.exit_str, widths.exit)
|
||||
|
||||
local verdict_line = test_num_part
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue