Index: applications/editors/josm/plugins/FastDraw/build.xml
===================================================================
--- applications/editors/josm/plugins/FastDraw/build.xml	(revision 26519)
+++ applications/editors/josm/plugins/FastDraw/build.xml	(revision 26520)
@@ -30,5 +30,5 @@
 <project name="FastDraw" default="dist" basedir=".">
     <!-- enter the SVN commit message -->
-    <property name="commit.message" value="FastDraw: saving bug - meging nodes"/>
+    <property name="commit.message" value="FastDraw: snapping fixed, do not save degenerate lines"/>
     <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     <property name="plugin.main.version" value="4201"/>
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 26519)
+++ applications/editors/josm/plugins/FastDraw/src/org/openstreetmap/josm/plugins/fastdraw/FastDrawingMode.java	(revision 26520)
@@ -76,5 +76,5 @@
     private final Cursor cursorNode;
     private final Cursor cursorDrawing;
-    private boolean nearpoint;
+    private boolean nearSomeNode;
     private LatLon highlighted;
     private int nearestIdx;
@@ -218,5 +218,4 @@
                 g.setColor(lineColor);
                 g.drawLine(p1.x, p1.y, p2.x, p2.y);
-  //                  g.fillOval(p2.x - 5, p2.y - 5, 11, 11);
                 if (line.isFixed(pp2)) {
                     lineColor=initLineColor;
@@ -246,5 +245,6 @@
             }
         }
-        if (settings.drawLastSegment && !drawing && !shift && nearestIdx<0 && !line.wasSimplified()) {
+        if (settings.drawLastSegment && !drawing && dragNode<0  && !shift && 
+                nearestIdx<=0 && !line.wasSimplified()) {
             // draw line to current point
             g.setColor(lineColor);
@@ -259,5 +259,4 @@
             if (lp!=null) g.drawOval(lp.x-r,lp.y-r,2*r,2*r);
         }
-
     }
 
@@ -299,5 +298,4 @@
         if (e.getButton() != MouseEvent.BUTTON1) return;
 
-
         int idx=line.findClosestPoint(e.getPoint(),settings.maxDist);
         if (idx==0 && !line.isClosed()) {
@@ -339,5 +337,4 @@
         }
 
-
         LatLon p = mv.getLatLon(point.x, point.y);
         if (settings.snapNodes) { // find existing node near point and use it
@@ -384,7 +381,7 @@
         deltaChanged=false;
         Node nd1 = getNearestNode(e.getPoint(), settings.maxDist);
-        boolean nearpoint2=nd1!=null;
+        boolean nearSomeNode2=nd1!=null;
         boolean needRepaint=false;
-        if (nearpoint!=nearpoint2) {nearpoint=nearpoint2;updateCursor();needRepaint=true;}
+        if (nearSomeNode!=nearSomeNode2) {nearSomeNode=nearSomeNode2;updateCursor();needRepaint=true;}
 
         int nearestIdx2=line.findClosestPoint(e.getPoint(),settings.maxDist);
@@ -402,8 +399,5 @@
                 // find line fragment to highlight
                 LatLon h2=line.findBigSegment(e.getPoint());
-                if (highlighted!=h2) {
-                    highlighted=h2;
-                    repaint();
-                }
+                if (highlighted!=h2) { highlighted=h2; repaint(); }
             } else if (needRepaint) {
                 repaint();
@@ -418,6 +412,7 @@
         Point lastP = line.getLastPoint(); // last point of line fragment being edited
 
-        if (nearpoint){
-            if ( Math.hypot(e.getX() - lastP.x, e.getY() - lastP.y) > 1e-2) {
+        // free mouse-drawing
+        if (nearSomeNode){
+            if (settings.snapNodes && Math.hypot(e.getX() - lastP.x, e.getY() - lastP.y) > 1e-2) {
                 line.addFixed(nd1.getCoor()); // snap to node coords
                 repaint();
@@ -426,12 +421,9 @@
         } 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)); // add new point
                 repaint();
                 return;
             }
         }
-        if (nearpoint!=nearpoint2) {nearpoint=nearpoint2;updateCursor();}
-
-
         //statusText = getLatLon(e).toString();        updateStatusLine();
     }
@@ -488,5 +480,5 @@
             e.consume();
             Point lastPoint = line.getLastPoint();
-            line.moveToTheEnd();
+            if (!line.isClosed()) line.moveToTheEnd();
             if (lastPoint==null || lastPoint.equals(line.getLastPoint())) {
                  if (line.getPoints().size()>5) {
@@ -562,5 +554,7 @@
         List<LatLon> pts=line.getPoints();
         int n = pts.size();
-        if (n == 0) return;
+        if (n < 2) return; //do not save oversimplified lines
+        if (line.isClosed() && n==2) return;
+        if (line.isClosed() && n==3) pts.remove(2); // two-point way can not be closed
 
         Collection<Command> cmds = new LinkedList<Command>();
@@ -574,5 +568,5 @@
             //if (line.isFixed(p)) {
                 // there may be a node with same ccoords!
-                nd = Main.map.mapView.getNearestNode(line.getPoint(p), OsmPrimitive.isUsablePredicate);
+                nd = Main.map.mapView.getNearestNode(line.getPoint(p), OsmPrimitive.isSelectablePredicate);
             //}
             if (nd!=null) if (p.greatCircleDistance(nd.getCoor())>0.01) nd=null;
@@ -646,5 +640,5 @@
         deltaChanged=true;
         
-        setStatusLine(tr("min distance={0} pixels or {1} m",(int)settings.minPixelsBetweenPoints,
+        setStatusLine(tr("min distance={0} px ({1} m)",(int)settings.minPixelsBetweenPoints,
                 mv.getDist100Pixel()/100*settings.minPixelsBetweenPoints));
         repaint();
@@ -705,11 +699,9 @@
     private void updateCursor() {
         if (shift) Main.map.mapView.setCursor(cursorShift); else
-        if (line.isClosed()) Main.map.mapView.setCursor(cursorReady); else
+        if (line.isClosed() || (nearestIdx==0)) Main.map.mapView.setCursor(cursorReady); else
         if (ctrl) Main.map.mapView.setCursor(cursorCtrl); else
-        if (nearpoint) Main.map.mapView.setCursor(cursorCtrl); else
+        if (nearSomeNode && settings.snapNodes) Main.map.mapView.setCursor(cursorCtrl); else
         if (drawing) Main.map.mapView.setCursor(cursorDrawing); else
         Main.map.mapView.setCursor(cursorDraw);
-
-
     }
 
@@ -722,5 +714,5 @@
 
     private Node getNearestNode(Point point, double maxDist) {
-       Node nd = Main.map.mapView.getNearestNode(point, OsmPrimitive.isUsablePredicate);
+       Node nd = Main.map.mapView.getNearestNode(point, OsmPrimitive.isSelectablePredicate);
        if (nd!=null && line.getPoint(nd.getCoor()).distance(point)<=maxDist) return nd;
        else return null;
