Skip to content

upcoming problem with bitflags and key_list ron reading #1929

Closed
@pm100

Description

@pm100

While working on the replacement of textinput with tui-textarea I found a problem that is coming down the pipe

when bitflags changed from v1 to v2 they changed their serialization format - see https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md#200-rc2

The current ron files for key mapping use the v1 format - of course

crossterm 0.27 pulls in bitflags v2. This now means that gitui can no longer read its key config files, plus there are two tests that fail.

I upgraded crossterm because tui-textarea asks for 0.27, and anyway I assume gitui would eventually upgrade anyway since its a core dependency

I am not sure if there is a good solution (I dont know serde well enough but have done some reading)

There is a crate that allows reading the old format, but it requires changes to the bitflags definition. The bitflags in key_list ron are defined in crossterm not gitui (KeyModifiers) and it seems like an odd change to ask crossterm to make.

The only other alternatives would be

  • a breaking change
  • code that reads the file before handing it over to serde, changes it on the fly to the new format, then passes an in memory version to serde
  • any other idea?

I dont know if gitui can specify a custom deserializer for the KeyModifiers type

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions