You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/05/15 14:34:39 UTC
[GitHub] [netbeans] sdedic opened a new pull request #2139: NETBEANS-2082: do not scroll to caret after fold collapse, if caret i…
sdedic opened a new pull request #2139:
URL: https://github.com/apache/netbeans/pull/2139
…
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] ebarboni merged pull request #2139: NETBEANS-2082: do not scroll to caret after fold collapse, if caret is s off-screen.
Posted by GitBox <gi...@apache.org>.
ebarboni merged pull request #2139:
URL: https://github.com/apache/netbeans/pull/2139
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] eirikbakke commented on a change in pull request #2139: NETBEANS-2082: do not scroll to caret after fold collapse, if caret is s off-screen.
Posted by GitBox <gi...@apache.org>.
eirikbakke commented on a change in pull request #2139:
URL: https://github.com/apache/netbeans/pull/2139#discussion_r426121521
##########
File path: ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java
##########
@@ -289,7 +290,9 @@ public void foldHierarchyChanged(FoldHierarchyEvent evt) {
ViewUtils.log(CHANGE_LOG, "CHANGE in FoldViewFactory: <" + // NOI18N
startOffset + "," + endOffset + ">\n"); // NOI18N
}
- comp.putClientProperty("editorcaret.updateRetainsVisibleOnce", Boolean.TRUE);
+ if (collapsedAdded) {
Review comment:
The principle I like to follow is that the the code should be readable without doing a "git blame" on it, and ideally without reading the JIRA description either (though the comment can certainly be short).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] eirikbakke commented on a change in pull request #2139: NETBEANS-2082: do not scroll to caret after fold collapse, if caret is s off-screen.
Posted by GitBox <gi...@apache.org>.
eirikbakke commented on a change in pull request #2139:
URL: https://github.com/apache/netbeans/pull/2139#discussion_r426121376
##########
File path: ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java
##########
@@ -260,24 +260,25 @@ public void finishCreation() {
@Override
public void foldHierarchyChanged(FoldHierarchyEvent evt) {
- if (!collapsedFoldEncountered) {
- // Check if any collapsed fold was added or a collapsed/expanded state changed
- for (int i = evt.getAddedFoldCount() - 1; i >= 0; i--) {
- if (evt.getAddedFold(i).isCollapsed()) {
- collapsedFoldEncountered = true;
- break;
- }
+ boolean collapsedAdded = false;
+ boolean changedToCollapsed = false;
+ // Check if any collapsed fold was added or a collapsed/expanded state changed
+ for (int i = evt.getAddedFoldCount() - 1; i >= 0; i--) {
+ if (evt.getAddedFold(i).isCollapsed()) {
+ collapsedAdded = true;
+ break;
}
- if (!collapsedFoldEncountered) {
- for (int i = evt.getFoldStateChangeCount() - 1; i >= 0; i--) {
- FoldStateChange foldStateChange = evt.getFoldStateChange(i);
- if (foldStateChange.isCollapsedChanged() && foldStateChange.getFold().isCollapsed()) {
- collapsedFoldEncountered = true;
- break;
- }
+ }
+ if (!collapsedAdded) {
+ for (int i = evt.getFoldStateChangeCount() - 1; i >= 0; i--) {
+ FoldStateChange foldStateChange = evt.getFoldStateChange(i);
+ if (foldStateChange.isCollapsedChanged() && foldStateChange.getFold().isCollapsed()) {
+ changedToCollapsed = true;
Review comment:
Oh, I see, it's not just that there has been a change to a collapsed fold, but that it has been changed from not collapsed to collapsed. Your name makes sense now.
It's fine as it stands.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a change in pull request #2139: NETBEANS-2082: do not scroll to caret after fold collapse, if caret is s off-screen.
Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #2139:
URL: https://github.com/apache/netbeans/pull/2139#discussion_r426120437
##########
File path: ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java
##########
@@ -260,24 +260,25 @@ public void finishCreation() {
@Override
public void foldHierarchyChanged(FoldHierarchyEvent evt) {
- if (!collapsedFoldEncountered) {
- // Check if any collapsed fold was added or a collapsed/expanded state changed
- for (int i = evt.getAddedFoldCount() - 1; i >= 0; i--) {
- if (evt.getAddedFold(i).isCollapsed()) {
- collapsedFoldEncountered = true;
- break;
- }
+ boolean collapsedAdded = false;
+ boolean changedToCollapsed = false;
+ // Check if any collapsed fold was added or a collapsed/expanded state changed
+ for (int i = evt.getAddedFoldCount() - 1; i >= 0; i--) {
+ if (evt.getAddedFold(i).isCollapsed()) {
+ collapsedAdded = true;
+ break;
}
- if (!collapsedFoldEncountered) {
- for (int i = evt.getFoldStateChangeCount() - 1; i >= 0; i--) {
- FoldStateChange foldStateChange = evt.getFoldStateChange(i);
- if (foldStateChange.isCollapsedChanged() && foldStateChange.getFold().isCollapsed()) {
- collapsedFoldEncountered = true;
- break;
- }
+ }
+ if (!collapsedAdded) {
+ for (int i = evt.getFoldStateChangeCount() - 1; i >= 0; i--) {
+ FoldStateChange foldStateChange = evt.getFoldStateChange(i);
+ if (foldStateChange.isCollapsedChanged() && foldStateChange.getFold().isCollapsed()) {
+ changedToCollapsed = true;
Review comment:
strictly speaking, the folds have been already changed when this event is inspected :) Or is the extra 'd' some typo/grammar-like error ?
I like more to update the shared variable from a single assignment; does the suggestion bring some objective improvement, or is it rather a personal taste ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] eirikbakke commented on a change in pull request #2139: NETBEANS-2082: do not scroll to caret after fold collapse, if caret is s off-screen.
Posted by GitBox <gi...@apache.org>.
eirikbakke commented on a change in pull request #2139:
URL: https://github.com/apache/netbeans/pull/2139#discussion_r426062752
##########
File path: ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java
##########
@@ -260,24 +260,25 @@ public void finishCreation() {
@Override
public void foldHierarchyChanged(FoldHierarchyEvent evt) {
- if (!collapsedFoldEncountered) {
- // Check if any collapsed fold was added or a collapsed/expanded state changed
- for (int i = evt.getAddedFoldCount() - 1; i >= 0; i--) {
- if (evt.getAddedFold(i).isCollapsed()) {
- collapsedFoldEncountered = true;
- break;
- }
+ boolean collapsedAdded = false;
+ boolean changedToCollapsed = false;
+ // Check if any collapsed fold was added or a collapsed/expanded state changed
+ for (int i = evt.getAddedFoldCount() - 1; i >= 0; i--) {
+ if (evt.getAddedFold(i).isCollapsed()) {
+ collapsedAdded = true;
+ break;
}
- if (!collapsedFoldEncountered) {
- for (int i = evt.getFoldStateChangeCount() - 1; i >= 0; i--) {
- FoldStateChange foldStateChange = evt.getFoldStateChange(i);
- if (foldStateChange.isCollapsedChanged() && foldStateChange.getFold().isCollapsed()) {
- collapsedFoldEncountered = true;
- break;
- }
+ }
+ if (!collapsedAdded) {
+ for (int i = evt.getFoldStateChangeCount() - 1; i >= 0; i--) {
+ FoldStateChange foldStateChange = evt.getFoldStateChange(i);
+ if (foldStateChange.isCollapsedChanged() && foldStateChange.getFold().isCollapsed()) {
+ changedToCollapsed = true;
Review comment:
Should this variable perhaps be called "changeToCollapsed" rather than "changedToCollapsed"?
Also, why keep this variable at all--why not just do "collapsedFoldEncountered = true" instead?
##########
File path: ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java
##########
@@ -289,7 +290,9 @@ public void foldHierarchyChanged(FoldHierarchyEvent evt) {
ViewUtils.log(CHANGE_LOG, "CHANGE in FoldViewFactory: <" + // NOI18N
startOffset + "," + endOffset + ">\n"); // NOI18N
}
- comp.putClientProperty("editorcaret.updateRetainsVisibleOnce", Boolean.TRUE);
+ if (collapsedAdded) {
Review comment:
Would be good to add a comment here referencing the bug that is fixed by doing updateRetainsVisibleOnce only in the collapsedAdded case, and why this fixes the bug.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] junichi11 commented on pull request #2139: NETBEANS-2082: do not scroll to caret after fold collapse, if caret is s off-screen.
Posted by GitBox <gi...@apache.org>.
junichi11 commented on pull request #2139:
URL: https://github.com/apache/netbeans/pull/2139#issuecomment-630112912
@ebarboni It would be nice if we can merge this for 12.0.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a change in pull request #2139: NETBEANS-2082: do not scroll to caret after fold collapse, if caret is s off-screen.
Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #2139:
URL: https://github.com/apache/netbeans/pull/2139#discussion_r426120236
##########
File path: ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java
##########
@@ -289,7 +290,9 @@ public void foldHierarchyChanged(FoldHierarchyEvent evt) {
ViewUtils.log(CHANGE_LOG, "CHANGE in FoldViewFactory: <" + // NOI18N
startOffset + "," + endOffset + ">\n"); // NOI18N
}
- comp.putClientProperty("editorcaret.updateRetainsVisibleOnce", Boolean.TRUE);
+ if (collapsedAdded) {
Review comment:
Usually that's why the commit message references a JIRA issue; for more context. But will leave a short comment here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] [netbeans] sdedic commented on a change in pull request #2139: NETBEANS-2082: do not scroll to caret after fold collapse, if caret is s off-screen.
Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #2139:
URL: https://github.com/apache/netbeans/pull/2139#discussion_r426120437
##########
File path: ide/editor.fold.nbui/src/org/netbeans/modules/editor/fold/ui/FoldViewFactory.java
##########
@@ -260,24 +260,25 @@ public void finishCreation() {
@Override
public void foldHierarchyChanged(FoldHierarchyEvent evt) {
- if (!collapsedFoldEncountered) {
- // Check if any collapsed fold was added or a collapsed/expanded state changed
- for (int i = evt.getAddedFoldCount() - 1; i >= 0; i--) {
- if (evt.getAddedFold(i).isCollapsed()) {
- collapsedFoldEncountered = true;
- break;
- }
+ boolean collapsedAdded = false;
+ boolean changedToCollapsed = false;
+ // Check if any collapsed fold was added or a collapsed/expanded state changed
+ for (int i = evt.getAddedFoldCount() - 1; i >= 0; i--) {
+ if (evt.getAddedFold(i).isCollapsed()) {
+ collapsedAdded = true;
+ break;
}
- if (!collapsedFoldEncountered) {
- for (int i = evt.getFoldStateChangeCount() - 1; i >= 0; i--) {
- FoldStateChange foldStateChange = evt.getFoldStateChange(i);
- if (foldStateChange.isCollapsedChanged() && foldStateChange.getFold().isCollapsed()) {
- collapsedFoldEncountered = true;
- break;
- }
+ }
+ if (!collapsedAdded) {
+ for (int i = evt.getFoldStateChangeCount() - 1; i >= 0; i--) {
+ FoldStateChange foldStateChange = evt.getFoldStateChange(i);
+ if (foldStateChange.isCollapsedChanged() && foldStateChange.getFold().isCollapsed()) {
+ changedToCollapsed = true;
Review comment:
strictly speaking, the folds have been already changed when this event is inspected :) Or is the extra 'd' some typo/grammar-like error ?
I like more to update the shared variable from one place; does the suggestion bring some objective improvement, or is it rather a personal taste ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists