diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-01-11 22:32:47 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-01-11 22:32:47 +0100 |
commit | b972e26307d0f87ffdc5b9a88d95ab3fe319d067 (patch) | |
tree | 728e0e7d6145248db1708720d2c215d8bda757c9 /buffer.cpp | |
parent | 7ee15dee3eb9b8d0fc49206b9fd9a56e84bd0a1a (diff) |
Show basic prompt
Diffstat (limited to 'buffer.cpp')
-rw-r--r-- | buffer.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
@@ -16,6 +16,9 @@ using namespace std; Buffer::Buffer(Manager *manager) :manager(manager){} +Buffer::Buffer(Manager *manager,bool singleLineMode) + :manager(manager),singleLineMode(singleLineMode){} + void Buffer::handleCommand(const Command &cmd){ //TODO: optimise the relayoutScreen's in this function @@ -391,7 +394,7 @@ void Buffer::show(i64 atx,i64 aty,i64 width,i64 height){ static const Style textStyle={9,9,false,false}; static const Style specialStyle={5,9,false,false}; - i64 gutterWidth=numberWidth(tb.numLines())+2; + i64 gutterWidth=singleLineMode ? 0 : numberWidth(tb.numLines())+2; i64 newWidth=width-gutterWidth; if(newWidth!=lastWidth||height!=lastHeight||screen.size()==0){ if(lastWidth==-1)performInitialLayout(newWidth,height); @@ -408,14 +411,16 @@ 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++){ - 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); + if(!singleLineMode){ + 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); + } } moveto(atx+gutterWidth,aty+y); @@ -448,3 +453,7 @@ void Buffer::show(i64 atx,i64 aty,i64 width,i64 height){ moveto(curScreenX,curScreenY); } } + +string Buffer::getText() const { + return tb.fullText(); +} |