fix(chat): the message time no longer covers the end of the last line (#157)
@@ -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
);@@ -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};12
use super::hooks::{open_link, open_profile_link};12
use super::hooks::{open_link, open_profile_link};13
use super::link_tooltip::LinkTooltip;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
pub(super) const HIT_SLOP: f32 = 12.;18
pub(super) const HIT_SLOP: f32 = 12.;17
19
18
#[derive(Clone)]20
#[derive(Clone)]@@ -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.;87
const IMPORTANCE_LINE_HEIGHT: f32 = 16.;87
const IMPORTANCE_LINE_HEIGHT: f32 = 16.;88
const COMPACT_IMPORTANCE_LINE_HEIGHT: f32 = 14.;88
const COMPACT_IMPORTANCE_LINE_HEIGHT: f32 = 14.;89
pub(super) const BUBBLE_PADDING_X: f32 = 12.;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
const PULSE_PERIOD: Duration = Duration::from_millis(1600);92
const PULSE_PERIOD: Duration = Duration::from_millis(1600);92
const RECEIPT_FADE_PERIOD: Duration = Duration::from_millis(600);93
const RECEIPT_FADE_PERIOD: Duration = Duration::from_millis(600);93
pub const JUMP_HIGHLIGHT_PERIOD: Duration = Duration::from_millis(2400);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
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 usize647
(width / TIME_ROOM_WIDTH).ceil() as usize647
}648
}648
649
649
fn with_meta_room(blocks: &[Block], room: usize) -> Option<Vec<Block>> {650
fn with_meta_room(blocks: &[Block], room: usize) -> Option<Vec<Block>> {