display character column instead of byte column in status line

This commit is contained in:
Maxime Coste 2013-04-11 13:45:28 +02:00
parent 1398641d22
commit 8b829d1cdf

View File

@ -200,11 +200,12 @@ Context& ClientManager::get_client_context(const String& name)
static DisplayLine generate_status_line(const Context& context) static DisplayLine generate_status_line(const Context& context)
{ {
BufferCoord cursor = context.editor().main_selection().last().coord(); auto pos = context.editor().main_selection().last();
std::ostringstream oss; auto col = utf8::distance(context.buffer().iterator_at_line_begin(pos), pos);
std::ostringstream oss;
oss << context.buffer().display_name() oss << context.buffer().display_name()
<< " " << (int)cursor.line+1 << "," << (int)cursor.column+1; << " " << (int)pos.line()+1 << "," << (int)col+1;
if (context.buffer().is_modified()) if (context.buffer().is_modified())
oss << " [+]"; oss << " [+]";
if (context.input_handler().is_recording()) if (context.input_handler().is_recording())