]> Repositorios git - scryer-prolog.git/commitdiff
Improved readline
authornotoria <[email protected]>
Fri, 31 Jul 2020 16:12:38 +0000 (18:12 +0200)
committernotoria <[email protected]>
Fri, 31 Jul 2020 19:16:33 +0000 (21:16 +0200)
src/read.rs

index 803102bfb0457067893b3442bd67205dad96a8bd..9230f76e0ed280112a9bc7e6b92437e130ccdfdd 100644 (file)
@@ -67,7 +67,10 @@ pub mod readline {
                         }
                     }
 
-                    *self.pending_input.get_mut() += "\n";
+                    if self.pending_input.get_ref().chars().last() != Some('\n')
+                    {
+                        *self.pending_input.get_mut() += "\n";
+                    }
                     self.pending_input.read(buf)
                 }
                 Err(ReadlineError::Eof) => {