From 512bfa0c65f8e089700881a4e6cbfb1d2dc8cb58 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 28 Apr 2014 19:49:23 +0100 Subject: [PATCH] Fix support for tabulation in insert completion candidates --- src/input_handler.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/input_handler.cc b/src/input_handler.cc index d7274b6d..560d2d11 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -11,6 +11,7 @@ #include "color_registry.hh" #include "file.hh" #include "word_db.hh" +#include "buffer_utils.hh" #include "debug.hh" #include @@ -917,7 +918,15 @@ private: if (not m_context.has_ui()) return; DisplayCoord menu_pos = m_context.window().display_position(m_completions.begin); - m_context.ui().menu_show(m_matching_candidates, menu_pos, + + const CharCount tabstop = m_context.options()["tabstop"].get(); + const CharCount column = get_column(m_context.buffer(), tabstop, + m_completions.begin); + std::vector menu_entries; + for (auto& candidate : m_matching_candidates) + menu_entries.push_back(expand_tabs(candidate, tabstop, column)); + + m_context.ui().menu_show(menu_entries, menu_pos, get_color("MenuForeground"), get_color("MenuBackground"), MenuStyle::Inline);