diff --git a/src/mail/email_viewer.tcss b/src/mail/email_viewer.tcss index 2dcb91c..9d3ec9c 100644 --- a/src/mail/email_viewer.tcss +++ b/src/mail/email_viewer.tcss @@ -73,10 +73,25 @@ StatusTitle { EnvelopeHeader { dock: top; width: 100%; - max-height: 2; + height: auto; + max-height: 10; + padding: 0 1; tint: $primary 10%; } +/* Header labels should be single line with truncation */ +EnvelopeHeader Label { + width: 100%; + height: 1; + text-overflow: ellipsis; +} + +/* Full headers mode - allow wrapping */ +EnvelopeHeader.full-headers Label { + height: auto; + text-overflow: clip; +} + Markdown { padding: 1 2; } diff --git a/src/mail/screens/HelpScreen.py b/src/mail/screens/HelpScreen.py index 4299031..e9669b6 100644 --- a/src/mail/screens/HelpScreen.py +++ b/src/mail/screens/HelpScreen.py @@ -66,10 +66,12 @@ class HelpScreen(Screen): yield Static(" j/k - Next/Previous message") yield Static(" g - Go to oldest message") yield Static(" G - Go to newest message") + yield Static(" b - Scroll page up") yield Static(" PageDown/PageUp - Scroll page down/up") yield Static("") yield Static("[b green]Message Actions[/b green]") + yield Static(" o - Open message externally") yield Static(" # - Delete message(s)") yield Static(" e - Archive message(s)") yield Static(" u - Toggle read/unread") @@ -79,8 +81,10 @@ class HelpScreen(Screen): yield Static("[b green]View Options[/b green]") yield Static(" w - Toggle message view window") - yield Static(" m - Toggle markdown/html view mode") - yield Static(" h - Toggle envelope header") + yield Static( + " m - Toggle markdown/html view (or compressed/html for notifications)" + ) + yield Static(" h - Toggle full/compressed envelope headers") yield Static("") yield Static("[b green]Search & Filter[/b green]") diff --git a/src/mail/widgets/ContentContainer.py b/src/mail/widgets/ContentContainer.py index 09a15fa..31097a2 100644 --- a/src/mail/widgets/ContentContainer.py +++ b/src/mail/widgets/ContentContainer.py @@ -122,12 +122,13 @@ class EnvelopeHeader(Vertical): def __init__(self, **kwargs): super().__init__(**kwargs) - self.subject_label = Label("") - self.from_label = Label("") - self.to_label = Label("") - self.date_label = Label("") - self.cc_label = Label("") + self.subject_label = Label("", id="header_subject") + self.from_label = Label("", id="header_from") + self.to_label = Label("", id="header_to") + self.date_label = Label("", id="header_date") + self.cc_label = Label("", id="header_cc") # Store full values for toggle + self._full_subject = "" self._full_to = "" self._full_cc = "" self._full_from = "" @@ -212,18 +213,30 @@ class EnvelopeHeader(Vertical): def toggle_full_headers(self) -> None: """Toggle between compressed and full header view.""" self.show_full_headers = not self.show_full_headers + # Update CSS class for styling + if self.show_full_headers: + self.add_class("full-headers") + else: + self.remove_class("full-headers") self._refresh_display() def _refresh_display(self) -> None: """Refresh the display based on current mode.""" if self.show_full_headers: + # Full view - show complete text + self.subject_label.update( + f"[b bright_white]{self._full_subject}[/b bright_white]" + ) self.from_label.update(f"[b]From:[/b] {self._full_from}") self.to_label.update(f"[b]To:[/b] {self._full_to}") if self._full_cc: self.cc_label.update(f"[b]CC:[/b] {self._full_cc}") self.cc_label.styles.display = "block" else: - # Compressed view + # Compressed view - truncate for single line display + self.subject_label.update( + f"[b bright_white]{self._full_subject}[/b bright_white]" + ) self.from_label.update( f"[b]From:[/b] {self._compress_recipients(self._full_from, max_shown=1)}" ) @@ -238,13 +251,11 @@ class EnvelopeHeader(Vertical): def update(self, subject, from_, to, date, cc=None): # Store full values + self._full_subject = subject or "" self._full_from = from_ or "" self._full_to = to or "" self._full_cc = cc or "" - # Subject is prominent - bold, bright white, no label needed - self.subject_label.update(f"[b bright_white]{subject}[/b bright_white]") - # Format the date for better readability if date: try: @@ -334,15 +345,25 @@ class ContentContainer(ScrollableContainer): self.border_subtitle = f"{mode_icon} {mode_label}" async def action_toggle_mode(self): - """Toggle between markdown and HTML viewing modes.""" + """Toggle between markdown/compressed and HTML viewing modes. + + For notification emails: cycles between compressed view and HTML. + For regular emails: cycles between markdown and HTML. + """ if self.current_mode == "html": self.current_mode = "markdown" else: self.current_mode = "html" # Reload the content if we have a message ID + # This will re-apply compression if applicable for markdown mode if self.current_message_id: - self.display_content(self.current_message_id) + self.display_content( + self.current_message_id, + folder=self.current_folder, + account=self.current_account, + envelope=self.current_envelope, + ) def update_header(self, subject, from_, to, date, cc=None): self.header.update(subject, from_, to, date, cc)