albfan / jmeld

A visual diff and merge tool
44 stars 31 forks source link

copy from panel #15

Closed WolfgangFahl closed 9 years ago

WolfgangFahl commented 9 years ago

copying text from the diff panel doesn't seem to work. It would be a very useful and nice feature.

see http://stackoverflow.com/a/28283704/1497139 for a helper class. I tried it out by adding it and modifying

diff --git a/src/main/java/org/jmeld/ui/FilePanel.java b/src/main/java/org/jmeld/ui/FilePanel.java
index a7cc8ad..870fe1f 100644
--- a/src/main/java/org/jmeld/ui/FilePanel.java
+++ b/src/main/java/org/jmeld/ui/FilePanel.java
@@ -40,6 +40,7 @@ import javax.swing.text.BadLocationException;
 import javax.swing.text.Document;
 import javax.swing.text.Highlighter;
 import javax.swing.text.PlainDocument;
+^M
 import java.awt.*;
 import java.awt.event.*;

@@ -77,6 +78,9 @@ public class FilePanel implements BufferDocumentChangeListenerIF, ConfigurationL

         editor.addFocusListener(getFocusListener());
         editor.addCaretListener(getCaretListener());
+        DefaultContextMenu contextMenu = new DefaultContextMenu();^M
+        contextMenu.add(editor);^M
+^M

         scrollPane = new JScrollPane(editor);

works like a charm ...

albfan commented 9 years ago

Very useful, thanks!