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

Can't write #145

Open
illegal-instruction-co opened this issue Oct 8, 2022 · 2 comments
Open

Can't write #145

illegal-instruction-co opened this issue Oct 8, 2022 · 2 comments

Comments

@illegal-instruction-co
Copy link

I can't write to editor. But its detecting when i am click it.
Also somehow, "Built-in function" text walking arround with my mouse always.

@petervdpas
Copy link

{
    std::ifstream t(fileToEdit);
    if (t.good()) {
        std::string str((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
        editor.SetText(str);
    }
}

Should be outside update loop. I had that, but this fixed it!

@xastrix
Copy link

xastrix commented Dec 25, 2023

just use std::call_once

#include <mutex>

std::once_flag                               m_set_text_flag = {};
std::string                                     your_text = "123";

TextEditor m_code_editor;

static void TextEditorUpdate(std::string data)
{
	m_code_editor.SetText(data);
}

std::call_once(m_set_text_flag, TextEditorUpdate, your_text);

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

3 participants