summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-04-28 19:49:23 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-04-28 19:49:23 +0100
commit512bfa0c65f8e089700881a4e6cbfb1d2dc8cb58 (patch)
tree64b08441efac18a105907a24ea1d72370a75d746 /src/input_handler.cc
parent53cb626f49dc202186adf34c585403dc4df54318 (diff)
Fix support for tabulation in insert completion candidates
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc11
1 files changed, 10 insertions, 1 deletions
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 <unordered_map>
@@ -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<int>();
+ const CharCount column = get_column(m_context.buffer(), tabstop,
+ m_completions.begin);
+ std::vector<String> 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);