@@ -109,6 +109,16 @@ impl App {
109109 }
110110 }
111111
112+ fn open_comments ( & mut self ) {
113+ if let Some ( story) = self . stories . get ( self . selected_index ) {
114+ let hn_url = format ! ( "https://news.ycombinator.com/item?id={}" , story. id) ;
115+ match open:: that ( & hn_url) {
116+ Ok ( _) => self . set_status_message ( "Opened comments in browser" . to_string ( ) ) ,
117+ Err ( _) => self . set_status_message ( "Failed to open comments" . to_string ( ) ) ,
118+ }
119+ }
120+ }
121+
112122 async fn load_all_sections (
113123 & mut self ,
114124 terminal : & mut Terminal < CrosstermBackend < io:: Stdout > > ,
@@ -547,6 +557,7 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
547557 match app. mode {
548558 Mode :: Normal => match key. code {
549559 KeyCode :: Char ( 'q' ) => break ,
560+ KeyCode :: Char ( 'c' ) if key. modifiers . contains ( event:: KeyModifiers :: CONTROL ) => break ,
550561 KeyCode :: Char ( 'j' ) | KeyCode :: Down => app. next_story ( ) ,
551562 KeyCode :: Char ( 'k' ) | KeyCode :: Up => app. previous_story ( ) ,
552563 KeyCode :: Char ( 'R' ) => {
@@ -600,6 +611,9 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
600611 app. mode = Mode :: Menu ;
601612 app. menu_index = 0 ;
602613 }
614+ KeyCode :: Char ( 'C' ) => {
615+ app. open_comments ( ) ;
616+ }
603617 KeyCode :: Char ( 'h' ) => {
604618 app. current_section = match app. current_section {
605619 Section :: Top => Section :: Jobs ,
0 commit comments