Skip to content

[Edit Database Cell] Enable simple text search/replace within cell content. #1746

Open

Description

@sky5walk

Describe the new feature

When I store documents as blobs to a table and then browse the cells in the "Edit Database Cell" view, it would be very helpful for a context menu to enable simple text search/replace.
Now I must copy and paste the cell into notepad or similar for simple searches and edits.

Additional info

Is your feature request related to an issue? Please include the issue number.

No.

Does this feature exist in another product or project? Please provide a link.

Of course, but not sure of all db browsers. Basic context menus for text searches are so innate I was surprised by its omission.

Activity

  1. mgrojo commented on Feb 14, 2019

    @mgrojo
    Member

    As a workaround, you could switch to the XML or JSON mode, which have replace dialogs (Ctrl+H or context menu). It will give you incorrect syntax highlighting and inconvenient syntax validations, but it might be easier than your current trick with the external editor.

    It might make sense to get rid of the plain Qt text widget and give a text mode in the QScintilla widget, because it is cumbersome having to implement the features for both. But some users would prefer the plain widget for text, due to look&feel or simplicity reasons. Any opinions?

    Another possible feature that would streamline your approach is support for external editors of cell data. The data would be saved to temporary file (using the internal export logic) and open in the default application for that data. We would have to monitor that process and when it ends, we load the temporary file. The main concern is implementing this in a portable way. QDesktopServices::openUrl could be used for the opening part, and QProcess::start for process launch and monitoring, but in principle there's no way to link both.

  2. sky5walk commented on Feb 14, 2019

    @sky5walk
    Author

    Whoa 😮 I did not know Search/Replace was already available in XML/JSON?
    That is a great workaround.
    Why not enable the same feature for text mode?
    As a scintilla gadget, I love the line numbers and it would be great to add custom syntax highlighting contained within the project file?

    I am less inclined to choose an external editor. These are for minimal changes and scanning. Any more detail would be handled in the native source editor along with its customized syntax.

  3. mgrojo commented on Feb 14, 2019

    @mgrojo
    Member

    Why not enable the same feature for text mode?

    The current text widget is the standard text widget in the Qt library we use for the GUI and for portability. It has different programming interfaces than the QScintilla widget that we use for SQL, JSON and XML. Adding the feature for the current standard text widget would mean to program an adaptation layer or make a different new implementation of the dialog. It's possible but it requires some effort. That's why I propose to use QScintilla also for the plain text mode.

    As a scintilla gadget, I love the line numbers and it would be great to add custom syntax highlighting contained within the project file?

    Scintilla comes with syntax highlighting for a lot of languages, but the supporting code has to be built into the application, so we've only added in the application what we are using (JSON and XML, which we consider usual data formats). So we are currently constrained to that. Do you use other data formats that QScintilla supports? You can see a list of supported languages (lexers) here.

  4. sky5walk commented on Feb 15, 2019

    @sky5walk
    Author

    Yeah, I guessed it would be hardcoded to the gadget. Still, it has plenty of built-in lexers.
    I would love to see my blob cells syntax highlighted: CSS, SQL, batch, html, markdown, even SPICE!

    My vote is use the Scintilla gadget and drop the simple text gadget.
    You already have binary view to show unaltered content, albeit in hex view.

  5. mgrojo commented on Mar 8, 2019

    @mgrojo
    Member

    @MKleusberg @chrisjlocke @justinclift Do you agree on getting rid of the standard Qt widget for the Edit Database Cell in the text mode and using the QScintilla widget in a plain text mode? This will solve this issue (find/replace dialog) and hopefully #1793 too.

    Another question is whether we add also other syntax highlighting modes. It would require including the necessary code to the application from the QScintilla library. Currently we are only adding the minimal set of files that we need (that only occurs using the internal QScintilla version, I suppose).

  6. self-assigned this
    on Mar 9, 2019
  7. mgrojo commented on Mar 10, 2019

    @mgrojo
    Member

    It seems that we don't loose any feature, so I've made the change and I think it is a clear gain. The text mode is now using the QScintilla widget too. The shortcut Ctrl+H can trigger now the Find/Replace dialog in this mode.

  8. sky5walk commented on Mar 10, 2019

    @sky5walk
    Author

    Yes, [Ctrl+H] functionality is good.
    Is it much more effort to add the standard editing keyboard shortcuts?
    [Ctrl+F] = Find
    [F3] = Find Next
    [Shift+F3] = Find Previous

  9. chrisjlocke commented on Mar 10, 2019

    @chrisjlocke
    Member

    It seems that we don't lose any feature, so I've made the change and I think it is a clear gain.

    Well done @mgrojo. I must admit I don't use the 'edit cell' function that much, but any improvement is obviously good. 👍

  10. justinclift commented on Mar 23, 2019

    @justinclift
    Member

    The shortcut Ctrl+H can trigger now the Find/Replace dialog in this mode.

    We should add this to the Keyboard shortcuts wiki page. 😄

    Is "Edit dialog and edit pane" the right section?

  11. mgrojo commented on Apr 5, 2019

    @mgrojo
    Member

    Is it much more effort to add the standard editing keyboard shortcuts?
    [Ctrl+F] = Find
    [F3] = Find Next
    [Shift+F3] = Find Previous

    I've added the Ctrl+F shortcut to the Scintilla widgets in order to open a modified version of the Find/Replace dialog, but just for searching.

    F3 is also bound to the Find Next button, inside the dialog, but Shift+F3 would require adding a Find Previous button and I don't want to overcrowd the dialog (there is already a "Search backwards" checkbox).

  12. added this to the 3.12.0 - Future release milestone on Apr 5, 2019
  13. sky5walk commented on Apr 7, 2019

    @sky5walk
    Author

    Confirmed feature with v190407. 👍
    [Shift+F3] would be desirable for large texts as this is an editor standard.
    Clicking '[x] Reverse Direction' is no fun when browsing large text in both directions.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions