Skip to content

Commit

Permalink
Selection fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MyreMylar committed Apr 14, 2024
1 parent 4d972e8 commit 91ce7bc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pygame_gui/core/text/html_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('')
Expand Down
1 change: 1 addition & 0 deletions pygame_gui/core/text/line_break_layout_rect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion pygame_gui/core/text/text_box_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pygame_gui/core/text/text_box_layout_row.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 91ce7bc

Please sign in to comment.