diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-01-10 10:16:51 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-01-10 10:22:04 +0100 |
commit | d7657709a54750766aa2803279a7353e6a7fb6df (patch) | |
tree | b9e5a80067aea72def4435ef7462506794d4ee52 | |
parent | 3e434c89de052c1909952746368e837fb68e0ae2 (diff) |
Fix line numbering for large lines
-rw-r--r-- | buffer.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
@@ -302,6 +302,7 @@ i64 numberWidth(i64 number){ void Buffer::show(i64 atx,i64 aty,i64 width,i64 height){ static const Style gutterStyle={3,9,false,false}; + static const Style gutterContinuationStyle={1,9,false,true}; static const Style textStyle={9,9,false,false}; static const Style specialStyle={5,9,false,false}; @@ -322,13 +323,17 @@ void Buffer::show(i64 atx,i64 aty,i64 width,i64 height){ i64 curScreenX=-1,curScreenY=-1; // cerr<<"Buffer::show: screen.size()="<<screen.size()<<endl; for(y=0;y<(i64)screen.size();y++){ - moveto(atx,aty+y); - setstyle(&gutterStyle); - i64 nspaces=gutterWidth-1-numberWidth(screen[y].line+1); - for(i64 i=0;i<nspaces;i++){ - tputc(' '); + if(screen[y].fromx==0){ + setstyle(&gutterStyle); + moveto(atx+gutterWidth-1-numberWidth(screen[y].line+1),aty+y); + tprintf("%" PRIi64,screen[y].line+1); + } else if(y==0){ + setstyle(&gutterContinuationStyle); + moveto(atx+gutterWidth-2-numberWidth(screen[y].line+1),aty+y); + tprintf("^%" PRIi64,screen[y].line+1); } - tprintf("%" PRIi64 " ",screen[y].line+1); + + moveto(atx+gutterWidth,aty+y); i64 screenX=atx+gutterWidth; setstyle(&textStyle); |