ayn2op / discordo

A lightweight, secure, and feature-rich Discord terminal client.
MIT License
2.26k stars 70 forks source link

Not drawing messages with unknown types messes with the next/prev message selection logic #429

Closed b2ag closed 2 months ago

b2ag commented 2 months ago

Hi,

the logic for handling cfg.Keys.SelectPrevious/SelectNext assumes every message is actually represented by a line/region.

https://github.com/ayn2op/discordo/blob/9d001a522e60f3d199b6719ca651a12a089c2538/cmd/messages_text.go#L208

A message like "foo pinned to channel" currently doesn't generate a region because it's of type 6 (discord.ChannelPinnedMessage).

https://github.com/ayn2op/discordo/blob/9d001a522e60f3d199b6719ca651a12a089c2538/cmd/messages_text.go#L86

Easy fix would be a line/region to representing the default case. Stating it's a message with an unknown type.

Best,

EDIT: Better way to solve this would be to rework the selection logic as it doesn't play well with other things either. Like selecting a region with a mouse click.