Commit graph

12 commits

Author SHA1 Message Date
Barrett Ruth
a202725cc5
fix(submit): use file path over stdin; fix CF CodeMirror textarea (#305)
## Problem

After the initial submit hardening, two issues remained: source code was
read in Lua and piped as stdin to the scraper (unnecessary roundtrip
since
the file exists on disk), and CF's `page.fill()` timed out on the hidden
`textarea[name="source"]` because CodeMirror owns the editor state.

## Solution

Pass the source file path as a CLI arg instead — AtCoder calls
`page.set_input_files(file_path)` directly, CF reads it with
`Path(file_path).read_text()`. Fix CF source injection via
`page.evaluate()`
into the CodeMirror instance. Extract `BROWSER_SUBMIT_NAV_TIMEOUT` as a
per-platform `defaultdict` (CF defaults to 2× nav timeout). Save the
buffer
with `vim.cmd.update()` before submitting.
2026-03-05 14:34:14 -05:00
baaaa95b27 ci: format 2026-03-04 00:50:21 -05:00
900fd70935 fix(edit): clean up buffers on close and support :w to save
Problem: closing the test editor left cp://test-N-* buffers alive,
causing E95 on reopen. The nofile buftype also rejected :w, which
was counterintuitive in an editable grid.

Solution: delete all test buffers in toggle_edit teardown. Switch
buftype to acwrite with a BufWriteCmd autocmd that persists test
cases and clears the modified flag. Hoist save_all_tests above
setup_keybindings so the autocmd closure can reference it.
2026-03-04 00:50:21 -05:00
Barrett Ruth
1b0d5e4d77 feat: fix typign 2025-11-04 22:08:07 -05:00
Barrett Ruth
9238118fbe fix(ci): formatting 2025-11-04 08:33:56 -05:00
Barrett Ruth
6a61780928 fix(ci): typing 2025-11-04 08:19:14 -05:00
Barrett Ruth
9b90e3a452 feat(ui): close all buffers on edit 2025-10-24 21:40:13 -04:00
Barrett Ruth
b736fd0131 feat(ui): test editor 2025-10-24 17:02:43 -04:00
Barrett Ruth
11b6056d8c fix 2025-10-24 16:13:52 -04:00
Barrett Ruth
8ffa3cb0d2 fix: modernize use of typing 2025-10-24 15:10:58 -04:00
Barrett Ruth
a842886933 feat(ui): auto-hide source buffer on close 2025-10-24 14:47:12 -04:00
Barrett Ruth
4b1b75fd6e fix(config): padding spacing 2025-10-24 14:44:33 -04:00