Rust-SDL2 / rust-sdl2

SDL2 bindings for Rust
MIT License
2.74k stars 468 forks source link

Event::TextDrop enum struct has incorrect field 'filename', should be 'text' #1401

Open dylanopen opened 4 months ago

dylanopen commented 4 months ago

The sdl2::event::Event::TextDrop enum defines an enum with the following definition:

DropText {
    timestamp: u32,
    window_id: u32,
    filename: String,
},

However, the actual definition should instead read:

DropText {
        timestamp: u32,
        window_id: u32,
        filename: String,
},

Clearly, the DropFile definition above was copied and pasted and wasn't changed properly for the DropText enum variant. I hope this makes sense!

This is a very minor issue but it confused me a little! I understand that fixing this may require refactoring projects, but it would be worth fixing in the next release of the sdl2 crate.

I would fix it with a PR, but it's not really worth it just to change a single line :)

Thanks, Dylan

Source: event.rs, line 895.

Cobrand commented 4 months ago

I think it still warrants a PR, but not in the sense that you are thinking of. Changing this field would require refactoring, however, adding a doc comment saying something along the lines of "due to backward compatbility issues, this field was not renamed, but its actual name should be "text", because it holds the text being dropped".

Something like that :)