aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/tui/tui-io.c13
2 files changed, 16 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fe61d24..2a75cea 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,8 +1,13 @@
+2015-02-11 Patrick Palka <patrick@parcs.ath.cx>
+
+ * tui/tui-io.c (tui_getc): Move cursor to the end of the command
+ line before printing a newline.
+
2015-02-11 Mark Wielaard <mjw@redhat.com>
* utils.c (producer_is_gcc): Return true or false.
-2015-02-04 Mark Wielaard <mjw@redhat.com>
+2015-02-10 Mark Wielaard <mjw@redhat.com>
* utils.h (producer_is_gcc): Change return type to bool. Add major
argument.
diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c
index 21b2a00..4083cde 100644
--- a/gdb/tui/tui-io.c
+++ b/gdb/tui/tui-io.c
@@ -627,9 +627,16 @@ tui_getc (FILE *fp)
}
else
{
- wmove (w, TUI_CMD_WIN->detail.command_info.cur_line,
- TUI_CMD_WIN->detail.command_info.curch);
- waddch (w, ch);
+ /* Move cursor to the end of the command line before emitting the
+ newline. We need to do so because when ncurses outputs a newline
+ it truncates any text that appears past the end of the cursor. */
+ int px = TUI_CMD_WIN->detail.command_info.curch;
+ int py = TUI_CMD_WIN->detail.command_info.cur_line;
+ px += rl_end - rl_point;
+ py += px / TUI_CMD_WIN->generic.width;
+ px %= TUI_CMD_WIN->generic.width;
+ wmove (w, py, px);
+ waddch (w, ch);
}
}