Return slice from index1 to index2 (default is 'index1+1').
(self, index1, index2=None)
| 199 | self.data[line+len(chars)-1] += after |
| 200 | |
| 201 | def get(self, index1, index2=None): |
| 202 | "Return slice from index1 to index2 (default is 'index1+1')." |
| 203 | |
| 204 | startline, startchar = self._decode(index1) |
| 205 | if index2 is None: |
| 206 | endline, endchar = startline, startchar+1 |
| 207 | else: |
| 208 | endline, endchar = self._decode(index2) |
| 209 | |
| 210 | if startline == endline: |
| 211 | return self.data[startline][startchar:endchar] |
| 212 | else: |
| 213 | lines = [self.data[startline][startchar:]] |
| 214 | for i in range(startline+1, endline): |
| 215 | lines.append(self.data[i]) |
| 216 | lines.append(self.data[endline][:endchar]) |
| 217 | return ''.join(lines) |
| 218 | |
| 219 | def delete(self, index1, index2=None): |
| 220 | '''Delete slice from index1 to index2 (default is 'index1+1'). |