Port recent Warp terminal and UI improvements
Improve tab-group search, rename focus, history navigation, shell prompt and completion handling, emoji width promotion, and macOS clipboard support. Guard unavailable settings/model-selector/undo-close views and forward the MCP OAuth callback issuer through the existing authentication flow. Adapt local changes from 14 upstream Warp commits through f571865ca3f2, reviewed from the latest 200 commits. Preserve Galaxy provider lifecycle, permissions, storage, and branding; exclude hosted/cloud infrastructure. Fix existing boolean-assertion lints and use stronger optimization with four code-generation units for the app test target to fit macOS unwind offsets. Production and dependency compilation settings remain unchanged. Validation: two clean builds and a final build; both prescribed Clippy commands with -D warnings; formatting, shell syntax and completion cleanup; 167 focused regression tests. Galaxy was not launched.
This commit is contained in:
@@ -208,8 +208,43 @@ impl Cell {
|
||||
/// a row from flat scrollback storage, where the stored content was
|
||||
/// already capped on the way in) should pass `false` to suppress
|
||||
/// that redundant warning.
|
||||
///
|
||||
/// Returns whether the character was appended. A return value of
|
||||
/// `false` means that the grapheme was already at the size cap and the
|
||||
/// cell was not changed.
|
||||
#[inline]
|
||||
pub fn push_zerowidth(&mut self, c: char, log_long_grapheme_warnings: bool) {
|
||||
pub fn push_zerowidth(&mut self, c: char, log_long_grapheme_warnings: bool) -> bool {
|
||||
if let Some(zerowidth) = self
|
||||
.extra
|
||||
.as_deref_mut()
|
||||
.and_then(|extra| extra.cell_with_zero_width.as_mut())
|
||||
{
|
||||
let old_len = zerowidth.len();
|
||||
let new_len = old_len + c.len_utf8();
|
||||
if new_len > MAX_GRAPHEME_BYTES {
|
||||
// The accumulated grapheme cluster would exceed our
|
||||
// per-cell cap, which is in turn well below the
|
||||
// scrollback chunk size. Silently drop additional
|
||||
// zero-width characters: logging every dropped
|
||||
// character would produce a flood of spam for
|
||||
// pathological streams.
|
||||
return false;
|
||||
}
|
||||
zerowidth.push(c);
|
||||
// Log exactly once, on the push that first takes this cell
|
||||
// across the soft threshold. This surfaces unusually-large
|
||||
// graphemes in logs without producing per-character spam.
|
||||
if log_long_grapheme_warnings
|
||||
&& old_len < WARN_GRAPHEME_BYTES
|
||||
&& new_len >= WARN_GRAPHEME_BYTES
|
||||
{
|
||||
log::warn!(
|
||||
"cell grapheme has accumulated {new_len} bytes of zero-width content (base char {:?}); further zero-width pushes beyond {MAX_GRAPHEME_BYTES} bytes will be dropped",
|
||||
self.c,
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// If we're adding a zero-width character to this cell, but it has not
|
||||
// had any content set yet, set the content to a space. This preserves
|
||||
// its visual appearance, but clearly marks the cell as having been
|
||||
@@ -219,40 +254,32 @@ impl Cell {
|
||||
}
|
||||
|
||||
let extra = self.extra.get_or_insert_with(Box::default);
|
||||
match &mut extra.cell_with_zero_width {
|
||||
Some(zerowidth) => {
|
||||
let old_len = zerowidth.len();
|
||||
let new_len = old_len + c.len_utf8();
|
||||
if new_len > MAX_GRAPHEME_BYTES {
|
||||
// The accumulated grapheme cluster would exceed our
|
||||
// per-cell cap, which is in turn well below the
|
||||
// scrollback chunk size. Silently drop additional
|
||||
// zero-width characters: logging every dropped
|
||||
// character would produce a flood of spam for
|
||||
// pathological streams.
|
||||
return;
|
||||
}
|
||||
zerowidth.push(c);
|
||||
// Log exactly once, on the push that first takes this cell
|
||||
// across the soft threshold. This surfaces unusually-large
|
||||
// graphemes in logs without producing per-character spam.
|
||||
if log_long_grapheme_warnings
|
||||
&& old_len < WARN_GRAPHEME_BYTES
|
||||
&& new_len >= WARN_GRAPHEME_BYTES
|
||||
{
|
||||
log::warn!(
|
||||
"cell grapheme has accumulated {new_len} bytes of zero-width content (base char {:?}); further zero-width pushes beyond {MAX_GRAPHEME_BYTES} bytes will be dropped",
|
||||
self.c,
|
||||
);
|
||||
}
|
||||
}
|
||||
None => {
|
||||
// First zero-width push seeds the string with the base
|
||||
// character. The base character is always a single `char`,
|
||||
// so it cannot by itself exceed the cap.
|
||||
extra.cell_with_zero_width = Some(format!("{}{}", self.c, c));
|
||||
}
|
||||
// The first zero-width push seeds the string with the base
|
||||
// character. The base character is always a single `char`, so it
|
||||
// cannot by itself exceed the cap.
|
||||
extra.cell_with_zero_width = Some(format!("{}{}", self.c, c));
|
||||
true
|
||||
}
|
||||
|
||||
/// Removes and returns the most recently appended zero-width character.
|
||||
#[inline]
|
||||
pub fn pop_zerowidth(&mut self) -> Option<char> {
|
||||
let base_char_len = self.c.len_utf8();
|
||||
let extra = self.extra.as_deref_mut()?;
|
||||
let content = extra.cell_with_zero_width.as_mut()?;
|
||||
if content.len() <= base_char_len {
|
||||
return None;
|
||||
}
|
||||
|
||||
let popped = content.pop();
|
||||
if content.len() == base_char_len {
|
||||
extra.cell_with_zero_width = None;
|
||||
}
|
||||
let extra_is_empty = extra.cell_with_zero_width.is_none() && extra.end_of_prompt.is_none();
|
||||
if extra_is_empty {
|
||||
self.extra = None;
|
||||
}
|
||||
popped
|
||||
}
|
||||
|
||||
/// Returns whether cell is the end of prompt content (contains `EndOfPromptMarker`).
|
||||
|
||||
@@ -58,9 +58,11 @@ fn push_zerowidth_caps_accumulated_grapheme() {
|
||||
let zwj = '\u{200D}';
|
||||
let zwj_bytes = zwj.len_utf8();
|
||||
let pushes = (MAX_GRAPHEME_BYTES * 10) / zwj_bytes;
|
||||
let mut rejected_push = false;
|
||||
for _ in 0..pushes {
|
||||
cell.push_zerowidth(zwj, /* log_long_grapheme_warnings */ true);
|
||||
rejected_push |= !cell.push_zerowidth(zwj, /* log_long_grapheme_warnings */ true);
|
||||
}
|
||||
assert!(rejected_push);
|
||||
|
||||
let CharOrStr::Str(content) = cell.raw_content() else {
|
||||
panic!("cell should have accumulated zero-width content as a string");
|
||||
@@ -100,3 +102,22 @@ fn push_zerowidth_seeds_base_char_on_first_push() {
|
||||
cell.push_zerowidth('\u{0301}', /* log_long_grapheme_warnings */ true);
|
||||
assert_eq!(cell.raw_content(), CharOrStr::Str("x\u{0301}"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pop_zerowidth_restores_previous_cell_content() {
|
||||
let mut cell = Cell {
|
||||
c: 'x',
|
||||
..Cell::default()
|
||||
};
|
||||
let original_cell = cell.clone();
|
||||
|
||||
assert!(cell.push_zerowidth('\u{0301}', /* log_long_grapheme_warnings */ true));
|
||||
let cell_with_first_zerowidth = cell.clone();
|
||||
assert!(cell.push_zerowidth('\u{200D}', /* log_long_grapheme_warnings */ true));
|
||||
|
||||
assert_eq!(cell.pop_zerowidth(), Some('\u{200D}'));
|
||||
assert_eq!(cell, cell_with_first_zerowidth);
|
||||
assert_eq!(cell.pop_zerowidth(), Some('\u{0301}'));
|
||||
assert_eq!(cell, original_cell);
|
||||
assert_eq!(cell.pop_zerowidth(), None);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,9 @@ impl Iterator for RowIterator<'_> {
|
||||
// first seen on the ANSI-input path, so a warning here would
|
||||
// be redundant and would fire every time a row is
|
||||
// rematerialized (e.g. on scroll or resize).
|
||||
chars.for_each(|c| cell.push_zerowidth(c, /* log_long_grapheme_warnings */ false));
|
||||
chars.for_each(|c| {
|
||||
cell.push_zerowidth(c, /* log_long_grapheme_warnings */ false);
|
||||
});
|
||||
|
||||
cell.fg = fg;
|
||||
cell.bg = bg;
|
||||
|
||||
@@ -122,7 +122,9 @@ impl ToRows for &str {
|
||||
cell.c = chars.next().unwrap();
|
||||
// Add any remaining chars in the grapheme to the cell as zero-width
|
||||
// characters.
|
||||
chars.for_each(|c| cell.push_zerowidth(c, /* log_long_grapheme_warnings */ true));
|
||||
chars.for_each(|c| {
|
||||
cell.push_zerowidth(c, /* log_long_grapheme_warnings */ true);
|
||||
});
|
||||
|
||||
// If the grapheme takes up two cells, mark the following cell as
|
||||
// a spacer.
|
||||
|
||||
Reference in New Issue
Block a user