does the work for clearstamp() and clearstamps()
(self, stampid)
| 3195 | return stitem |
| 3196 | |
| 3197 | def _clearstamp(self, stampid): |
| 3198 | """does the work for clearstamp() and clearstamps() |
| 3199 | """ |
| 3200 | if stampid in self.stampItems: |
| 3201 | if isinstance(stampid, tuple): |
| 3202 | for subitem in stampid: |
| 3203 | self.screen._delete(subitem) |
| 3204 | else: |
| 3205 | self.screen._delete(stampid) |
| 3206 | self.stampItems.remove(stampid) |
| 3207 | # Delete stampitem from undobuffer if necessary |
| 3208 | # if clearstamp is called directly. |
| 3209 | item = ("stamp", stampid) |
| 3210 | buf = self.undobuffer |
| 3211 | if item not in buf.buffer: |
| 3212 | return |
| 3213 | index = buf.buffer.index(item) |
| 3214 | buf.buffer.remove(item) |
| 3215 | if index <= buf.ptr: |
| 3216 | buf.ptr = (buf.ptr - 1) % buf.bufsize |
| 3217 | buf.buffer.insert((buf.ptr+1)%buf.bufsize, [None]) |
| 3218 | |
| 3219 | def clearstamp(self, stampid): |
| 3220 | """Delete stamp with given stampid |
no test coverage detected