873. The Four-Cubit Limit
Shabbos 27:13
If a person left his Shabbos boundary intentionally, he is limited to four cubits even if he is returned to his original location by forces beyond his control, such as if he was brought back by non-Jews or a bout of temporary insanity. Similarly, if one intentionally left his Shabbos boundary, he is limited to four cubits even if he is inside a private domain like a barn or a corral. One who sets out on the Mediterranean Sea may traverse the entirety of the ship, and carry throughout the ship, even though he is outside the Shabbos boundary of the place he was when Shabbos arrived.
Shabbos 27:14
If a person left his Shabbos boundary unintentionally but he is surrounded by an enclosure, he may traverse the entirety of that enclosure so long as it is not more than 2,000 cubits. When an enclosure is created without one's knowledge and overlaps part of the Shabbos boundary that one left, then since he is allowed to walk throughout the enclosure, he is permitted to reenter his Shabbos boundary. Once he has done so, it's as if he never left.