[jira] [Comment Edited] (NETBEANS-5070) Partitial fix for NETBEANS-819 breaks terminal

2020-12-31 Thread Jira


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

Matthias Bläsing edited comment on NETBEANS-5070 at 12/31/20, 6:58 PM:
---

So I looked a bit deeper into the terminal and I think the solution can be 
simpler than the current approach.  It is less invasive, as it only activates a 
different code path, that was already present in the codebase.

Please have a look here: https://github.com/apache/netbeans/pull/2628

The first three commits can be ignored, as they just return the codebase to the 
original state:

- 
https://github.com/apache/netbeans/pull/2628/commits/172a9cf8198ee372fabbfeabc8a3ecc183fa837e
 - Adds a debug option to see the fixed width grid (to verify the char 
positions against that)
- 
https://github.com/apache/netbeans/pull/2628/commits/4d1a41420cf756faa81ee200ac8edf7626632361
 - My suggested fix

I tested on windows 150% + 200% and Linux 2x. Please see if it fixes the 
situation for you too.

I also ran "npx grunt" successfully with my test project on windows.

Before (the first of a pair is scale=1, the second scale=2):

 !before_scale1.png! 
 !before_scale2.png! 
 !before2_scale1.png! 
 !before2_scale2.png! 

After:

 !after_scale1.png! 
 !after_scale2.png! 
 !after2_scale1.png! 
 !after2_scale2.png! 


was (Author: mblaesing):
So I looked a bit deeper into the terminal and I think the solution can be 
simpler than the current approach.  It is less invasive, as it only activates a 
different code path, that was already present in the codebase.

Please have a look here: https://github.com/apache/netbeans/pull/2628

The first three commits can be ignored, as they just return the codebase to the 
original state:

- 
https://github.com/apache/netbeans/pull/2628/commits/172a9cf8198ee372fabbfeabc8a3ecc183fa837e
 - Adds a debug option to see the fixed width grid (to verify the char 
positions against that)
- 
https://github.com/apache/netbeans/pull/2628/commits/4d1a41420cf756faa81ee200ac8edf7626632361
 - My suggested fix

I tested on windows 150% + 200% and Linux 2x. Please see if it fixes the 
situation for you too.

I also ran "npx grunt" successfully with my test project on windows.

> Partitial fix for NETBEANS-819 breaks terminal
> --
>
> Key: NETBEANS-5070
> URL: https://issues.apache.org/jira/browse/NETBEANS-5070
> Project: NetBeans
>  Issue Type: Bug
>  Components: cnd - Terminalemulator
>Affects Versions: Next
>Reporter: Matthias Bläsing
>Assignee: Michal Hlavac
>Priority: Blocker
>  Labels: pull-request-available
> Fix For: 12.3
>
> Attachments: 99895991-55dd6080-2c41-11eb-9019-c7c96214a802.gif, 
> Bildschirmfoto_2020-12-30_17-07-10.png, after2_scale1.png, after2_scale2.png, 
> after_scale1.png, after_scale2.png, before2_scale1.png, before2_scale2.png, 
> before_scale1.png, before_scale2.png
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> The fix for shifted cursor in terminal windows commited by:
> [https://github.com/apache/netbeans/pull/2509]
> Breaks text selection (video provided by [~lkishalmi] ):
> !99895991-55dd6080-2c41-11eb-9019-c7c96214a802.gif!
> I also saw that behavior on windows and on linux I observed flaky behavior of 
> the terminal and this is matched by exceptions:
> {quote}SEVERE [global]
> java.lang.ArrayIndexOutOfBoundsException: Index 134 out of bounds for length 
> 134
>   at 
> java.desktop/sun.font.FontDesignMetrics.charsWidth(FontDesignMetrics.java:506)
>   at org.netbeans.lib.terminalemulator.Line.stringWidth(Line.java:159)
>   at org.netbeans.lib.terminalemulator.Sel.paint(Sel.java:407)
>   at org.netbeans.lib.terminalemulator.Sel.access$000(Sel.java:71)
>   at org.netbeans.lib.terminalemulator.Sel$2.visit(Sel.java:436)
>   at org.netbeans.lib.terminalemulator.Buffer.visitLines(Buffer.java:205)
>   at org.netbeans.lib.terminalemulator.Term.visitLines(Term.java:912)
>   at org.netbeans.lib.terminalemulator.Sel.paint(Sel.java:434)
>   at org.netbeans.lib.terminalemulator.Term.do_paint(Term.java:3175)
>   at org.netbeans.lib.terminalemulator.Screen.paint(Screen.java:168)
>   at 
> java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
>   at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
>   at 
> java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
>   at 
> java.desktop/javax.swing.JComponent.paint(JComponent.java:1083){quote}
> So we either need a quick fix for this or we need to rollback the referenced 
> commit.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: 

[jira] [Comment Edited] (NETBEANS-5070) Partitial fix for NETBEANS-819 breaks terminal

2020-12-30 Thread Michal Hlavac (Jira)


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

Michal Hlavac edited comment on NETBEANS-5070 at 12/30/20, 8:14 PM:


Sorry I meant string width. From what I tried and problem is, that I am not 
swing pro, I discovered that with {{SCALE = 2}}, fixed font size and e.g. 
string of 10 characters width is not same as {{width('a') * 10}}. It would be 
great if somebody with better swing knowledge could help with this. 


was (Author: hlavki):
Sorry I meant string width. From what I tried and problem is, that I am not 
swing pro, I discovered that with {{SCALE = 2}}, fixed font size and e.g. 
string of 10 characters width is not same as {{width('a') * 10}}

> Partitial fix for NETBEANS-819 breaks terminal
> --
>
> Key: NETBEANS-5070
> URL: https://issues.apache.org/jira/browse/NETBEANS-5070
> Project: NetBeans
>  Issue Type: Bug
>  Components: cnd - Terminalemulator
>Affects Versions: Next
>Reporter: Matthias Bläsing
>Assignee: Michal Hlavac
>Priority: Blocker
>  Labels: pull-request-available
> Fix For: 12.3
>
> Attachments: 99895991-55dd6080-2c41-11eb-9019-c7c96214a802.gif, 
> Bildschirmfoto_2020-12-30_17-07-10.png
>
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> The fix for shifted cursor in terminal windows commited by:
> [https://github.com/apache/netbeans/pull/2509]
> Breaks text selection (video provided by [~lkishalmi] ):
> !99895991-55dd6080-2c41-11eb-9019-c7c96214a802.gif!
> I also saw that behavior on windows and on linux I observed flaky behavior of 
> the terminal and this is matched by exceptions:
> {quote}SEVERE [global]
> java.lang.ArrayIndexOutOfBoundsException: Index 134 out of bounds for length 
> 134
>   at 
> java.desktop/sun.font.FontDesignMetrics.charsWidth(FontDesignMetrics.java:506)
>   at org.netbeans.lib.terminalemulator.Line.stringWidth(Line.java:159)
>   at org.netbeans.lib.terminalemulator.Sel.paint(Sel.java:407)
>   at org.netbeans.lib.terminalemulator.Sel.access$000(Sel.java:71)
>   at org.netbeans.lib.terminalemulator.Sel$2.visit(Sel.java:436)
>   at org.netbeans.lib.terminalemulator.Buffer.visitLines(Buffer.java:205)
>   at org.netbeans.lib.terminalemulator.Term.visitLines(Term.java:912)
>   at org.netbeans.lib.terminalemulator.Sel.paint(Sel.java:434)
>   at org.netbeans.lib.terminalemulator.Term.do_paint(Term.java:3175)
>   at org.netbeans.lib.terminalemulator.Screen.paint(Screen.java:168)
>   at 
> java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
>   at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
>   at 
> java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
>   at 
> java.desktop/javax.swing.JComponent.paint(JComponent.java:1083){quote}
> So we either need a quick fix for this or we need to rollback the referenced 
> commit.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

-
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

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



[jira] [Comment Edited] (NETBEANS-5070) Partitial fix for NETBEANS-819 breaks terminal

2020-12-30 Thread Jira


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

Matthias Bläsing edited comment on NETBEANS-5070 at 12/30/20, 4:17 PM:
---

This is still broken on windows - the following image was created by running 
`npx grunt` from the terminal window. This runs grunt and as part of that 
uglify and some other grunt tasks were run. I assume, that some console 
interaction triggered the problem:

  !Bildschirmfoto_2020-12-30_17-07-10.png|width=1195,height=261!
{noformat}
{{Caused by: java.lang.IndexOutOfBoundsException: len=-2147483648
at 
java.desktop/sun.font.FontDesignMetrics.charsWidth(FontDesignMetrics.java:502)
at org.netbeans.lib.terminalemulator.Line.stringWidth(Line.java:160)
at org.netbeans.lib.terminalemulator.Line.cellToBuf(Line.java:175)
at org.netbeans.lib.terminalemulator.Term$OpsImpl.op_ech(Term.java:4453)
at 
org.netbeans.lib.terminalemulator.InterpProtoANSI$InterpTypeProtoANSI$ACT_ECH.action(InterpProtoANSI.java:111)
at 
org.netbeans.lib.terminalemulator.InterpDumb.processChar(InterpDumb.java:213)
at org.netbeans.lib.terminalemulator.Term.putc_work(Term.java:4587)
at org.netbeans.lib.terminalemulator.Term.access$400(Term.java:222)
at 
org.netbeans.lib.terminalemulator.Term$BaseTermStream.putChars(Term.java:415)
at org.netbeans.lib.terminalemulator.Term.putChars(Term.java:3342)
at 
org.netbeans.lib.terminalemulator.StreamTerm$OutputMonitor$Trampoline.run(StreamTerm.java:194)
at 
java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
at 
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at 
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at 
org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
at 
java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at 
java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at 
java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at 
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at 
java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at 
java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)}}

 {noformat}
 


was (Author: mblaesing):
This is still broken on windows - the following image was created by running 
`npx grunt` from the terminal window. This runs grunt and as part of that 
uglify and some other grunt tasks were run. I assume, that some console 
interaction triggered the problem:

  !image-2020-12-30-17-16-35-289.png|width=1186,height=259!

{noformat}

{{Caused by: java.lang.IndexOutOfBoundsException: len=-2147483648
at 
java.desktop/sun.font.FontDesignMetrics.charsWidth(FontDesignMetrics.java:502)
at org.netbeans.lib.terminalemulator.Line.stringWidth(Line.java:160)
at org.netbeans.lib.terminalemulator.Line.cellToBuf(Line.java:175)
at org.netbeans.lib.terminalemulator.Term$OpsImpl.op_ech(Term.java:4453)
at 
org.netbeans.lib.terminalemulator.InterpProtoANSI$InterpTypeProtoANSI$ACT_ECH.action(InterpProtoANSI.java:111)
at 
org.netbeans.lib.terminalemulator.InterpDumb.processChar(InterpDumb.java:213)
at org.netbeans.lib.terminalemulator.Term.putc_work(Term.java:4587)
at org.netbeans.lib.terminalemulator.Term.access$400(Term.java:222)
at 
org.netbeans.lib.terminalemulator.Term$BaseTermStream.putChars(Term.java:415)
at org.netbeans.lib.terminalemulator.Term.putChars(Term.java:3342)
at 
org.netbeans.lib.terminalemulator.StreamTerm$OutputMonitor$Trampoline.run(StreamTerm.java:194)
at 
java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303)
at 
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at 
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at