Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-13 Thread Semyon Sadetsky
+1 --Semyon On 11/13/2017 12:52 AM, Prasanta Sadhukhan wrote: Hi Semyon, Please find the modified webrev for automated test. http://cr.openjdk.java.net/~psadhukhan/8187957/webrev.01/ Regards Prasanta On 11/9/2017 11:36 PM, Semyon Sadetsky wrote: Hi Prasanta, On 11/09/2017 01:56 AM,

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-13 Thread Prasanta Sadhukhan
Hi Semyon, Please find the modified webrev for automated test. http://cr.openjdk.java.net/~psadhukhan/8187957/webrev.01/ Regards Prasanta On 11/9/2017 11:36 PM, Semyon Sadetsky wrote: Hi Prasanta, On 11/09/2017 01:56 AM, Prasanta Sadhukhan wrote: I guess by "manual implementation", Sergey

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-09 Thread Semyon Sadetsky
Hi Prasanta, On 11/09/2017 01:56 AM, Prasanta Sadhukhan wrote: I guess by "manual implementation", Sergey was mentioning about programmer doing the calculation rather than using system api to do the job for us. Anyway, I saw using Math.ceil and no "nTabs+1", alignment does not work This is

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-09 Thread Sergey Bylokhov
On 09/11/2017 01:56, Prasanta Sadhukhan wrote: So, I guess, as Semyon suggested, making the "result of the sentence should be  truncated to int, not its members" should be the way to go. Thank you for clarification, then this solution looks fine. Lastly, could you please suggest as to how

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-09 Thread Prasanta Sadhukhan
I guess by "manual implementation", Sergey was mentioning about programmer doing the calculation rather than using system api to do the job for us. Anyway, I saw using Math.ceil and no "nTabs+1", alignment does not work This is because For ex, if x = 66.0, tabSize = 48.0, tabBase = 0, then

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-08 Thread semyon . sadetsky
On 11/8/17 12:24 PM, Sergey Bylokhov wrote: On 08/11/2017 11:38, Semyon Sadetsky wrote: Yes "(int)+1" is also can be used for positive values, but the "ceil()" is better since this purpose of this method, and in general it works for negative values as well. There may not be negative values

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-08 Thread Sergey Bylokhov
On 08/11/2017 11:38, Semyon Sadetsky wrote: Yes "(int)+1" is also can be used for positive values, but the "ceil()" is better since this purpose of this method, and in general it works for negative values as well. There may not be negative values here, so Math.ceil() is redundant. I do not

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-08 Thread Semyon Sadetsky
On 11/08/2017 11:28 AM, Sergey Bylokhov wrote: On 08/11/2017 10:39, Semyon Sadetsky wrote: It also may be written as   int ntabs = (int)((x - tabBase) / tabSize);   return tabBase + (ntabs + 1) * tabSize Yes "(int)+1" is also can be used for positive values, but the "ceil()" is

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-08 Thread Sergey Bylokhov
On 08/11/2017 10:39, Semyon Sadetsky wrote: It also may be written as int ntabs = (int)((x - tabBase) / tabSize); return tabBase + (ntabs + 1) * tabSize Yes "(int)+1" is also can be used for positive values, but the "ceil()" is better since this purpose of this method, and in

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-08 Thread Semyon Sadetsky
Hi Sergey, It also may be written as int ntabs = (int)((x - tabBase) / tabSize); return tabBase + (ntabs + 1) * tabSize See my previous comment. --Semyon On 11/08/2017 10:24 AM, Sergey Bylokhov wrote: Hi, Prasanta. Is it possible that dropping the float part of "tabSize" and "x"

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-08 Thread Sergey Bylokhov
Hi, Prasanta. Is it possible that dropping the float part of "tabSize" and "x" will cause Off-by-one error? For example: float tabSize=3.99f; float x=21.9f; int tabBase=0; 649 int ntabs = ((int) x - tabBase) / (int)tabSize; 650 return tabBase + ((ntabs + 1) *

Re: [10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-08 Thread Semyon Sadetsky
Hi Prasanta, It seems to me that the result of the sentence should be truncated to int, not its members. The test can be automated. --Semyon On 11/08/2017 03:25 AM, Prasanta Sadhukhan wrote: Hi All, Bug: https://bugs.openjdk.java.net/browse/JDK-8187957 webrev:

[10] RFR JDK-8187957:Tab Size does not work correctly in JTextArea

2017-11-08 Thread Prasanta Sadhukhan
Hi All, Bug: https://bugs.openjdk.java.net/browse/JDK-8187957 webrev: http://cr.openjdk.java.net/~psadhukhan/8187957/webrev.00/ Please review a fix for an issue where it is seen string with "tab" in them are not aligned properly. This is because while calculating tab stop postion, it is