Skip to content

Commit 9afee4e

Browse files
zixlin7dingfeli
authored andcommitted
update copy (#3452)
* final copy * handling small screen * revert the alignment change
1 parent bcb8fb7 commit 9afee4e

File tree

3 files changed

+62
-41
lines changed

3 files changed

+62
-41
lines changed

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,16 +1216,26 @@ impl ChatSession {
12161216
// Only show if we haven't reached the max count
12171217
if show_count < KIRO_UPGRADE_MAX_SHOW_COUNT {
12181218
let announcement_with_styling = crate::constants::kiro_upgrade_announcement();
1219+
let is_small_screen = self.terminal_width() < GREETING_BREAK_POINT;
12191220

1220-
draw_box(
1221-
&mut self.stderr,
1222-
"",
1223-
&announcement_with_styling,
1224-
GREETING_BREAK_POINT,
1225-
crate::theme::theme().ui.secondary_text,
1226-
)?;
1221+
if is_small_screen {
1222+
// If the screen is small, print the announcement without a box
1223+
execute!(
1224+
self.stderr,
1225+
style::Print(&announcement_with_styling),
1226+
style::Print("\n")
1227+
)?;
1228+
} else {
1229+
draw_box(
1230+
&mut self.stderr,
1231+
"",
1232+
&announcement_with_styling,
1233+
GREETING_BREAK_POINT,
1234+
crate::theme::theme().ui.secondary_text,
1235+
)?;
12271236

1228-
execute!(self.stderr, style::Print("\n"))?;
1237+
execute!(self.stderr, style::Print("\n"))?;
1238+
}
12291239

12301240
// Update the show count
12311241
os.database.set_kiro_upgrade_show_count(show_count + 1)?;
@@ -1381,6 +1391,9 @@ impl ChatSession {
13811391
}
13821392
}
13831393

1394+
// Show Kiro upgrade announcement before shortcuts (limited to 2 times)
1395+
self.show_kiro_upgrade_announcement(os).await?;
1396+
13841397
// Always show shortcuts and separator
13851398
execute!(
13861399
self.stderr,
@@ -1462,9 +1475,6 @@ impl ChatSession {
14621475
self.conversation.checkpoint_manager = checkpoint_manager;
14631476
}
14641477

1465-
// Show Kiro upgrade announcement (limited to 2 times)
1466-
self.show_kiro_upgrade_announcement(os).await?;
1467-
14681478
if let Some(user_input) = self.initial_input.take() {
14691479
self.inner = Some(ChatState::HandleInput { input: user_input });
14701480
}

crates/chat-cli/src/cli/chat/util/ui.rs

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,52 @@ pub fn draw_box(
2727

2828
// wrap the single line into multiple lines respecting inner width
2929
// Manually wrap the text by splitting at word boundaries, using visible length for styled text
30+
// First split by newlines to preserve explicit line breaks
3031
let mut wrapped_lines = Vec::new();
31-
let mut line = String::new();
3232

33-
for word in content.split_whitespace() {
34-
let test_line = if line.is_empty() {
35-
word.to_string()
36-
} else {
37-
format!("{} {}", line, word)
38-
};
33+
for paragraph in content.split('\n') {
34+
if paragraph.is_empty() {
35+
// Preserve empty lines
36+
wrapped_lines.push(String::new());
37+
continue;
38+
}
3939

40-
let visible_len = strip_str(&test_line).len();
41-
42-
if visible_len <= inner_width {
43-
line = test_line;
44-
} else {
45-
// Check if the word alone is too long
46-
let word_visible_len = strip_str(word).len();
47-
if word_visible_len >= inner_width {
48-
// Word is too long, we need to break it (but this is rare with styled text)
49-
if !line.is_empty() {
50-
wrapped_lines.push(line);
51-
}
52-
wrapped_lines.push(word.to_string());
53-
line = String::new();
40+
let mut line = String::new();
41+
42+
for word in paragraph.split_whitespace() {
43+
let test_line = if line.is_empty() {
44+
word.to_string()
5445
} else {
55-
// Start a new line with this word
56-
if !line.is_empty() {
57-
wrapped_lines.push(line);
46+
format!("{} {}", line, word)
47+
};
48+
49+
let visible_len = strip_str(&test_line).len();
50+
51+
if visible_len <= inner_width {
52+
line = test_line;
53+
} else {
54+
// Check if the word alone is too long
55+
let word_visible_len = strip_str(word).len();
56+
if word_visible_len >= inner_width {
57+
// Word is too long, we need to break it (but this is rare with styled text)
58+
if !line.is_empty() {
59+
wrapped_lines.push(line);
60+
}
61+
wrapped_lines.push(word.to_string());
62+
line = String::new();
63+
} else {
64+
// Start a new line with this word
65+
if !line.is_empty() {
66+
wrapped_lines.push(line);
67+
}
68+
line = word.to_string();
5869
}
59-
line = word.to_string();
6070
}
6171
}
62-
}
6372

64-
if !line.is_empty() {
65-
wrapped_lines.push(line);
73+
if !line.is_empty() {
74+
wrapped_lines.push(line);
75+
}
6676
}
6777

6878
let top_border = if title.is_empty() {

crates/chat-cli/src/constants.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,10 @@ Notes:
223223
/// Announcement text for Kiro CLI upgrade
224224
pub fn kiro_upgrade_announcement() -> String {
225225
format!(
226-
"Q CLI users can now upgrade to the Kiro CLI. Type {} to update today. The Kiro CLI leverages the agentic features of Q CLI and can be used with your existing Q Developer subscription. If you have auto updates enabled for the Q CLI, unless you disable that setting, Q CLI will auto update to Kiro CLI on 11/24. Kiro CLI is licensed as AWS Content under your Agreement and the AWS Intellectual Property License ({}). By updating to Kiro CLI, you agree to the AWS Intellectual Property License.",
226+
"Kiro CLI is the next update of the Q CLI. Your existing Q Developer CLI workflows and subscription continue to work without any changes. You can update to Kiro CLI manually with {} today, or wait for the auto-update on 11/24 to apply the change. To learn more, go to {}.\n\nKiro CLI is licensed under, and by updating to it you agree to, the AWS Intellectual Property License ({}).",
227227
StyledText::command("q update"),
228-
StyledText::command("https://aws.amazon.com/legal/aws-ip-license-terms/")
228+
StyledText::command("kiro.dev/cli/upgrade"),
229+
StyledText::command("kiro.dev/license")
229230
)
230231
}
231232

0 commit comments

Comments
 (0)