does the work for clearstamp() and clearstamps()
(self, stampid)
| 2976 | return stitem |
| 2977 | |
| 2978 | def _clearstamp(self, stampid): |
| 2979 | """does the work for clearstamp() and clearstamps() |
| 2980 | """ |
| 2981 | if stampid in self.stampItems: |
| 2982 | if isinstance(stampid, tuple): |
| 2983 | for subitem in stampid: |
| 2984 | self.screen._delete(subitem) |
| 2985 | else: |
| 2986 | self.screen._delete(stampid) |
| 2987 | self.stampItems.remove(stampid) |
| 2988 | # Delete stampitem from undobuffer if necessary |
| 2989 | # if clearstamp is called directly. |
| 2990 | item = ("stamp", stampid) |
| 2991 | buf = self.undobuffer |
| 2992 | if item not in buf.buffer: |
| 2993 | return |
| 2994 | index = buf.buffer.index(item) |
| 2995 | buf.buffer.remove(item) |
| 2996 | if index <= buf.ptr: |
| 2997 | buf.ptr = (buf.ptr - 1) % buf.bufsize |
| 2998 | buf.buffer.insert((buf.ptr+1)%buf.bufsize, [None]) |
| 2999 | |
| 3000 | def clearstamp(self, stampid): |
| 3001 | """Delete stamp with given stampid |
no test coverage detected