Index: /applications/editors/josm/core_0.5/src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java
===================================================================
--- /applications/editors/josm/core_0.5/src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java	(revision 4478)
+++ /applications/editors/josm/core_0.5/src/org/openstreetmap/josm/actions/mapmode/AddSegmentAction.java	(revision 4479)
@@ -52,5 +52,5 @@
 	 */
 	public AddSegmentAction(MapFrame mapFrame) {
-		super(tr("Connect two node"), 
+		super(tr("Connect two nodes"), 
 				"addsegment", 
 				tr("Connect two nodes using ways."), 
@@ -73,5 +73,7 @@
 	}
 
-	
+	/**
+	 * Called when user hits space bar while dragging.
+	 */
 	@Override public void actionPerformed(ActionEvent e) {
 		super.actionPerformed(e);
@@ -102,6 +104,7 @@
 
 		Node hovered = Main.map.mapView.getNearestNode(e.getPoint());
-		if (hovered == null || hovered == first) return;
-
+		if (hovered == second) return;
+
+		drawHint(false);
 		second = hovered;
 		drawHint(true);
@@ -115,4 +118,5 @@
 			drawHint(false);
 			makeSegment();
+			first = null;
 		}
 	}
@@ -143,17 +147,27 @@
 		Node n1 = first;
 		Node n2 = second;
-			first = null;
-			second = null;
+		
+		// this is to allow continued segment drawing by hitting the space bar
+		// at every intermediate node
+		first = second;
+		second = null;
 
 		if (n1 == null || n2 == null || n1 == n2) return;
-		
+
 		Way w = getWayForNode(n1);
 		Way wnew;
+		Collection<OsmPrimitive> sel = Main.ds.getSelected();
+		
 		if (w == null) {
+			// create a new way and add it to the current selection.
 			wnew = new Way();
 			wnew.nodes.add(n1);
 			wnew.nodes.add(n2);
 			Main.main.undoRedo.add(new AddCommand(wnew));
+			sel.add(wnew);
+			Main.ds.setSelected(sel);
 		} else {
+			// extend an existing way; only add to current selection if
+			// it is not already in there.
 			wnew = new Way(w);
 			if (wnew.nodes.get(wnew.nodes.size() - 1) == n1) {
@@ -163,9 +177,13 @@
 			}
 			Main.main.undoRedo.add(new ChangeCommand(w, wnew));
+			// do not use wnew below; ChangeCommand only uses wnew as a
+			// message about changes to be done to w but will not replace w!
+			if (!sel.contains(w)) {
+				sel.add(w);
+			}
+			// do not move this into the if block above since it also
+			// fires the selection change event which is desired.
+			Main.ds.setSelected(sel);
 		}
-
-			Collection<OsmPrimitive> sel = Main.ds.getSelected();
-		sel.add(wnew);
-			Main.ds.setSelected(sel);
 
 		Main.map.mapView.repaint();
