The original question asked how a TCP handles a segment that partially overlaps the end of the receive window. RFC 793 answers this on page 82: "the local TCP considers that segments overlapping the range RCV.NXT to RCV.NXT + RCV.WND - 1 [meaning the receive window] carry acceptable data or control."
Therefore any segment that even partially overlaps the receive window, on either end, is kept. However, only the data inside the window is kept. The TCP can just discard the data outside the window and send an ACK for the highest sequence number kept.
(For a segment overlapping the end of the receive window, since the receiver can enlarge the window at any time, I believe it could also enlarge the window and keep the "extra" data that had been outside the old window. It would then send the appropriate ACK to show that that data had been accepted.)
The RFC also says that "Segments containing sequence numbers entirely outside of this range are considered duplicates and discarded", which again implies that segments not entirely outside the window are not discarded.
Also, a related case is mentioned on page 52: "When a segment overlaps other already received segments we reconstruct the segment to contain just the new data, and adjust the header fields to be consistent."
So, if the TCP had received two segments having a hole between them and then receives a segment that overlaps either or both, the TCP will create a new segment from the latest segment to fill the hole. For example:
S1 arrives: [1000, 1800)
S3 arrives: [1000, 1800)....hole....[1900, 2300)
S2 arrives: [1700, 2100)
Hole filled: [1000, 1800)[1800, 1900)[1900, 2300)