Fix bug #9288: Cannot position cursor near the end of a line.

The problem was that some parts of the code assume that the right margin is part of the width of the row. This is not the case, only the left margin (Row::x) is counted.

The code has been fixed and documented to reflect this.