aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/interface-curses.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2015-03-09 17:38:40 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2015-03-09 21:24:52 +0100
commit10e4e27ccce8f6a7da7c2e6c4aa62193c4426cda (patch)
tree3954724a9d9a020186cb373b82d194cebd993641 /src/interface-curses.cpp
parent76d0548608dc3fbb8d6b9161be6809c05605b610 (diff)
downloadsciteco-10e4e27ccce8f6a7da7c2e6c4aa62193c4426cda.tar.gz
fixed displaying of control characters in the "info" line (and window title)
* this relied on Curses' control character drawing on Curses. However it treats tab and line feed differently than other control characters, so registers like "^Mfoo" could not be displayed properly. Even if we can configure Curses to display them correctly, we need a "canonicalized", flat form of strings for other purposes (like setting window titles. This is form is different from the formatting used for command lines which may change anyway once we introduce Scintilla mini buffers. * therefore String::canonicalize_ctl() was introduced * also set window title on PDCurses
Diffstat (limited to 'src/interface-curses.cpp')
-rw-r--r--src/interface-curses.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/interface-curses.cpp b/src/interface-curses.cpp
index 9060a0b..a9bb466 100644
--- a/src/interface-curses.cpp
+++ b/src/interface-curses.cpp
@@ -38,6 +38,7 @@
#endif
#include "sciteco.h"
+#include "string-utils.h"
#include "cmdline.h"
#include "qregisters.h"
#include "ring.h"
@@ -226,14 +227,27 @@ InterfaceCurses::draw_info(void)
wbkgdset(info_window, ' ' | SCI_COLOR_ATTR(COLOR_BLACK, COLOR_WHITE));
waddstr(info_window, info_current);
wclrtoeol(info_window);
+
+#ifdef PDCURSES
+ PDC_set_title(info_current);
+#endif
}
void
InterfaceCurses::info_update_impl(const QRegister *reg)
{
+ /*
+ * We cannot rely on Curses' control character drawing
+ * and we need the info_current string for other purposes
+ * (like PDC_set_title()), so we "canonicalize" the
+ * register name here:
+ */
+ gchar *name = String::canonicalize_ctl(reg->name);
+
g_free(info_current);
- info_current = g_strdup_printf("%s - <QRegister> %s", PACKAGE_NAME,
- reg->name);
+ info_current = g_strdup_printf("%s - <QRegister> %s",
+ PACKAGE_NAME, name);
+ g_free(name);
draw_info();
}