mirror of
https://github.com/openai/codex.git
synced 2026-04-24 22:54:54 +00:00
Merge branch 'main' into fixing-model-info
This commit is contained in:
@@ -573,6 +573,16 @@ impl ChatComposer {
|
||||
|
||||
#[inline]
|
||||
fn handle_non_ascii_char(&mut self, input: KeyEvent) -> (InputResult, bool) {
|
||||
if let KeyEvent {
|
||||
code: KeyCode::Char(ch),
|
||||
..
|
||||
} = input
|
||||
{
|
||||
let now = Instant::now();
|
||||
if self.paste_burst.try_append_char_if_active(ch, now) {
|
||||
return (InputResult::None, true);
|
||||
}
|
||||
}
|
||||
if let Some(pasted) = self.paste_burst.flush_before_modified_input() {
|
||||
self.handle_paste(pasted);
|
||||
}
|
||||
|
||||
@@ -163,6 +163,18 @@ impl PasteBurst {
|
||||
self.burst_window_until = Some(now + PASTE_ENTER_SUPPRESS_WINDOW);
|
||||
}
|
||||
|
||||
/// Try to append a char into the burst buffer only if a burst is already active.
|
||||
///
|
||||
/// Returns true when the char was captured into the existing burst, false otherwise.
|
||||
pub fn try_append_char_if_active(&mut self, ch: char, now: Instant) -> bool {
|
||||
if self.active || !self.buffer.is_empty() {
|
||||
self.append_char_to_buffer(ch, now);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Decide whether to begin buffering by retroactively capturing recent
|
||||
/// chars from the slice before the cursor.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user