From ca69981cc65ab521d10fd5223593c944dd9f6ed4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 18 Apr 2013 20:22:19 +0200 Subject: [PATCH] Ncurses: display status line in terminal title as well --- src/ncurses.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ncurses.cc b/src/ncurses.cc index a719b44d..80d78e9a 100644 --- a/src/ncurses.cc +++ b/src/ncurses.cc @@ -221,6 +221,18 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer, move((int)m_dimensions.line, (int)col); draw_line(mode_line, col); } + + const char* tsl = tigetstr((char*)"tsl"); + const char* fsl = tigetstr((char*)"fsl"); + if (tsl != 0 and (ptrdiff_t)tsl != -1 and fsl != 0 and (ptrdiff_t)fsl != -1) + { + String title; + for (auto& atom : mode_line) + title += atom.content.content(); + title += " - Kakoune"; + printf("%s%s%s", tsl, title.c_str(), fsl); + } + redraw(); }