Giter VIP home page Giter VIP logo

Comments (1)

dinusv avatar dinusv commented on May 16, 2024

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

from livekeys.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.