(self, from_line, to_line)
Set the cursor shape.
Set the cursor shape.
Set the cursor shape .
def set_shape(self, from_line, to_line):
        """Set the cursor shape."""
        # odd treatment of cursors on EGA/VGA machines (14-pixel and up),
        # presumably for backward compatibility
        # the following algorithm is based on DOSBox source int10_char.cpp
        #     INT10_SetCursorShape(Bit8u first,Bit8u last)
        if self._height > 9:
            max_line = self._height - 1
            if from_line & 0xe0 == 0 and to_line & 0xe0 == 0:
                if (to_line < from_line):
                    # invisible only if to_line is zero and to_line < from_line
                    if to_line != 0:
                        # block shape from *to_line* to end
                        from_line = to_line
                        to_line = max_line
                elif ((from_line | to_line) >= max_line or
                            to_line != max_line-1 or from_line != max_line):
                    if to_line > 3:
                        if from_line+2 < to_line:
                            if from_line > 2:
                                from_line = (max_line+1) // 2
                            to_line = max_line
                        else:
                            from_line = from_line - to_line + max_line
                            to_line = max_line
                            if max_line > 0xc:
                                from_line -= 1
                                to_line -= 1
        self._from_line = max(0, min(from_line, self._height-1))
        self._to_line = max(0, min(to_line, self._height-1))
        self._queues.video.put(signals.Event(
            signals.VIDEO_SET_CURSOR_SHAPE, (self._from_line, self._to_line))
        )
def set_shape ( self , from_line , to_line ) : # odd treatment of cursors on EGA/VGA machines (14-pixel and up), # presumably for backward compatibility # the following algorithm is based on DOSBox source int10_char.cpp #     INT10_SetCursorShape(Bit8u first,Bit8u last) if self . _height > 9 : max_line = self . _height - 1 if from_line & 0xe0 == 0 and to_line & 0xe0 == 0 : if ( to_line < from_line ) : # invisible only if to_line is zero and to_line < from_line if to_line != 0 : # block shape from *to_line* to end from_line = to_line to_line = max_line elif ( ( from_line | to_line ) >= max_line or to_line != max_line - 1 or from_line != max_line ) : if to_line > 3 : if from_line + 2 < to_line : if from_line > 2 : from_line = ( max_line + 1 ) // 2 to_line = max_line else : from_line = from_line - to_line + max_line to_line = max_line if max_line > 0xc : from_line -= 1 to_line -= 1 self . _from_line = max ( 0 , min ( from_line , self . _height - 1 ) ) self . _to_line = max ( 0 , min ( to_line , self . _height - 1 ) ) self . _queues . video . put ( signals . Event ( signals . VIDEO_SET_CURSOR_SHAPE , ( self . _from_line , self . _to_line ) ) )