diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-01-09 14:26:55 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-01-09 14:27:01 +0100 |
commit | c772fd46fb1902807b5908245c80492078706477 (patch) | |
tree | f933f15862514f8e28ed9c3fa9db02fa93d13412 /buffer.cpp | |
parent | db38a3bad5d0ce24caea0e647481f14d369d737d (diff) |
Fix tab display and entry
Diffstat (limited to 'buffer.cpp')
-rw-r--r-- | buffer.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -86,7 +86,14 @@ vector<Buffer::ScreenLine> Buffer::layoutLine(const string &line,i64 linenum,i64 i64 linepart=0,fromx=0; for(i64 i=0;i<(i64)line.size();i++){ char c=line[i]; - string repr=showChar(c); + string repr; + bool special=false; + if(c=='\t'){ + repr=string(4-cur.size()%4,' '); + } else { + repr=showChar(c); + special=repr.size()>1; + } assert(repr.size()>0); if(x+(i64)repr.size()>=width){ layout.push_back({linenum,linepart,fromx,move(cur)}); @@ -95,7 +102,7 @@ vector<Buffer::ScreenLine> Buffer::layoutLine(const string &line,i64 linenum,i64 fromx=i; x=0; } - Cell cell={'\0',repr.size()!=1,i}; + Cell cell={'\0',special,i}; for(char rc : repr){ cell.c=rc; cur.push_back(cell); |