Account for markdown styling in mentions offset calculation.

This also means that we can support smart punctuation.

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Piotr Osiewicz 2023-10-23 12:50:57 +02:00
parent 763b13e700
commit 812ff9a97d
7 changed files with 207 additions and 96 deletions

View file

@ -639,16 +639,27 @@ pub struct ChatPanel {
pub input_editor: FieldEditor,
pub avatar: AvatarStyle,
pub avatar_container: ContainerStyle,
pub message: ChatMessage,
pub mention_highlight: HighlightStyle,
pub self_mention_background: Color,
pub continuation_message: ChatMessage,
pub rich_text: RichTextStyle,
pub message_sender: ContainedText,
pub message_timestamp: ContainedText,
pub message: Interactive<ContainerStyle>,
pub continuation_message: Interactive<ContainerStyle>,
pub pending_message: Interactive<ContainerStyle>,
pub last_message_bottom_spacing: f32,
pub pending_message: ChatMessage,
pub sign_in_prompt: Interactive<TextStyle>,
pub icon_button: Interactive<IconButton>,
}
#[derive(Clone, Deserialize, Default, JsonSchema)]
pub struct RichTextStyle {
pub text: TextStyle,
pub mention_highlight: HighlightStyle,
pub mention_background: Option<Color>,
pub self_mention_highlight: HighlightStyle,
pub self_mention_background: Option<Color>,
pub code_background: Option<Color>,
}
#[derive(Deserialize, Default, JsonSchema)]
pub struct NotificationPanel {
#[serde(flatten)]
@ -667,15 +678,6 @@ pub struct NotificationPanel {
pub button: Interactive<ContainedText>,
}
#[derive(Deserialize, Default, JsonSchema)]
pub struct ChatMessage {
#[serde(flatten)]
pub container: Interactive<ContainerStyle>,
pub body: TextStyle,
pub sender: ContainedText,
pub timestamp: ContainedText,
}
#[derive(Deserialize, Default, JsonSchema)]
pub struct ChannelSelect {
#[serde(flatten)]