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

Option to find&replace in selection #1618

Closed
mdro opened this issue Nov 18, 2018 · 15 comments
Closed

Option to find&replace in selection #1618

mdro opened this issue Nov 18, 2018 · 15 comments
Assignees
Labels
enhancement Feature requests.

Comments

@mdro
Copy link

mdro commented Nov 18, 2018

Describe the new feature

I previously mentioned in #1612 that Visual Studio has a usefull feature for find&replace:
If you have more than one line highlighted when you open the replace menu, "replace all" will be limited to that part.

This is usefull for example when you want to add a CREATE TABLE statement (with separate PRIMARY KEY or FOREIGN KEY clauses) that is very similar to a different one in the same file: Ctrl+C, Ctrl+V, Highlight, Ctrl+H, change field names:

vsreplace

Visual Studio also prepopulates the search box (for search and find&replace) with selections smaller than a line or the word under the cursor. This feature would be less important to me.

Both features can be turned off in the settings menu of Visual Studio.

@justinclift justinclift added the enhancement Feature requests. label Nov 18, 2018
@SilvioGrosso
Copy link

SilvioGrosso commented Nov 18, 2018

I second that.
This feature would be extremely useful while working in the Execute SQL tab whenever you want to replace some SQL parts. With very long SQL scripts it might allow you to replace only the selected part of the code you are interested in.

Pretty much every text editor allows you to do so. Usually, there is check-box to tick to enable it :-)

@mgrojo mgrojo self-assigned this Nov 18, 2018
@chrisjlocke
Copy link
Member

The feature I thought I'd use a lot in Visual Studio is the multiple carats, so you can edit multiple places at once. So in your example, rather than search/replace 'foo_id' with 'bar_id', you simply multiple-click on each 'foo' (to create multiple carats) then delete 'foo' and type 'bar' - all are edited. However, in practice, I've not used it at all yet! 🤣

mgrojo added a commit that referenced this issue Nov 23, 2018
New check box in the Find and Replace dialog for Scintilla editors. The
new option uses the feature in QScintilla for finding text in the
selection only.

The implementation has been changed to use findFirst(InSelection) and
findNext so it works exactly as designed by QScintilla. Consequently the
finding process has to be cancel whenever any of the parameters have
changed.
@mgrojo
Copy link
Member

mgrojo commented Nov 23, 2018

Another new feature ready for testing. I hope everything is working OK.

@SilvioGrosso
Copy link

Hello @mgrojo

Thanks a lot for your last awesome effort!
I have also noticed that this option (find > replace) is case-insensitive, which is an extra-bonus for me.
Keeps rocking :-)

I have tested this new option on Windows 10 - 64 bit, with DB.Browser.for.SQLite-win64.

Here is my screenshot where I have selected my text and then replaced the word mary with LUCY (just for testing purposes):

selection_only

@justinclift
Copy link
Member

@SilvioGrosso Out of curiosity, is that using a Windows nightly build from today?

Asking for an unrelated thing - I just upgraded the Qt version used for the Windows builds - so um... keep an eye out of any extra weirdness too. Just in case. 😄

@SilvioGrosso
Copy link

Hello @justinclift

I have dowloaded this build (3.11.99) this morning, an hour ago.
Judging by your latest github commits, I suppose it is after you Added Win64 nightly build script.

Here is my screenshot on Windows 10 (64 bit) though:

db_today

@justinclift
Copy link
Member

Excellent, thanks heaps @SilvioGrosso. 😄

@SilvioGrosso
Copy link

Hello @chrisjlocke @mgrojo

In appreciation of your hard work on Db Browser for SQLite I have just increased my monthly payment on Patreon.
By doing so, it is for instance now possible to purchase the basic certificate for signing the builds on Windows (since the total sponsorship is now > 75$).

@justinclift
Copy link
Member

Fantastic @SilvioGrosso. That's good timing, as the next release shouldn't be too far off now. 😄

@SilvioGrosso
Copy link

SilvioGrosso commented Nov 24, 2018 via email

@mgrojo
Copy link
Member

mgrojo commented Nov 24, 2018

Thanks a lot, @SilvioGrosso!

By the way, curious location of the Help button in Windows. In Linux is at the left aligned relatively to the window, and Close right aligned. If at least the buttons were in different positions, with Close at the right end, it would look better. That's funny because the Help button under Windows wouldn't be necessary, since I see there is a [?] window button. The Help button enters also in What's This mode and I added it because in Linux there is no such thing as a [?] window button.

@SilvioGrosso
Copy link

Hello @mgrojo

This ? window button is indeed quite interesting :-)
Its own tooltip is another ?

When you press this button no action is triggered but, alongside the mouse's cursor, another ? appears.
Later on, whenever you click somewhere on the GUIs new tooltips show up to illustrate the part where your mouse in positioned.

For example, I have just clicked on this part of the GUI:

tooltip png

@mdro
Copy link
Author

mdro commented Nov 24, 2018

Works perfectly.
Thanks for the great work @mgrojo !

@mgrojo
Copy link
Member

mgrojo commented Nov 24, 2018

@SilvioGrosso

When you press this button no action is triggered but, alongside the mouse's cursor, another ? appears.
Later on, whenever you click somewhere on the GUIs new tooltips show up to illustrate the part where your mouse in positioned.

Yes, that's exactly it's use. It's the so called What's This? feature. You can also access it from the Help menu in the main window or almost everywhere pressing Shift+F1. We have included some helpful messages in some of them. Other are plain boring. If we don't use it more it's because we think they are usually overlooked by users 😄

I have code for adding all the editor shortcuts to the "Execute SQL" message, because it currently lacks one and QScintilla provides a list of them with short descriptions. The problem is that the text is then too large and these floating tips are not thought for so much content (the text is truncated at least on my computer). I've finally added the generated list to the wiki page: https://github.com/sqlitebrowser/sqlitebrowser/wiki/Keyboard-shortcuts#sql-json-and-xml-editors but I'm still thinking on how to add them to the application. Most are widely known, but there are also less known/standard shortcuts that are also useful.

@mgrojo
Copy link
Member

mgrojo commented Aug 10, 2019

Closing this as it was already confirmed.

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

No branches or pull requests

5 participants