diff --git a/pygame_gui/core/text/html_parser.py b/pygame_gui/core/text/html_parser.py index 39b4c960..96bcb78b 100644 --- a/pygame_gui/core/text/html_parser.py +++ b/pygame_gui/core/text/html_parser.py @@ -255,7 +255,7 @@ def _handle_line_break(self): antialiased=self.current_style['antialiased'], script=self.current_style['script'], direction=self.current_style['direction']) - dimensions = (current_font.get_rect(' ').width, + dimensions = (4, int(round(self.current_style['font_size'] * self.line_spacing))) chunk = self.create_styled_text_chunk('') diff --git a/pygame_gui/core/text/line_break_layout_rect.py b/pygame_gui/core/text/line_break_layout_rect.py index 97d2eff4..c540400f 100644 --- a/pygame_gui/core/text/line_break_layout_rect.py +++ b/pygame_gui/core/text/line_break_layout_rect.py @@ -39,4 +39,5 @@ def finalise(self, self.select_surf = Surface((self.selection_chunk_width, row_bg_height), flags=pygame.SRCALPHA) self.select_surf.fill(self.selection_colour) target_surface.blit(self.select_surf, self.topleft, special_flags=pygame.BLEND_PREMULTIPLIED) + # should be cleared by row diff --git a/pygame_gui/core/text/text_box_layout.py b/pygame_gui/core/text/text_box_layout.py index 1e7d8657..ee09cae0 100644 --- a/pygame_gui/core/text/text_box_layout.py +++ b/pygame_gui/core/text/text_box_layout.py @@ -186,7 +186,7 @@ def _add_row_to_layout(self, current_row: TextBoxLayoutRow, last_row=False): # otherwise we add infinite rows with no height # instead add a line break rect to an empty row. if len(current_row.items) == 0 and not last_row: - current_row.add_item(LineBreakLayoutRect(dimensions=(2, self.last_row_height), + current_row.add_item(LineBreakLayoutRect(dimensions=(4, self.last_row_height), font=current_row.fall_back_font)) if current_row not in self.layout_rows: self.layout_rows.append(current_row) diff --git a/pygame_gui/core/text/text_box_layout_row.py b/pygame_gui/core/text/text_box_layout_row.py index 344d3656..013a46e2 100644 --- a/pygame_gui/core/text/text_box_layout_row.py +++ b/pygame_gui/core/text/text_box_layout_row.py @@ -364,7 +364,7 @@ def clear(self): """ if self.target_surface is not None and self.surf_row_dirty: slightly_wider_rect = pygame.Rect(self.x, self.y, - self.layout.view_rect.width, + self.width + self.cursor_draw_width, self.height) self.target_surface.fill(pygame.Color('#00000000'), slightly_wider_rect) self.surf_row_dirty = False