MyreMylar / pygame_gui

A GUI system for pygame.
MIT License
684 stars 78 forks source link

Text in UITextEntryLine become invisible while typing #627

Open toto6 opened 1 month ago

toto6 commented 1 month ago

Describe the bug When typing text inside a UITextEntryLine while some text is selected, the whole text in the input become invisible until the input lose the focus.

To Reproduce Code

import pygame
import pygame_gui
pygame.init()
width, height = 400, 200
screen = pygame.display.set_mode((width, height))
manager = pygame_gui.UIManager((width, height))
input = pygame_gui.elements.UITextEntryLine(
    manager=manager, relative_rect=pygame.Rect((0, 0), (200, 50)))
clock = pygame.time.Clock()
is_running = True
while is_running:
    time_delta = clock.tick(60)/1000.0
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            is_running = False
        manager.process_events(event)
    manager.update(time_delta)
    screen.fill((0, 0, 0))
    manager.draw_ui(screen)
    pygame.display.update()

2 - Type something in the input. Then select some text in the input, for example with ctrl+a, or with the mouse 3 - Type any character, and the whole text become invisible 4 - The text becomes again visible (including the text typed while everything was invisible) by clicking outside the input

Expected behaviour The text should not become invisible

Platform and software (please complete the following information):

Additional context I tried with older version and this bug is not present with pygame_gui==0.6.10. Maybe it was introduced in pygame_gui==0.6.11?