Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in drag and drop #69

Closed
kov-serg opened this issue Apr 8, 2022 · 2 comments
Closed

Bug in drag and drop #69

kov-serg opened this issue Apr 8, 2022 · 2 comments

Comments

@kov-serg
Copy link

kov-serg commented Apr 8, 2022

https://github.com/ultimatepp/ultimatepp/blob/master/uppsrc/Core/Defs.h#L157

typedef uint32             wchar;

https://github.com/ultimatepp/ultimatepp/blob/master/uppsrc/CtrlCore/CtrlClip.cpp#L118

String Unicode__(const WString& w)
{
	return String((const char *)~w, 2 * w.GetLength());
}

wchar is 4 bytes long so string will hold only one first characted.

How to reproduce. Create textedit type some text, select several letters and move it with mouse. It moves only first letter, rest will disappear.

ps:
https://github.com/ultimatepp/ultimatepp/blob/master/uppsrc/plugin/lz4/lib/lz4.c#L1348

static size_t LZ4_stream_t_alignment(void)
{
    struct { char c; LZ4_stream_t t; } t_a;
    return sizeof(t_a) - sizeof(t_a.t);
}

should be replaced with

static size_t LZ4_stream_t_alignment(void)
{
    struct { char c; int* t; } t_a;
    return sizeof(t_a) - sizeof(t_a.t);
}

in order to work with gcc, or it fall's on aligment check nearby an cause segav

@kov-serg kov-serg changed the title Bug in drag and drop clipboard Bug in drag and drop Apr 8, 2022
@mirek-fidler
Copy link
Contributor

mirek-fidler commented Apr 11, 2022 via email

@kov-serg
Copy link
Author

kov-serg commented Apr 12, 2022

Did you check result?

pic-02
pic-03

From wordpad text inserted without problem using drag and drop. But in reverse direction it paste trash. And from textedit itself paste trash. Problem is in inserting data into clip buffer. It insets it in utf8.

ps: I found. This line

return String(h.begin(), sizeof(char16) * h.GetCount());

should looks like this:

return String((char*)h.begin(), sizeof(char16) * h.GetCount());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants