-
Notifications
You must be signed in to change notification settings - Fork 304
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 should not care about whether it recognizes an extension #467
Comments
How dare you do this! |
I'm not sure i understand the reproduction steps. I did this:
Komodo opened it as a text file and allowed me to find and replace. I would suggest a 4th option though: If Komodo is opening a file and is not sure whether its binary or not warn the user "This may be a binary file and editing it as text can damage your file, are you sure you want to open this file?", if they say yes just open the file and treat it as text, no further warnings. Could combine that with option 3 ("yes, and add file assoctiation for .bla"). |
You probably have a file association set for no file extension? Not sure. Just create a file that Komodo can't identify. Using ".blah" would work.
There is no file opening involved. This is the find and replace in files so it does a "blind" replace of all the files in a directory. It doesn't open the file. Unless by "opening" you just mean the path being displayed in the Confirm Replacement dialog? |
Ooooh ok, I thought you were talking about the in-file replace dialog. Yeah definitely like ideas 2 and 3, I would take it a step further though and group all of these results together so someone can take an action on multiple files of type X. Maybe that's what you meant already. |
Nice, yes this would be a great addition. |
I really hate this issue. I'd really like to see it fixed. |
Because this was driving me so much crazy I looked at it again and I found a really simple fix: Index: C:\Users\cgcho\Projects\komodo\KomodoIDE\src\find\findlib2.py
index 136e6f6..a72c310 100644
--- a/src/find/findlib2.py
+++ b/src/find/findlib2.py
@@ -292,7 +292,7 @@ def replace(regex, repl, paths,
"""
journal = None
- grepper = grep(regex, paths, skip_unknown_lang_paths=True,
+ grepper = grep(regex, paths, skip_unknown_lang_paths=False,
skip_filesizes_larger_than=skip_filesizes_larger_than,
first_on_line=first_on_line,
includes=includes, excludes=excludes, Thoughts? |
If we do this then we need to make absolutely sure that the files this code are ran on are textual and not binary files. Before it could use the extension for this, if we remove this then this might become a problem. Regardless this should stay on 11.1, we do not fully understand the implications and so should not put it in a maintenance release. |
There is a review feature. Is it really up to us to cover for the user who chooses not to review the changes that they are making? We could make the review mandatory I guess. |
Or we could do the original suggestion of fixing how the dialog handles "unknown" files and allows the user to still select them. Either way, i keep hitting this and I'd really really like it to be fixed, not before 11.1 but not later either. |
I don't want users to have to review whether a file is binary or not, that would be silly. |
A reasonable binary file test is to check the first 64KB for a '\0' byte (nul byte). If there are no '\0' bytes in the first 64KB, you can reasonably assume it is a text file. |
I have two recommended changes and I think both should be be implemented (don't worry, one is easy)
I actually found a reference to this from Komodo 4 where a user was asking for suggestion 2.
Dev note:
We need to ensure that find/replace checks for binary vs textual files.
The text was updated successfully, but these errors were encountered: