Index: /applications/editors/josm/plugins/FastDraw/build.xml
===================================================================
--- /applications/editors/josm/plugins/FastDraw/build.xml	(revision 26447)
+++ /applications/editors/josm/plugins/FastDraw/build.xml	(revision 26448)
@@ -30,5 +30,5 @@
 <project name="FastDraw" default="dist" basedir=".">
     <!-- enter the SVN commit message -->
-    <property name="commit.message" value="FastDraw: can hold spacebar instead of LKM, can edit existing lines "/>
+    <property name="commit.message" value="FastDraw: better linux compatibility"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     <property name="plugin.main.version" value="4201"/>
Index: /applications/editors/josm/plugins/FastDraw/nbproject/project.xml
===================================================================
--- /applications/editors/josm/plugins/FastDraw/nbproject/project.xml	(revision 26448)
+++ /applications/editors/josm/plugins/FastDraw/nbproject/project.xml	(revision 26448)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.ant.freeform</type>
+    <configuration>
+        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
+            <!-- Не используйте диалоговое окно свойств проекта при редактировании данного файла вручную. -->
+            <name>FastDraw</name>
+            <properties/>
+            <folders>
+                <source-folder>
+                    <label>src</label>
+                    <type>java</type>
+                    <location>src</location>
+                </source-folder>
+            </folders>
+            <ide-actions>
+                <action name="build">
+                    <target>dist</target>
+                </action>
+                <action name="clean">
+                    <target>clean</target>
+                </action>
+                <action name="run">
+                    <target>runjosm</target>
+                </action>
+                <action name="rebuild">
+                    <target>clean</target>
+                    <target>dist</target>
+                </action>
+            </ide-actions>
+            <view>
+                <items>
+                    <source-folder style="packages">
+                        <label>src</label>
+                        <location>src</location>
+                    </source-folder>
+                    <source-file>
+                        <location>build.xml</location>
+                    </source-file>
+                </items>
+                <context-menu>
+                    <ide-action name="build"/>
+                    <ide-action name="rebuild"/>
+                    <ide-action name="clean"/>
+                    <ide-action name="run"/>
+                </context-menu>
+            </view>
+        </general-data>
+        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/3">
+            <compilation-unit>
+                <package-root>src</package-root>
+                <classpath mode="compile">../../core/src</classpath>
+                <source-level>1.6</source-level>
+            </compilation-unit>
+        </java-data>
+    </configuration>
+</project>
Index: /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java
===================================================================
--- /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java	(revision 26447)
+++ /applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java	(revision 26448)
@@ -25,10 +25,10 @@
 import java.awt.event.AWTEventListener;
 import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.awt.event.InputEvent;
 import java.awt.event.KeyEvent;
-import java.io.IOException;
-import java.lang.annotation.Target;
 import java.util.*;
 import javax.swing.JOptionPane;
+import javax.swing.Timer;
 
 import org.openstreetmap.josm.Main;
@@ -36,6 +36,4 @@
 import org.openstreetmap.josm.actions.mapmode.MapMode;
 import org.openstreetmap.josm.command.AddCommand;
-import org.openstreetmap.josm.command.ChangeCommand;
-import org.openstreetmap.josm.command.ChangeNodesCommand;
 import org.openstreetmap.josm.command.Command;
 import org.openstreetmap.josm.command.DeleteCommand;
@@ -84,5 +82,9 @@
     private SequenceCommand delCmd;
     private List<Node> oldNodes;
-
+    
+    private final TreeSet set = new TreeSet();
+    private Timer timer;
+  
+    private KeyEvent releaseEvent;
 
     FastDrawingMode(MapFrame mapFrame) {
@@ -135,5 +137,14 @@
             if (w.isNew()) loadFromWay(w);
         }
-
+        timer = new Timer(0, new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent ae) {
+                 timer.stop();
+                 if (set.remove(releaseEvent.getKeyCode())) {
+                  doKeyReleaseEvent(releaseEvent);
+                 }
+            }
+        });
+        
         try {
             Toolkit.getDefaultToolkit().addAWTEventListener(this,
@@ -213,5 +224,6 @@
                 }
                 if (!drawing) {
-                    if (shift && !line.wasSimplified() && nearestIdx==i+1 ) {
+                    if (!line.wasSimplified() && nearestIdx==i+1 ) {
+                    if (shift) {
                         // highlight node to delete
                         g.setStroke(strokeForDelete);
@@ -220,6 +232,5 @@
                         g.drawLine(p2.x - 5, p2.y + 5,p2.x + 5, p2.y - 5);
                         g.setStroke(strokeForOriginal);
-                    }
-                    if (ctrl && !line.wasSimplified() && nearestIdx==i+1 ) {
+                    } else if (ctrl) {
                         // highlight node to toggle fixation
                         g.setStroke(strokeForDelete);
@@ -227,4 +238,5 @@
                         g.drawOval(p2.x - 5, p2.y - 5, 11, 11);
                         g.setStroke(strokeForOriginal);
+                    } 
                     }
                 }
@@ -240,13 +252,27 @@
         }
         updateKeyModifiers((InputEvent) event);
+        if (event instanceof KeyEvent) {
+        KeyEvent e=(KeyEvent) event;
+        
         if (event.getID() == KeyEvent.KEY_PRESSED) {
+             if (timer.isRunning()) {
+                  timer.stop();
+                } else {
+                  set.add((e.getKeyCode()));
+                }
             doKeyEvent((KeyEvent) event);
         }
         if (event.getID() == KeyEvent.KEY_RELEASED) {
-            doKeyReleaseEvent((KeyEvent) event);
-        }
-        updateCursor();
-//        updateStatusLine();
-        repaint();
+            if (timer.isRunning()) {
+              timer.stop();
+               if (set.remove(e.getKeyCode())) {
+                  doKeyReleaseEvent(e);
+               }
+            } else {
+              releaseEvent = e;
+              timer.restart();
+            }
+        }
+        }
     }
 
@@ -332,7 +358,9 @@
         Node nd1 = getNearestNode(e.getPoint(), settings.maxDist);
         boolean nearpoint2=nd1!=null;
-        if (nearpoint!=nearpoint2) {nearpoint=nearpoint2;updateCursor();}
-
-        nearestIdx=line.findClosestPoint(e.getPoint(),settings.maxDist);
+        boolean needRepaint=false;
+        if (nearpoint!=nearpoint2) {nearpoint=nearpoint2;updateCursor();needRepaint=true;}
+
+        int nearestIdx2=line.findClosestPoint(e.getPoint(),settings.maxDist);
+        if (nearestIdx != nearestIdx2) {nearestIdx=nearestIdx2; updateCursor();needRepaint=true;}
         
         if (!drawing) {
@@ -350,8 +378,9 @@
                     repaint();
                 }
+            } else if (needRepaint) {
+                repaint();
             }
             return;
         }
-        updateCursor();
         if (line.isClosed()) setStatusLine(SIMPLIFYMODE_MESSAGE);
 
@@ -361,15 +390,19 @@
         Point lastP = line.getLastPoint(); // last point of line fragment being edited
 
-            if (nearpoint){
+        if (nearpoint){
             if ( Math.hypot(e.getX() - lastP.x, e.getY() - lastP.y) > 1e-2) {
                 line.addFixed(nd1.getCoor()); // snap to node coords
                 repaint();
+                return;
             }
         } else {
             if (Math.hypot(e.getX() - lastP.x, e.getY() - lastP.y) > settings.minPixelsBetweenPoints) {
-                          line.addLast(getLatLon(e)); // free mouse-drawing
+                line.addLast(getLatLon(e)); // free mouse-drawing
                 repaint();
-            }
-        }
+                return;
+            }
+        }
+        if (nearpoint!=nearpoint2) {nearpoint=nearpoint2;updateCursor();}
+
 
         //statusText = getLatLon(e).toString();        updateStatusLine();
@@ -377,5 +410,5 @@
 
     private void doKeyEvent(KeyEvent e) {
-        ///  System.out.println(e);
+       // System.out.println(e);
         switch(e.getKeyCode()) {
         case KeyEvent.VK_BACK_SPACE:
@@ -435,5 +468,7 @@
     
     private void doKeyReleaseEvent(KeyEvent keyEvent) {
+            //System.out.println("released "+keyEvent);
             if (keyEvent.getKeyCode()==KeyEvent.VK_SPACE) stopDrawing();
+            updateCursor();
     }
     /**
@@ -443,4 +478,5 @@
         ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0;
         shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0;
+        updateCursor();
     }
 
