diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6a976af79e5deea30f7c7677a77062389b609e1e..4963ac57e1261c27195041b44884dbea6fc9dd96 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ current (development)
 - Bugfix: `Input` `onchange` was not called on backspace or delete key.
   Fixed by @chrysante in chrysante in PR #776.
 - Bugfix: Propertly restore cursor shape on exit. See #792.
+- Bugfix: Fix cursor position in when in the last column. See #831.
 
 ### Dom
 - Feature: Add `hscroll_indicator`. It display an horizontal indicator
diff --git a/src/ftxui/component/screen_interactive.cpp b/src/ftxui/component/screen_interactive.cpp
index c446f2ee51ff2deceaa69b552aeb89bfb62975ac..dc729acb37a39967b821235863302b0db4612a10 100644
--- a/src/ftxui/component/screen_interactive.cpp
+++ b/src/ftxui/component/screen_interactive.cpp
@@ -844,10 +844,18 @@ void ScreenInteractive::Draw(Component component) {
     const int dx = dimx_ - 1 - cursor_.x + int(dimx_ != terminal.dimx);
     const int dy = dimy_ - 1 - cursor_.y;
 
-    set_cursor_position = "\x1B[" + std::to_string(dy) + "A" +  //
-                          "\x1B[" + std::to_string(dx) + "D";
-    reset_cursor_position = "\x1B[" + std::to_string(dy) + "B" +  //
-                            "\x1B[" + std::to_string(dx) + "C";
+    set_cursor_position.clear();
+    reset_cursor_position.clear();
+
+    if (dy != 0) {
+        set_cursor_position += "\x1B[" + std::to_string(dy) + "A";
+        reset_cursor_position += "\x1B[" + std::to_string(dy) + "B";
+    }
+
+    if (dx != 0) {
+        set_cursor_position += "\x1B[" + std::to_string(dx) + "D";
+        reset_cursor_position += "\x1B[" + std::to_string(dx) + "C";
+    }
 
     if (cursor_.shape == Cursor::Hidden) {
       set_cursor_position += "\033[?25l";