(self, row, col, remove_depleted=False)
Delete the halfwidth character at the given position.
Delete the halfwidth character at the given position.
Delete the halfwidth character at the given position .
def _delete_at(self, row, col, remove_depleted=False):
        """Delete the halfwidth character at the given position."""
        # case 0) non-wrapping row:
        #           0a) left of or at logical end -> redraw until logical end
        #           0b) beyond logical end -> do nothing
        # case 1) full wrapping row -> redraw until physical end -> recurse for next row
        # case 2) LF row:
        #           2a) left of LF logical end ->  redraw until logical end
        #           2b) at or beyond LF logical end
        #                   -> attach next row's contents at current postion until physical end
        #                   -> if next row now empty, scroll it up & stop; otherwise recurse
        # note that the last line recurses into a multi-character delete!
        if not self.wraps(row):
            # case 0b
            if col > self.row_length(row):
                return
            # case 0a
            self._apage.delete_char_attr(row, col, self._attr)
            # if the row is depleted, drop it and scroll up from below
            if remove_depleted and self.row_length(row) == 0:
                self.scroll(row)
        elif self.row_length(row) == self.mode.width:
            # case 1
            wrap_char_attr = (
                self._apage.get_char(row+1, 1),
                self._apage.get_attr(row+1, 1)
            )
            if self.row_length(row + 1) == 0:
                wrap_char_attr = None
            self._apage.delete_char_attr(
                row, col, self._attr, wrap_char_attr
            )
            self._delete_at(row+1, 1, remove_depleted=True)
        elif col < self.row_length(row):
            # case 2a
            self._apage.delete_char_attr(row, col, self._attr)
        elif remove_depleted and col == self.row_length(row):
            # case 2b (ii) while on the first LF row deleting the last char immediately appends
            # the next row, any subsequent LF rows are only removed once they are fully empty and
            # DEL is pressed another time
            self._apage.delete_char_attr(row, col, self._attr)
        elif remove_depleted and self.row_length(row) == 0:
            # case 2b (iii) this is where the empty row mentioned at 2b (ii) gets removed
            self.scroll(row)
            return
        else:
            # case 2b (i) perform multi_character delete by looping single chars
            for newcol in range(col, self.mode.width+1):
                if self.row_length(row + 1) == 0:
                    break
                wrap_char = self._apage.get_char(row+1, 0)
                self._apage.put_char_attr(row, newcol, wrap_char, self._attr, adjust_end=True)
                self._delete_at(row+1, 1, remove_depleted=True)
def _delete_at ( self , row , col , remove_depleted = False ) : # case 0) non-wrapping row: #           0a) left of or at logical end -> redraw until logical end #           0b) beyond logical end -> do nothing # case 1) full wrapping row -> redraw until physical end -> recurse for next row # case 2) LF row: #           2a) left of LF logical end ->  redraw until logical end #           2b) at or beyond LF logical end #                   -> attach next row's contents at current postion until physical end #                   -> if next row now empty, scroll it up & stop; otherwise recurse # note that the last line recurses into a multi-character delete! if not self . wraps ( row ) : # case 0b if col > self . row_length ( row ) : return # case 0a self . _apage . delete_char_attr ( row , col , self . _attr ) # if the row is depleted, drop it and scroll up from below if remove_depleted and self . row_length ( row ) == 0 : self . scroll ( row ) elif self . row_length ( row ) == self . mode . width : # case 1 wrap_char_attr = ( self . _apage . get_char ( row + 1 , 1 ) , self . _apage . get_attr ( row + 1 , 1 ) ) if self . row_length ( row + 1 ) == 0 : wrap_char_attr = None self . _apage . delete_char_attr ( row , col , self . _attr , wrap_char_attr ) self . _delete_at ( row + 1 , 1 , remove_depleted = True ) elif col < self . row_length ( row ) : # case 2a self . _apage . delete_char_attr ( row , col , self . _attr ) elif remove_depleted and col == self . row_length ( row ) : # case 2b (ii) while on the first LF row deleting the last char immediately appends # the next row, any subsequent LF rows are only removed once they are fully empty and # DEL is pressed another time self . _apage . delete_char_attr ( row , col , self . _attr ) elif remove_depleted and self . row_length ( row ) == 0 : # case 2b (iii) this is where the empty row mentioned at 2b (ii) gets removed self . scroll ( row ) return else : # case 2b (i) perform multi_character delete by looping single chars for newcol in range ( col , self . mode . width + 1 ) : if self . row_length ( row + 1 ) == 0 : break wrap_char = self . _apage . get_char ( row + 1 , 0 ) self . _apage . put_char_attr ( row , newcol , wrap_char , self . _attr , adjust_end = True ) self . _delete_at ( row + 1 , 1 , remove_depleted = True )