Finalizes history bookkeeping and returns the edited line.
(mut self)
| 324 | |
| 325 | /// Finalizes history bookkeeping and returns the edited line. |
| 326 | fn finish(mut self) -> String { |
| 327 | if let Some(history) = self.history.as_mut() { |
| 328 | if self.line.is_empty() { |
| 329 | history.pop(); |
| 330 | } else { |
| 331 | let last = history.len() - 1; |
| 332 | history[last] = self.line.to_string(); |
| 333 | } |
| 334 | } |
| 335 | self.line.into_inner() |
| 336 | } |
| 337 | |
| 338 | /// Creates a new interactive line editor and renders its initial state. |
| 339 | fn new( |
no test coverage detected