mirror of
https://github.com/1j01/textual-paint.git
synced 2024-11-28 10:03:29 +03:00
Fix flood fill infinite loop when color under cursor matches fill color
This commit is contained in:
parent
a91dd25996
commit
61227597f8
@ -125,7 +125,6 @@ The rest match MS Paint's keyboard shortcuts:
|
||||
- Some languages don't display correctly.
|
||||
- Large files can make the program very slow.
|
||||
- The program sometimes crashes or freezes randomly.
|
||||
- The program freezes when using the fill tool on a spot already filled with the target color.
|
||||
|
||||
## Development
|
||||
|
||||
|
3
paint.py
3
paint.py
@ -818,7 +818,8 @@ def flood_fill(document: AnsiArtDocument, x: int, y: int, fill_ch: str, fill_fg:
|
||||
return (
|
||||
document.ch[y][x] == original_ch and
|
||||
document.bg[y][x] == original_bg and
|
||||
(original_ch == " " or document.fg[y][x] == original_fg)
|
||||
(original_ch == " " or document.fg[y][x] == original_fg) and
|
||||
(document.ch[y][x] != fill_ch or document.bg[y][x] != fill_bg or document.fg[y][x] != fill_fg)
|
||||
)
|
||||
|
||||
def set_cell(x: int, y: int) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user