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

Find / Replace improvements #300

Open
vertigo220 opened this issue Jan 20, 2025 · 4 comments
Open

Find / Replace improvements #300

vertigo220 opened this issue Jan 20, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@vertigo220
Copy link

  1. It should be possible to switch directly between Find and Replace, instead of having to close the Find dialog and go through the menu and select/open the Find and Replace one.
  2. Instead of "Replace next" it should just be "Replace" as the former makes it sound like it's going to replace the next occurrence, not the current one, just like "Find next" does.
  3. A "Count" button as well as an option to toggle whether or not to wrap-around (i.e. start over from the beginning vs stopping when reaching the end) would be useful.
  4. I find myself currently having to do several steps on multiple files that could be simplified. Several files contain multiple lines I want to remove, with a couple variations, so I have to load each one individually, go to Subtitle > Select Lines... and enter the contents of one of the lines I want to remove, hit OK, delete the lines, then go back and do it again with the contents of the other lines, then onto the next file, and the next. While I could probably use regex to at least select the lines with both contents simultaneously, that wouldn't always be the case, and it would be easier and more flexible if there was an and/or function. Second, it would make it faster if there was an option to delete the lines, instead of selecting them, then having to close the dialog and delete them as an additional step. Finally, and perhaps most importantly, it would really make things easier and faster if it could perform the action on a group of files at once. And to allow users to check the lines first, it could provide a means to preview them, whether dealing with one file or multiple, by providing an option to only show selected lines or lines that will be deleted, with separation between each file's lines so they could be quickly reviewed before taking action on them.
@witchymary
Copy link
Contributor

Most of your points in the 4th bullet sound a bit too out of scope, and would likely be better provided by automation scripts. At that point, you want something else entirely.

For the second bullet point, that makes sense, but ultimately Aegisub should be consistent with how other software do it. I'm unsure if that's currently the case or not.

@petzku
Copy link
Contributor

petzku commented Jan 20, 2025

Most of your points in the 4th bullet sound a bit too out of scope, and would likely be better provided by automation scripts

I agree. This kind of bulk modification is likely much better handled by a more dedicated text editor, especially if you want to do this across several files at once. This could be fairly easily done using a modern text editor such as VSCode (e.g. using search-replace), or with a small shell script.

As for the rest,

  1. It should be possible to switch directly between Find and Replace, instead of having to close the Find dialog and go through the menu and select/open the Find and Replace one.

Agreed. Notably, even a keybind to edit/find_replace doesn't function while the Find dialog is open.
(This is probably a wxwidgets limitation, to some extent...)

  1. Instead of "Replace next" it should just be "Replace" as the former makes it sound like it's going to replace the next occurrence, not the current one, just like "Find next" does.

Seems reasonable and aligns with the editing programs I checked.

  1. A "Count" button as well as an option to toggle whether or not to wrap-around (i.e. start over from the beginning vs stopping when reaching the end) would be useful.

I'm not sure I see the use for these. Not to dismiss the suggestion, but there is a way you can (sort of) do this counting already—using Find-Replace and clicking "Replace All" will give a pop-up detailing the number of replacements done.

That said, if a "Count" feature were to be added, it would be nice to give the number of matching lines as well (i.e. 34 matches on 28 lines)

@vertigo220
Copy link
Author

This kind of bulk modification is likely much better handled by a more dedicated text editor

I agree, and that was my first thought, but when I did it, I then had skipped line numbers, since while deleting lines in a subtitle editor adjusts all the other line numbers, a text editor doesn't. I don't know if this actually matters, but it doesn't seem ideal. It also requires a fair bit more effort since it's not just the lines containing the text, but the preceding lines (the line number, time codes, and first line of the sub if the text is on a non-first line), as well as possibly one or more lines after (if the there are additional lines after the text in the same "line"). Not that it can't be done, but would be a lot easier to do these subtitle edits in a subtitle editor, and therefore seems perfectly within scope, but that's your call.

I'm not sure I see the use for these.

I admit the count function would be less useful, but I do use it often enough in Notepad++ to assume it would have occasional use in any text editor, which this ultimately is. The wrap-around option serves two purposes: to make it clear that it is or is not doing this (I spent several seconds verifying that all occurrences were renamed since it wasn't clear whether, since I'd not started at the beginning, if it had wrapped around) and provides the option to NOT do it if the user wants to make sure previous occurrences (before the selected line) aren't affected.

Ultimately, since this is essentially a specialized text editor, but a text editor nonetheless, I was just taking what's useful in the primary one I use (N++) and applying it here.

@EL-File4138
Copy link
Contributor

I then had skipped line numbers, since while deleting lines in a subtitle editor adjusts all the other line numbers, a text editor doesn't.

You'll need a stronger parsing script, not just search and replace in the text editor. I recommend checking out some parsers of the subtitles you need to interact with.
From what you've stated, I assume it's a strong enough incentive for you to build your automation toolchain to suit your personal needs.

it would really make things easier and faster if it could perform the action on a group of files at once.

I don't think reinventing the workspace and multi-cursor concept would be beneficial for the project as a whole. Surely it would bring some productivity, but It's unsuited for the current workflow the application assumes.
Although I can't agree on the whole "specialized text editor" thing, even if it's your way of understanding the project, many lightweight text editors would not achieve the functionality you described here. Building a "Subtitling IDE" is way out of scope.

@arch1t3cht arch1t3cht added the enhancement New feature or request label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants