Return text with os eols. Add prompts if shell else final \n if missing.
(self)
| 252 | return False |
| 253 | |
| 254 | def fixnewlines(self): |
| 255 | """Return text with os eols. |
| 256 | |
| 257 | Add prompts if shell else final \n if missing. |
| 258 | """ |
| 259 | |
| 260 | if hasattr(self.editwin, "interp"): # Saving shell. |
| 261 | text = self.editwin.get_prompt_text('1.0', self.text.index('end-1c')) |
| 262 | else: |
| 263 | if self.text.get("end-2c") != '\n': |
| 264 | self.text.insert("end-1c", "\n") # Changes 'end-1c' value. |
| 265 | text = self.text.get('1.0', "end-1c") |
| 266 | if self.eol_convention != "\n": |
| 267 | text = text.replace("\n", self.eol_convention) |
| 268 | return text |
| 269 | |
| 270 | def encode(self, chars): |
| 271 | if isinstance(chars, bytes): |