<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ensure_hbounds(self):
 """Ensure the cursor is within horizontal screen bounds."""

        self.cursor.x = min(max(0, self.cursor.x), self.columns - 1)