mirror of
https://github.com/openai/codex.git
synced 2026-09-16 12:13:30 +00:00
Merge 20afce7105 into sapling-pr-archive-bolinfest
This commit is contained in:
@@ -4,6 +4,6 @@ In the codex-rs folder where the rust code lives:
|
||||
|
||||
- Never add or modify any code related to `CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR`. You operate in a sandbox where `CODEX_SANDBOX_NETWORK_DISABLED=1` will be set whenever you use the `shell` tool. Any existing code that uses `CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR` was authored with this fact in mind. It is often used to early exit out of tests that the author knew you would not be able to run given your sandbox limitations.
|
||||
|
||||
After making changes to the rust code run `just fmt` (in `codex-rs` directory) to format the code and `just fix` (in `codex-rs` directory) to fix any linter issues in the code.
|
||||
Before creating a pull request with changes to `codex-rs`, run `just fmt` (in `codex-rs` directory) to format the code and `just fix` (in `codex-rs` directory) to fix any linter issues in the code, ensure the test suite passes by running `cargo test --all-features` in the `codex-rs` directory.
|
||||
|
||||
Ensure the test suite passes by running `cargo test --all-features` in the `codex-rs` directory.
|
||||
When making individual changes prefer running tests on individual files or projects first.
|
||||
|
||||
@@ -28,4 +28,5 @@ fix:
|
||||
cargo clippy --fix --all-features --tests --allow-dirty
|
||||
|
||||
install:
|
||||
rustup show active-toolchain
|
||||
cargo fetch
|
||||
|
||||
@@ -25,8 +25,15 @@ use std::sync::mpsc::channel;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
|
||||
/// Debouncing is often a helpful performance optimization, though as shown in
|
||||
/// https://github.com/openai/codex/pull/1610, it requires care to ensure that
|
||||
/// it works well with interrupts via ctrl-C. For now, we favor correctness at
|
||||
/// the cost of performance, but it would be worth revisiting this in the
|
||||
/// future.
|
||||
const DEBOUNCE_REDRAW_REQUESTS: bool = false;
|
||||
|
||||
/// Time window for debouncing redraw requests.
|
||||
const REDRAW_DEBOUNCE: Duration = Duration::from_millis(100);
|
||||
const REDRAW_DEBOUNCE: Duration = Duration::from_millis(10);
|
||||
|
||||
/// Top-level application state: which full-screen view is currently active.
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
@@ -209,10 +216,14 @@ impl App<'_> {
|
||||
while let Ok(event) = self.app_event_rx.recv() {
|
||||
match event {
|
||||
AppEvent::RequestRedraw => {
|
||||
self.schedule_redraw();
|
||||
if DEBOUNCE_REDRAW_REQUESTS {
|
||||
self.schedule_redraw();
|
||||
} else {
|
||||
self.redraw_immediately(terminal)?;
|
||||
}
|
||||
}
|
||||
AppEvent::Redraw => {
|
||||
self.draw_next_frame(terminal)?;
|
||||
self.redraw_immediately(terminal)?;
|
||||
}
|
||||
AppEvent::KeyEvent(key_event) => {
|
||||
match key_event {
|
||||
@@ -386,6 +397,10 @@ impl App<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
fn redraw_immediately(&mut self, terminal: &mut tui::Tui) -> Result<()> {
|
||||
self.draw_next_frame(terminal)
|
||||
}
|
||||
|
||||
fn dispatch_paste_event(&mut self, pasted: String) {
|
||||
match &mut self.app_state {
|
||||
AppState::Chat { widget } => widget.handle_paste(pasted),
|
||||
|
||||
Reference in New Issue
Block a user