Rust-SDL2 / rust-sdl2

SDL2 bindings for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

dylanopen opened this issue · comments

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.

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 :)