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

NPP jumps from "New 1" to "New 3" if "Find Results" is displayed #8677

Closed
Yaron10 opened this issue Aug 7, 2020 · 12 comments
Closed

NPP jumps from "New 1" to "New 3" if "Find Results" is displayed #8677

Yaron10 opened this issue Aug 7, 2020 · 12 comments
Assignees

Comments

@Yaron10
Copy link

Yaron10 commented Aug 7, 2020

STR:
Open NPP (for simplifying the case: no session, New 1 is open).
Open the Find dialog and press Find All in Current Document.
-- The Find Results window is displayed.
Open a new file.

Result:
New 3 is opened instead of New 2.

(The same happens if you open Python Script console).

Apparently a minor issue, but #8461 might be related.


Notepad++ v7.8.9 (32-bit)
Build time : Aug 1 2020 - 16:33:01
Path : C:---\notepad++.exe
Admin mode : ON
Local Conf mode : ON
OS Name : Windows 7 Enterprise (32-bit)
OS Build : 7601.23964
Current ANSI codepage : 1255
Plugins : ComparePlus.dll HTMLTag_unicode.dll MenuIcons.dll PythonScript.dll _CustomizeToolbar.dll

@sasumner
Copy link
Contributor

sasumner commented Aug 7, 2020

@Yaron10 Haha, you are trying to refocus our attention on 8461. :-)

I don't know if user's have a right to complain about this one.
N++ developers can name temporary files anything they want. :-)

But yes, point taken. This has (somewhat) bothered me as a user from day # 1 of my N++ usage.

@Yaron10
Copy link
Author

Yaron10 commented Aug 7, 2020

Haha, you are trying to refocus our attention on 8461.

To a certain degree. :)

I don't know if user's have a right to complain about this one.
N++ developers can name temporary files anything they want. :-)

That's correct. I have opened the issue because of the possible relation to #8461.

But yes, point taken. This has (somewhat) bothered me as a user from day # 1 of my N++ usage.

I've encountered the apparently random numbers many times before. But, again, Find Results and #8461...

@Esco441-91
Copy link

Hello,

I checked upon this issue because I wanted to learn contributing to open source (this could be my first contribution! :) ). I found the reason for the bug and fixed it. Just as @Yaron10 mentioned, It relates to addressing the Find Results -window as an "unnamed document" and is then checked from list of buffers that such exists. This results to having +1 unnamed documents.

I actually missed the part in "How to contribute" where it says I should be assigned this issue before working on it, but oh well :) As I am new to open source and contributing to NPP, could someone let me know if I can create a PR on the issue? Thanks :)

@sasumner
Copy link
Contributor

@Esco441-91
You (or anyone) can attempt a PR for it. "Assigning" to non-team members is problematic as it is unknown if there will be follow-through on it.

@Yaron10
Copy link
Author

Yaron10 commented Aug 12, 2020

@Esco441-91,

Looking forward to your PR. 👍

@Esco441-91
Copy link

@Yaron10,

Now you're making me nervous for the expectation :D

I'll make the PR tomorrow when I get back to my work computer.

@Yaron10
Copy link
Author

Yaron10 commented Aug 12, 2020

@Esco441-91,

We'll treat you and your PR with the utmost respect. :)

@Esco441-91
Copy link

I now created the PR. Let's see how it'll turn up :)

@Esco441-91
Copy link

Here's an update on my findings, if anyone else wants to try. I'm not sure if I have the terminlogy correct, but when I say window, I mean anything user can see that he can type into or interact with.

The reason why this occurs is because other windowss, like Find Results and Python Console are treated and initialized just like any other document. Upon initialization, all document buffers, hidden windows and those mentioned above are marked as unnamed (DOC_UNNAMED). Whereas named documents are renamed after creation or changed, hidden, unnamed documents and other windows are not. Hidden windows are fine because their usage is different.

I was able to create a new way to distinguish Find Results (because it's all inside NPP source) from the other document buffers, but I didn't find a way to do distinction to buffers initialized by plugins. Worse, it seemed impossible to me to dinstinquish, whether the plugin opens an actual document or an utility window like the Python Console. Though impossible to me might be trivial to someone else :)

I think one way to fix this, while keeping backwards compatibility with plugins, would be to make a better distinction on what is a user document and what is not. But if I am correct, it can't be done without marking user documents as something else, because plugin windows and others cannot be marked as anything else without changing their sources. This means that whenever we want to open an actual user document, that would have to be marked as something else. But concidering it can happen from atleast opening a new session, loading an old session or just opening a new document, I don't think I can find the right functions to do this in.

@Yaron10
Copy link
Author

Yaron10 commented Aug 14, 2020

@Esco441-91,

Thank you for further investigating it and updating. I think it'll be helpful.

@bzaugt
Copy link

bzaugt commented Jun 10, 2022

Same 'problem' occurs with Document Map (View -> Document Map)
Version info:

  • Notepad++ v7.9.5 (32-bit)
  • Build time : Mar 21 2021 - 02:09:07
  • OS Name : Windows 10 Enterprise (64-bit)
  • OS Version : 2009
  • OS Build : 19044.1706
  • Plugins : ComparePlugin.dll mimeTools.dll NppConverter.dll NppEditorConfig.dll NppExport.dll NppFTP.dll NPPJSONViewer.dll XMLTools.dll

@donho
Copy link
Member

donho commented Aug 2, 2023

891e8f9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants