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

Add editor search/search & replace box. #24

Open
dinusv opened this issue Jul 21, 2016 · 1 comment
Open

Add editor search/search & replace box. #24

dinusv opened this issue Jul 21, 2016 · 1 comment

Comments

@dinusv
Copy link
Contributor

dinusv commented Jul 21, 2016

No description provided.

@dinusv dinusv added this to the Version 1.3.0 milestone Jul 21, 2016
@dinusv
Copy link
Contributor Author

dinusv commented Nov 8, 2018

There are 2 types:

  1. Search and replace within a document
  2. Search and replace within a project

1. Search and replace within a document

UI

  • Input Boxes: Search box, replace box
  • Buttons: Replace, Find & Replace, Replace All, Switch to Project Search

Approach

  • Create the UI in qml

  • Whenever a keypress happens, the "Find" action is triggered

  • When "Find" is triggered:

    • Create and use lveditor/DocumentHandler::findText to find the text for the document

      • If the search text is different than the previous search text:

        • Clear the previous highlighting model
        • Search the text and create the new model
        • Reghighlight the doucment with each of those sections
      • Return the next index

    • Place the cursor on the index of the next highlight

  • When "Replace" is triggered:

    • Create and uselveditor/DocumentHandler::replace to replace the cursor index of the document
  • When "Find & Replace" is triggered:

    • Create and use lveditor/ProjectDocument::replace to replace the cursor index of the document

    • Return the next index

    • Place the cursor on the index of the next highlight

  • When "Replace all" is triggered:

    • Create and use lveditor/ProjectDocument::replaceAll to replace all the instances

    • Clear all highlighting

2. Search and replace within a project

UI

  • Input Boxes: Search box, Replace Box
  • Buttons: Find, Replace All

Approach

  • Create the UI in qml

  • When "Find" is triggered:

    • Create and use lveditor/Project::findText to find the text in the project, a ListModel with the items
      is returned. The ListModel contains the path to the file, then the findings in the
      file, like line number, offset and fragment with the actual text

    • The model is displayed as a List of files and when collpsed, the findings are displayed

  • When "Replace all" is triggered:

    • Use lveditor/Project::replaceText to replace the text in the project

    • Clear the current model

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

No branches or pull requests

1 participant