KapiX / Koder

A code editor for Haiku based on Scintilla editing component.
MIT License
42 stars 15 forks source link

Dropping a color strange behaviour #135

Closed extrowerk closed 2 years ago

extrowerk commented 4 years ago

Undo reveals that dropping a color (from Colors!) onto a line the color hexa-code got inserted and gets instantly overwritten with the current content of the clipboard.

How to reproduce:

Maybe it is a bug in Haiku, idk.

extrowerk commented 4 years ago

Cöüy some text = Copy some text, cant edit in WP.

KapiX commented 2 years ago

This is a problem with Colors!.

It uses "Simple Drag'n'Drop" "protocol" which is described in BeBook as useful for "dragging and dropping which takes place within a single application, or within a tightly coupled set of applications which "know about" one another." This case is neither single application nor a set of applications that would know about each other, so I consider it invalid.

The reason for overwriting with clipboard contents is that Colors! uses B_PASTE as what. Currently Scintilla takes the dropped message and just passes it without change to BView for handling, and the default action for B_PASTE would be to insert clipboard contents.

While there is work on Scintilla side on actually implementing negotiated drag'n'drop, it would not fix this problem. Colors! should use something like B_SIMPLE_DATA for drag message, this has more chance of being correctly recognized by a wider set of applications going into the future. However, I do recognize that B_PASTE itself might have been some kind of compatibility hack.