mbien opened a new pull request, #9702:
URL: https://github.com/apache/netbeans/pull/9702

   the text area for the commit message has line wrap enabled while also 
showing a red line as recommended line length limit. The actual text which is 
committed is simply based on `getText()` atm which does not take line wrap into 
account. This can lead to unintended "single line" commit messages or a 
combination of custom and auto-wrapped text.
   
   This computes the line wrapped text as seen in the text area and uses it for 
the commit message.
   
   Alternative approach would be to simply disable line wrap which we should 
consider too IMO. Esp since this is difficult to unit test.
   
   test helper:
   
   <details>
   
   ```java
       static void main() {
           
           SwingUtilities.invokeLater(() -> {
               JFrame frame = new JFrame();
               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   
               WrappedTextArea area = new WrappedTextArea();
               area.setLineWrap(true);
               area.setWrapStyleWord(true);
               area.setText(
                       "Lorem ipsum dolor sit amet, consectetur adipiscing 
elit, sed do eiusmod tempor"
                               + " incididunt ut labore et dolore magna aliqua. 
Ut enim ad minim veniam,"
                               + " quis nostrud exercitation ullamco laboris 
nisi ut aliquip ex ea"
                               + " commodo consequat. Duis aute irure dolor in 
reprehenderit in voluptate"
                               + " velit esse cillum dolore eu fugiat nulla 
pariatur. Excepteur sint"
                               + " occaecat cupidatat non proident, sunt in 
culpa qui officia deserunt"
                               + " mollit anim id est laborum.");
   
               JButton button = new JButton("Get Wrapped Text");
               button.addActionListener(e -> {
                   try {
                       String wrapped = area.getWrappedText();
                       System.out.println("- - -");
                       System.out.println(wrapped);
                       System.out.println("- - -");
   //                    System.out.println(textArea.getText());
   //                    System.out.println("- - -");
                   } catch (BadLocationException ex) {
                       throw new RuntimeException(ex);
                   }
               });
   
               frame.setLayout(new BorderLayout());
               frame.add(new JScrollPane(area), BorderLayout.CENTER);
               frame.add(button, BorderLayout.SOUTH);
   
               frame.setSize(400, 300);
               frame.setVisible(true);
           });
       }
   ```
   
   </details>


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
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