Skip to content

Add to recent file history only if file is removed from all the views#2665

Closed
SinghRajenM wants to merge 1 commit intonotepad-plus-plus:masterfrom
SinghRajenM:recentFiles
Closed

Add to recent file history only if file is removed from all the views#2665
SinghRajenM wants to merge 1 commit intonotepad-plus-plus:masterfrom
SinghRajenM:recentFiles

Conversation

@SinghRajenM
Copy link
Copy Markdown
Contributor

Fixed issue: #2277
There might be cases when file is cloned/moved to view. Don't add to recent list unless file is removed from all the views.

// Add to recent file history only if file is removed from all the views
// There might be cases when file is cloned/moved to view.
// Don't add to recent list unless file is removed from all the views
generic_string fileFullPath(TEXT(""));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The declaration of variable should be more near as possible to the first usage of variable.

Copy link
Copy Markdown
Contributor Author

@SinghRajenM SinghRajenM Dec 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable is declared here because full file path is copied into it in the next if block.
So one way to do so is moving the complete if block just before closing the file [step: bool isBufRemoved = removeBufferFromView(id, whichOne);], because after it we may not get file name as buffer will be removed from view. But still it will be far from the actual use of variable.

Intentionally, I didn't do as code review become easier. Let me know if it is ok to move the complete if block.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I didn't see it's used in another block. In this case, you're right.
OTOH, you don't need to do generic_string fileFullPath(TEXT(""));
generic_string fileFullPath; will create an empty string.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! used generic_string fileFullPath;


if (PathFileExists(buf->getFullPathName()))
_lastRecentFileList.add(buf->getFullPathName());
fileFullPath += buf->getFullPathName();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather fileFullPath = buf->getFullPathName(); IMO

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be not be an issue as variable is declared with empty string. Let me know if it really needs to be changed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, but it's rather a sementic issue:
+= is a concatanate operation, that's make us think there's already a string in it and we want to keep it.
So yes, please change it to make the intention more clear.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@Yaron10
Copy link
Copy Markdown

Yaron10 commented Dec 11, 2016

Hello @SinghRajenM,

Great work. 👍
Shorter and better than my suggestion. :)

Thank you very much. I do appreciate it.


Hello @donho,

Thank you for reviewing and accepting it.

Best regards.

	There might be cases when file is cloned/moved to view. Don't add to recent list unless file is removed from all the views
@donho donho self-assigned this Dec 11, 2016
@donho donho added the accepted label Dec 11, 2016
@donho donho added this to the 7.x (master) milestone Dec 11, 2016
@donho donho closed this in 746c3da Dec 24, 2016
@SinghRajenM SinghRajenM deleted the recentFiles branch December 29, 2016 19:38
SinghRajenM added a commit to SinghRajenM/notepad-plus-plus that referenced this pull request Jan 30, 2017
* Simplify determination of URL at click location

Closes notepad-plus-plus#1248, Closes notepad-plus-plus#1255, Closes notepad-plus-plus#1595, Closes notepad-plus-plus#1762, Closes notepad-plus-plus#1768, Closes notepad-plus-plus#2583

* Get back Find dialog while you lost it

In the environment of multi-monitor with a laptop + a stantion, it
happens all the time that users have lost Find dialog after detaching
and retatching - the solution: Ctrl-F twice will get back your Find
dialog.

* Add to recent file history only if file is removed from all the views

There might be cases when file is cloned/moved to view. Don't add to recent list unless file is removed from all the views
Closes notepad-plus-plus#2665, Fixes notepad-plus-plus#2277

* Fix the problem of launch Notepad++ with Admin right after installation.

Launch N++ with same privileges as explorer
FIxes notepad-plus-plus#2641, fixes notepad-plus-plus#159, fixes notepad-plus-plus#556, closes notepad-plus-plus#2643

* Add MD5 functionalities

* Notepad++ v7.3 release

* Fix "Don't check at launch time" not working problem

Preferences... -> Recent Files History -> Don't check at launch time
does not work anymore. If it is unchecked, it will be checked again on
next Notepad++ launch time.
Fixes notepad-plus-plus#2746

* Fix geneation of MD5 on Unicode bug

"Geneate MD5 fom text dialog" has geneated wrong result on non ANSI
character (Unicode text).  This bug is due to wong input data.

Fixes notepad-plus-plus#2743

* Add some functions for future use

* Fix the shadow declarations & make VS2015 compile again

* Fix VS 2015 post build error

* Enhancement of  "Word characters list"

While double-clicking to select or searching with "Match whole word
only" option, the selected characters stop on non-word characters. With
this enhancement, users can include any non-word character into word
characters list, to change its default behaviour.

* Update 3 translations

* Fix an issue due to VS2015 compiling result (bug)

* Add new language Breton

* Update chineseSimplified.xml

Closes notepad-plus-plus#2748

* Add some missing AutoIt keywords

Closes notepad-plus-plus#2728

* Update german.xml to 7.3.1

Including the suggestion notepad-plus-plus#2737 from notepad-plus-plus#2737

Closes notepad-plus-plus#2741

* Update bulgarian.xml

Closes notepad-plus-plus#2751

* Improve Folder Browse And Save Dialog

Enable the new user interface for "Folder Browse Dialog" including the
edit box and enable Vista style for "Save Dialog".

Closes notepad-plus-plus#2631

* Fix warning display for Word char list bug

* Notepad++ v7.3.1 release

* Add Plugins Administrator (UI part, in progress)

* Make VS2015 compile again

* update japanese.xml to v7.3.1

Closes notepad-plus-plus#2697

* Update ukrainian.xml to v7.3.1

Closes notepad-plus-plus#2787

* Update italian to v7.3.1

Update italian translation according to version 7.3.1 (MD5 tool &
Customization of Word char set)

Closes notepad-plus-plus#2745

* Hungarian translation update for 7.3.1

Closes notepad-plus-plus#2742

* Language VHDL updated

Reserved keyword from IEEE 1076-2008 LRM §15.10
Closes notepad-plus-plus#2659

* Update danish.xml to 7.3.1

Closes notepad-plus-plus#2810

* Enable Scintilla Lexer SCLEX_BAAN (BaanC Language)

Closes notepad-plus-plus#2696

* Fix the regression in settings

Closes notepad-plus-plus#2814

* FunctionList Update 2

* Implemented XML Schema for functionList.xml.
* functionList.xml:
1. new layout of association map;
2. placed `displayName` before `id` attribute where applicable;
3. utilize inline comments;
4. parsers added: 'XML for FunctionList', Assembly, AutoIt3, InnoSetup, PowerShell, KRL, Sinumerik and UniVerse BASIC;
5. parsers improved: C, Java, Batch, Bash, XML and NSIS;
6. replaced `[\t\x20]` with `\h` where possible;
7. using upper case notation for hexadecimal values e.g. `\x7F-\xFF`;

Closes notepad-plus-plus#2602

* Go to correct position after word completion

Closes notepad-plus-plus#2675, Closes notepad-plus-plus#2802
SinghRajenM added a commit to SinghRajenM/notepad-plus-plus that referenced this pull request Jan 30, 2017
* Simplify determination of URL at click location

Closes notepad-plus-plus#1248, Closes notepad-plus-plus#1255, Closes notepad-plus-plus#1595, Closes notepad-plus-plus#1762, Closes notepad-plus-plus#1768, Closes notepad-plus-plus#2583

* Get back Find dialog while you lost it

In the environment of multi-monitor with a laptop + a stantion, it
happens all the time that users have lost Find dialog after detaching
and retatching - the solution: Ctrl-F twice will get back your Find
dialog.

* Add to recent file history only if file is removed from all the views

There might be cases when file is cloned/moved to view. Don't add to recent list unless file is removed from all the views
Closes notepad-plus-plus#2665, Fixes notepad-plus-plus#2277

* Fix the problem of launch Notepad++ with Admin right after installation.

Launch N++ with same privileges as explorer
FIxes notepad-plus-plus#2641, fixes notepad-plus-plus#159, fixes notepad-plus-plus#556, closes notepad-plus-plus#2643

* Add MD5 functionalities

* Notepad++ v7.3 release

* Fix "Don't check at launch time" not working problem

Preferences... -> Recent Files History -> Don't check at launch time
does not work anymore. If it is unchecked, it will be checked again on
next Notepad++ launch time.
Fixes notepad-plus-plus#2746

* Fix geneation of MD5 on Unicode bug

"Geneate MD5 fom text dialog" has geneated wrong result on non ANSI
character (Unicode text).  This bug is due to wong input data.

Fixes notepad-plus-plus#2743

* Add some functions for future use

* Fix the shadow declarations & make VS2015 compile again

* Fix VS 2015 post build error

* Enhancement of  "Word characters list"

While double-clicking to select or searching with "Match whole word
only" option, the selected characters stop on non-word characters. With
this enhancement, users can include any non-word character into word
characters list, to change its default behaviour.

* Update 3 translations

* Fix an issue due to VS2015 compiling result (bug)

* Add new language Breton

* Update chineseSimplified.xml

Closes notepad-plus-plus#2748

* Add some missing AutoIt keywords

Closes notepad-plus-plus#2728

* Update german.xml to 7.3.1

Including the suggestion notepad-plus-plus#2737 from notepad-plus-plus#2737

Closes notepad-plus-plus#2741

* Update bulgarian.xml

Closes notepad-plus-plus#2751

* Improve Folder Browse And Save Dialog

Enable the new user interface for "Folder Browse Dialog" including the
edit box and enable Vista style for "Save Dialog".

Closes notepad-plus-plus#2631

* Fix warning display for Word char list bug

* Notepad++ v7.3.1 release

* Add Plugins Administrator (UI part, in progress)

* Make VS2015 compile again

* update japanese.xml to v7.3.1

Closes notepad-plus-plus#2697

* Update ukrainian.xml to v7.3.1

Closes notepad-plus-plus#2787

* Update italian to v7.3.1

Update italian translation according to version 7.3.1 (MD5 tool &
Customization of Word char set)

Closes notepad-plus-plus#2745

* Hungarian translation update for 7.3.1

Closes notepad-plus-plus#2742

* Language VHDL updated

Reserved keyword from IEEE 1076-2008 LRM §15.10
Closes notepad-plus-plus#2659

* Update danish.xml to 7.3.1

Closes notepad-plus-plus#2810

* Enable Scintilla Lexer SCLEX_BAAN (BaanC Language)

Closes notepad-plus-plus#2696

* Fix the regression in settings

Closes notepad-plus-plus#2814

* FunctionList Update 2

* Implemented XML Schema for functionList.xml.
* functionList.xml:
1. new layout of association map;
2. placed `displayName` before `id` attribute where applicable;
3. utilize inline comments;
4. parsers added: 'XML for FunctionList', Assembly, AutoIt3, InnoSetup, PowerShell, KRL, Sinumerik and UniVerse BASIC;
5. parsers improved: C, Java, Batch, Bash, XML and NSIS;
6. replaced `[\t\x20]` with `\h` where possible;
7. using upper case notation for hexadecimal values e.g. `\x7F-\xFF`;

Closes notepad-plus-plus#2602

* Go to correct position after word completion

Closes notepad-plus-plus#2675, Closes notepad-plus-plus#2802
iczelia pushed a commit to iczelia/notepad-plus-plus that referenced this pull request Jan 17, 2021
There might be cases when file is cloned/moved to view. Don't add to recent list unless file is removed from all the views
Closes notepad-plus-plus#2665, Fixes notepad-plus-plus#2277
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants