mackron / dred

A fast, lightweight text editor.

Home Page:http://dred.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: quick replace-all with Ctrl + H

opened this issue · comments

It's a standard feature in all other text editors, when you press Ctrl + H with a highlighted text it opens a replace window with it filled in a replace field already to save time on typing.

For dred it can mean if I hit Ctrl + H it'll populate replace-all's first argument with the text in highlight.

Same for Ctrl + F, btw...

Thanks. This should be a simple change so I'll get that done sooner than later. All of the find and replace functionality needs a lot of work...

I've gone ahead and pushed a fix for this to the master branch. You'll need to update your bindings by executing the following commands via the command bar.

bind find.find ctrl+f cmdbar-find-prefilled
bind find.replace ctrl+h cmdbar-replace-all-prefilled

Let me know if you have any issues.

Thanks for this suggestion!

For Ctrl + F: Thanks :) But for multiple words the quotes like on the last screenshot below are needed! Otherwise it starts searching just for the first word only.

For Ctrl + H: By default, a word or multiple words I want to replace are highlighted right now, but in other text editors when I press Ctrl + H I expect to just start typing text I want to replace with, so instead of:

1

I expect this:

3

Yep, I'm an idiot for not realising that would be an issue! I've gone ahead and fixed that up, but there's a slight difference to your "replace-all" suggestion. I've decided to keep it so that the first argument will be selected by default (as opposed to your suggestion of putting focus on the second argument). The rationale for this is to keep it consistent with other text editors - this is how it works in every text editor I have on hand.

However! I've added a new feature to the command bar to make things easier - you can cycle through arguments with the tab key. So in the case of Ctrl+H, all you need to do is hit Tab and it'll put you straight into the second argument. (Note that pressing Shift+Tab to go the previous argument doesn't work at the moment due to a deeper issue with the way accelerators work.)

Hopefully that works a bit better for you. Enjoy!