aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-09-27 20:30:30 -0600
committerTom Tromey <tom@tromey.com>2020-09-27 20:30:32 -0600
commit35a982372fd63da7dd2811d6150b0c61236bbbb5 (patch)
treeaaf5771dc436250216fab311889bed1e641f4f1c /gdb
parent9e820dec13ec153f5843a30afe6d1c5037405278 (diff)
downloadgdb-35a982372fd63da7dd2811d6150b0c61236bbbb5.zip
gdb-35a982372fd63da7dd2811d6150b0c61236bbbb5.tar.gz
gdb-35a982372fd63da7dd2811d6150b0c61236bbbb5.tar.bz2
Use ISCNTRL in tui_copy_source_line
This changes tui_copy_source_line to use ISCNTRL. This lets it work more nicely with UTF-8 input. Note that this still won't work for stateful multi-byte encodings; for that much more work would be required. However, I think this patch does not make gdb any worse in this scenario. gdb/ChangeLog 2020-09-27 Tom Tromey <tom@tromey.com> PR tui/25342: * tui/tui-winsource.c (tui_copy_source_line): Use ISNCTRL.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/tui/tui-winsource.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 38b9fa6..fc016ae 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2020-09-27 Tom Tromey <tom@tromey.com>
+ PR tui/25342:
+ * tui/tui-winsource.c (tui_copy_source_line): Use ISNCTRL.
+
+2020-09-27 Tom Tromey <tom@tromey.com>
+
* unittests/tui-selftests.c: Update.
* tui/tui-winsource.h (struct tui_source_window_base)
<extra_margin, show_line_number, refresh_pad>: New methods.
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 2300b9a..30b8f69 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -28,6 +28,7 @@
#include "source.h"
#include "objfiles.h"
#include "filenames.h"
+#include "safe-ctype.h"
#include "tui/tui.h"
#include "tui/tui-data.h"
@@ -107,7 +108,9 @@ tui_copy_source_line (const char **ptr, int *length)
{
/* Nothing. */
}
- else if (c < 040 && c != '\t')
+ else if (c == '\t')
+ process_tab ();
+ else if (ISCNTRL (c))
{
result.push_back ('^');
result.push_back (c + 0100);
@@ -119,8 +122,6 @@ tui_copy_source_line (const char **ptr, int *length)
result.push_back ('?');
++column;
}
- else if (c == '\t')
- process_tab ();
else
result.push_back (c);
}