BlueGit

ict rusty-teams

fix(chat): the message time no longer covers the end of the last line (#157)

metis Hung Do · pushed by metis

Authored 2026-11-29 · 2 days ago

Hash
d5f922eb93868bafe733a806fa9a74bc28044af6
Parent
c47a1974
3 files changed +7 −4
crates/app-ui-kit/src/render/blocks.rs +1 −1
@@ -141,7 +141,7 @@ impl Inline {
141 141 pub fn with_trailing_room(&self, width_in_spaces: usize) -> Inline {
142 142 let mut padded = self.clone();
143 143 padded.push(
144 &"\u{2007}".repeat(width_in_spaces),
144 &super::selectable::TIME_ROOM.to_string().repeat(width_in_spaces),
145 145 StyleFlags::default(),
146 146 None,
147 147 );
@@ -141,7 +141,7 @@ impl Inline {
141 pub fn with_trailing_room(&self, width_in_spaces: usize) -> Inline {
141 pub fn with_trailing_room(&self, width_in_spaces: usize) -> Inline {
142 let mut padded = self.clone();
142 let mut padded = self.clone();
143 padded.push(
143 padded.push(
144 &"\u{2007}".repeat(width_in_spaces),
144 &super::selectable::TIME_ROOM.to_string().repeat(width_in_spaces),
145 StyleFlags::default(),
145 StyleFlags::default(),
146 None,
146 None,
147 );
147 );
crates/app-ui-kit/src/render/selectable.rs +3 −1
@@ -12,7 +12,9 @@ use super::blocks::{CODE_PADDING, EMOJI_PLACEHOLDER};
12 12 use super::hooks::{open_link, open_profile_link};
13 13 use super::link_tooltip::LinkTooltip;
14 14
15 pub(super) const TIME_ROOM: char = '\u{2007}';
15 /// No-break space: it stays on the last word's line (GPUI wraps it as glue), and Google Sans Flex has it,
16 /// unlike the figure space (U+2007), whose fallback font left too little room for the time.
17 pub(super) const TIME_ROOM: char = '\u{00A0}';
16 18 pub(super) const HIT_SLOP: f32 = 12.;
17 19
18 20 #[derive(Clone)]
@@ -12,7 +12,9 @@ use super::blocks::{CODE_PADDING, EMOJI_PLACEHOLDER};
12use super::hooks::{open_link, open_profile_link};
12use super::hooks::{open_link, open_profile_link};
13use super::link_tooltip::LinkTooltip;
13use super::link_tooltip::LinkTooltip;
14
14
15pub(super) const TIME_ROOM: char = '\u{2007}';
15/// No-break space: it stays on the last word's line (GPUI wraps it as glue), and Google Sans Flex has it,
16/// unlike the figure space (U+2007), whose fallback font left too little room for the time.
17pub(super) const TIME_ROOM: char = '\u{00A0}';
16pub(super) const HIT_SLOP: f32 = 12.;
18pub(super) const HIT_SLOP: f32 = 12.;
17
19
18#[derive(Clone)]
20#[derive(Clone)]
crates/app/src/views/message_row.rs +3 −2
@@ -87,7 +87,8 @@ const IMPORTANCE_LABEL_SIZE: f32 = 12.;
87 87 const IMPORTANCE_LINE_HEIGHT: f32 = 16.;
88 88 const COMPACT_IMPORTANCE_LINE_HEIGHT: f32 = 14.;
89 89 pub(super) const BUBBLE_PADDING_X: f32 = 12.;
90 const FIGURE_SPACE_WIDTH: f32 = 7.4;
90 /// Advance of the no-break space that reserves the time's room: 489/2000 em in Google Sans Flex Regular at `BODY_SIZE`.
91 const TIME_ROOM_WIDTH: f32 = 3.3;
91 92 const PULSE_PERIOD: Duration = Duration::from_millis(1600);
92 93 const RECEIPT_FADE_PERIOD: Duration = Duration::from_millis(600);
93 94 pub const JUMP_HIGHLIGHT_PERIOD: Duration = Duration::from_millis(2400);
@@ -643,7 +644,7 @@ fn meta_room(row: &MessageRow, own: bool, saved: bool) -> usize {
643 644 if own {
644 645 width += META_CHECK_SIZE + 4.;
645 646 }
646 (width / FIGURE_SPACE_WIDTH).ceil() as usize
647 (width / TIME_ROOM_WIDTH).ceil() as usize
647 648 }
648 649
649 650 fn with_meta_room(blocks: &[Block], room: usize) -> Option<Vec<Block>> {
@@ -87,7 +87,8 @@ const IMPORTANCE_LABEL_SIZE: f32 = 12.;
87const IMPORTANCE_LINE_HEIGHT: f32 = 16.;
87const IMPORTANCE_LINE_HEIGHT: f32 = 16.;
88const COMPACT_IMPORTANCE_LINE_HEIGHT: f32 = 14.;
88const COMPACT_IMPORTANCE_LINE_HEIGHT: f32 = 14.;
89pub(super) const BUBBLE_PADDING_X: f32 = 12.;
89pub(super) const BUBBLE_PADDING_X: f32 = 12.;
90const FIGURE_SPACE_WIDTH: f32 = 7.4;
90/// Advance of the no-break space that reserves the time's room: 489/2000 em in Google Sans Flex Regular at `BODY_SIZE`.
91const TIME_ROOM_WIDTH: f32 = 3.3;
91const PULSE_PERIOD: Duration = Duration::from_millis(1600);
92const PULSE_PERIOD: Duration = Duration::from_millis(1600);
92const RECEIPT_FADE_PERIOD: Duration = Duration::from_millis(600);
93const RECEIPT_FADE_PERIOD: Duration = Duration::from_millis(600);
93pub const JUMP_HIGHLIGHT_PERIOD: Duration = Duration::from_millis(2400);
94pub const JUMP_HIGHLIGHT_PERIOD: Duration = Duration::from_millis(2400);
@@ -643,7 +644,7 @@ fn meta_room(row: &MessageRow, own: bool, saved: bool) -> usize {
643 if own {
644 if own {
644 width += META_CHECK_SIZE + 4.;
645 width += META_CHECK_SIZE + 4.;
645 }
646 }
646 (width / FIGURE_SPACE_WIDTH).ceil() as usize
647 (width / TIME_ROOM_WIDTH).ceil() as usize
647}
648}
648
649
649fn with_meta_room(blocks: &[Block], room: usize) -> Option<Vec<Block>> {
650fn with_meta_room(blocks: &[Block], room: usize) -> Option<Vec<Block>> {