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

How to do search selection without actually selecting text for editing? #31

Closed
vadi2 opened this issue Jun 24, 2017 · 5 comments
Closed

Comments

@vadi2
Copy link
Contributor

vadi2 commented Jun 24, 2017

Sublime allows selecting, or highlighting searched text of sorts without the text actually being selected for editing when you use the 'search in all open files' option. Is this possible in edbee?

@gamecreature
Copy link
Member

Do you mean this kind of selection (Which isn't the true selection?)

schermafbeelding 2017-06-24 om 13 56 42

@gamecreature
Copy link
Member

gamecreature commented Jun 24, 2017

At the moment edbee only renders the current selection ...

You can control the complete rendering yourself, by subclassing the TextEditorRenderer class and make edbee use the new[renderer via:

widget->textEditorComponent()->giveTextEditorRenderer( .. )

Maybe I should build in support for custom non-selected regions (painting extra regions with borders like sublime does). By adding an extra TextRangeSet that can be set.

btw. To find textranges in edbee editor, you can use the TextSearcher class, which supports regexp searching and multiple selections.

gamecreature added a commit that referenced this issue Jun 25, 2017
@gamecreature
Copy link
Member

I've just implemented TextEditorController::borderedTextRanges...
Just add ranges here and you will see the same kind of non-selected ranges in the editor widget..
Edbee-App has been updated to, so it marks the current search wordt. (Liver while editing the search term)

Example for the FindWidget in the edbee app:

void FindWidget::textChanged(const QString &text)
{
    edbee::TextEditorController* controller = editorRef_->controller();
    edbee::TextSearcher* searcher = controller->textSearcher();
    searcher->setSearchTerm(text);
    searcher->markAll(controller->borderedTextRanges());
    controller->update();
}

@gamecreature
Copy link
Member

This is a quick solution for, rendering special areas.
Perhaps for the future I need to support multiple ranges like these, with for example different rendering strategies..

@vadi2
Copy link
Contributor Author

vadi2 commented Jun 25, 2017

Perfect! Thanks so much :)

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