def scroll(self, dx, dy):
        """Scroll lines, if possible.

        Parameters
        ==========

        dx, dy (integers)
            indicates amounts (deltas) of pixels to scroll
            in x and y axes; accepts negative integers to
            scroll in the opposite direction.

        How it works
        ============

        Scrolling can be seen as moving text inside
        the scrolling area in the opposite direction
        of that which we want to peek.

        So, for instance, if I want to see more of the
        bottom of the text, that is, if I want to
        scroll down, it means I need to move the text
        up. However, additional checks must be performed.

        First, we must check whether there is more text
        beyond the scrolling area in the direction we
        want to peek (the opposite we want to scroll).

        This is important because if there isn't, we
        shouldn't scroll at all, so we set the delta to
        0.

        Second, we must check whether the text in the
        direction we want to peek will end up too much
        inside the scroll area (instead of being just
        inside it).

        We perform such check and, if it is the case,
        instead of scrolling the full delta, we just
        scroll the amount of pixels enough to align the
        text with the scroll area in that side.
        """
        ### retrieve a union rect of all lines,
        ### representing the text
        text_rect = self.lines.rect.union_rect

        ### perform check depending on the direction the
        ### text will scroll

        ## text will go left, so we check the right side

        if dx < 0:

            if text_rect.right < self.scroll_area.right:
                dx = 0

            elif text_rect.right + dx < self.scroll_area.right:

                dx = self.scroll_area.right - text_rect.right

        ## text will go right, so we check the left side

        elif dx > 0:

            if text_rect.left > self.scroll_area.left:
                dx = 0

            elif text_rect.left + dx > self.scroll_area.left:
                dx = self.scroll_area.left - text_rect.left

        ## text will go up, so we check the bottom

        if dy < 0:

            if text_rect.bottom < self.scroll_area.bottom:
                dy = 0

            elif text_rect.bottom + dy < self.scroll_area.bottom:

                dy = self.scroll_area.bottom - text_rect.bottom

        ## text will go down, so we check the top

        elif dy > 0:

            if text_rect.top > self.scroll_area.top:
                dy = 0

            elif text_rect.top + dy > self.scroll_area.top:
                dy = self.scroll_area.top - text_rect.top

        ### move lines (moves the rect of each line)
        self.lines.rect.move_ip(dx, dy)
Scroll lines, if possible.

        Parameters
        ==========

        dx, dy (integers)
            indicates amounts (deltas) of pixels to scroll
            in x and y axes; accepts negative integers to
            scroll in the opposite direction.

        How it works
        ============

        Scrolling can be seen as moving text inside
        the scrolling area in the opposite direction
        of that which we want to peek.

        So, for instance, if I want to see more of the
        bottom of the text, that is, if I want to
        scroll down, it means I need to move the text
        up. However, additional checks must be performed.

        First, we must check whether there is more text
        beyond the scrolling area in the direction we
        want to peek (the opposite we want to scroll).

        This is important because if there isn't, we
        shouldn't scroll at all, so we set the delta to
        0.

        Second, we must check whether the text in the
        direction we want to peek will end up too much
        inside the scroll area (instead of being just
        inside it).

        We perform such check and, if it is the case,
        instead of scrolling the full delta, we just
        scroll the amount of pixels enough to align the
        text with the scroll area in that side.
        
nodezator/textman/viewer/op.py