Ok here we go.
You are right I should have explained better.
I was trying your patch and I had some difficulties.
In order to explain better I needed some time to ponder.
I just show you in the picture one of the problems I encountered.
I used the polyline tool (from now on PLT) to delete a piece of track.
After that I wanted to continue the line, as you can see in the second picture.
I was not able to do this immediately.
I first have to choose an other track building tool to tell the PLT were to start.
Even when I want to start at a random place the PLT keeps on insisting to start from the last ending point.
Sometimes painting half a map with polyline.
This is just one example.
For me this is not desired behavior.
A noob to which I include myself should not get in panic when using the tool.
The tool is imposing too much its behavior on the player.
My patch stops the polyline when rail is removed or overbuild.
It was to show you a more gentile behavior.
A better way in my opinion is the moment an other track building tool is chosen or more explicit when the button
of the PLT goes up or disappears it should forget were it was.
It is not much effort to start a new round of polylining from a new, or from the last starting point.
Also the PLT could easily replace the autorail button.
It does the job much better.....
Hope this helps