Inserts a char at the given position. If the position is greater than the buffer length, the character will be appended at the end ot it.
(&mut self, pos: usize, ch: char)
| 92 | /// If the position is greater than the buffer length, the character will be appended at the |
| 93 | /// end ot it. |
| 94 | pub fn insert(&mut self, pos: usize, ch: char) { |
| 95 | self.line = self |
| 96 | .line |
| 97 | .chars() |
| 98 | .take(pos) |
| 99 | .chain(iter::once(ch)) |
| 100 | .chain(self.line.chars().skip(pos)) |
| 101 | .collect(); |
| 102 | } |
| 103 | |
| 104 | /// Returns the underlying string. |
| 105 | pub fn into_inner(self) -> String { |