[ 
https://issues.apache.org/jira/browse/NETBEANS-403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16376015#comment-16376015
 ] 

Eirik Bakke commented on NETBEANS-403:
--------------------------------------

It seems this bug was introduced by the following patch for Bugzilla issue 
[262311|https://netbeans.org/bugzilla/show_bug.cgi?id=262311] (diff reformatted 
for clarity):

[http://hg.netbeans.org/core-main/rev/03b2f960a7c3:]
{noformat}
--- a/editor.lib/src/org/netbeans/editor/PopupManager.java
+++ b/editor.lib/src/org/netbeans/editor/PopupManager.java
   //NOI18N ignore ToolTipSupport installed actions
-  if (obj != null && 
-      !obj.equals("tooltip-no-action") && obj.equals("tooltip-hide-action")) {
+  if (obj != null && !obj.equals("tooltip-no-action")) {
       // if yes, gets the popup's action for this keystroke, perform it 
       // and consume key event
{noformat}
Prior to the patch above, the "if" condition would previously only be true for 
the tooltip-hide-action--obviously an earlier bug given the then-irrelevant 
check for "tooltip-no-action". So other popup actions were never performed 
before. When the patch above was applied, tooltips started capturing various 
actions, exposing new bugs.

The prescribed strategy for dealing with the resulting problems seems to be to 
add specific actions to be excluded from popup processing to a list in 
org.netbeans.editor.ext.ToolTipSupport.filterBindings:
{code:java}
if (actionName.contains("delete") || actionName.contains("insert") || //NOI18N
    actionName.contains("paste") || actionName.contains("default") || //NOI18N
    actionName.contains("cut") //NOI18N
) {
    actionMap.put(key, NO_ACTION);
}
{code}
This seems fragile, though--how do we know which actions should be added here, 
and which should not? For instance, "caret-begin" and "caret-end" should be 
added to fix the bug for the Home and End keystrokes, but more experimentation 
also reveals a similar bug for "selection-begin" and "selection-end". Doing 
some logging, there are a grand total of 63 enabled actions in the ActionMap 
for which we'd have to choose whether each should go on the list or not, 34 of 
which seem to have assigned keyboard shortcuts (on my MacOS setup, at least).

Thoughts on how to best fix this are welcome.

> Pressing Home/End scrolls to beginning/end of whole document if tooltip is 
> open
> -------------------------------------------------------------------------------
>
>                 Key: NETBEANS-403
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-403
>             Project: NetBeans
>          Issue Type: Bug
>          Components: editor - Key bindings
>    Affects Versions: 8.2, 9.0
>            Reporter: Eirik Bakke
>            Priority: Major
>         Attachments: HomeEndBug.png
>
>
> When a tooltip is shown in the Java editor, for instance because the mouse is 
> hovering over an error indication, pressing the Home or End keys on the 
> keyboard scrolls the entire document all the way to the top or end, 
> respectively instead of to the beginning or end of the current line. This is 
> extremely disruptive, and likely very confusing to users, as it only happens 
> in the stated situation.
> A workaround is to move the mouse pointer away from the editor to close the 
> popup after examining an error. Most users will not be able to discover this 
> workaround, though--for myself, it took two weeks to discover the correlation 
> between the tooltip being open and the bug occurring.
> This bug seems to have been introduced in 8.2, and I justĀ confirmed that it 
> is still present on the new Apache NetBeans 9.0 beta release.
> This issue was first reported as issue #270842 by timothyrheider in the old 
> BugZilla tracker, on 2017-06-09:
> https://netbeans.org/bugzilla/show_bug.cgi?id=270842



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to