diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2013-12-20 22:09:32 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2013-12-20 22:09:32 +0100 |
commit | 59152a34666d43575fe2f0bb7c11ef285c9be51f (patch) | |
tree | 54ae214efb56706c0e2c647b65dfcad3828d690e /Src/Zle/zle_refresh.c | |
parent | 3e96d261c83af40534acbf79c5d236ecf38af9fe (diff) | |
parent | 58614f16693a741396840fbb3db0f9ba1e53cfcb (diff) | |
download | zsh-59152a34666d43575fe2f0bb7c11ef285c9be51f.tar.gz zsh-59152a34666d43575fe2f0bb7c11ef285c9be51f.zip |
New upstream release
Diffstat (limited to 'Src/Zle/zle_refresh.c')
-rw-r--r-- | Src/Zle/zle_refresh.c | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index 17b78ce59..fd5485770 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -976,7 +976,8 @@ zrefresh(void) int tmppos; /* t - tmpline */ int tmpalloced; /* flag to free tmpline when finished */ int remetafy; /* flag that zle line is metafied */ - int txtchange; /* attributes set after prompts */ + int txtchange; /* attributes set after prompts */ + int rprompt_off; /* Offset of rprompt from right of screen */ struct rparams rpms; #ifdef MULTIBYTE_SUPPORT int width; /* width of wide character */ @@ -1573,10 +1574,19 @@ zrefresh(void) if (!more_start) { if (trashedzle && opts[TRANSIENTRPROMPT]) put_rpmpt = 0; - else + else { put_rpmpt = rprompth == 1 && rpromptbuf[0] && - !strchr(rpromptbuf, '\t') && - (int)ZR_strlen(nbuf[0]) + rpromptw < winw - 1; + !strchr(rpromptbuf, '\t'); + if (put_rpmpt) + { + rprompt_off = rprompt_indent; + /* sanity to avoid horrible things happening */ + if (rprompt_off < 0) + rprompt_off = 0; + put_rpmpt = + (int)ZR_strlen(nbuf[0]) + rpromptw < winw - rprompt_off; + } + } } else { /* insert >.... on first line if there is more text before start of screen */ ZR_memset(nbuf[0], zr_sp, lpromptw); @@ -1631,9 +1641,9 @@ zrefresh(void) if (put_rpmpt && !iln && !oput_rpmpt) { int attrchange; - moveto(0, winw - 1 - rpromptw); + moveto(0, winw - rprompt_off - rpromptw); zputs(rpromptbuf, shout); - vcs = winw - 1; + vcs = winw - rprompt_off; /* reset character attributes to that set by the main prompt */ txtchange = pmpt_attr; /* @@ -2113,19 +2123,24 @@ moveto(int ln, int cl) const REFRESH_ELEMENT *rep; if (vcs == winw) { - vln++, vcs = 0; - if (!hasam) { - zputc(&zr_cr); - zputc(&zr_nl); + if (rprompt_indent == 0 && tccan(TCLEFT)) { + tc_leftcurs(1); + vcs--; } else { - if ((vln < nlnct) && nbuf[vln] && nbuf[vln]->chr) - rep = nbuf[vln]; - else - rep = &zr_sp; - zputc(rep); - zputc(&zr_cr); - if ((vln < olnct) && obuf[vln] && obuf[vln]->chr) - *obuf[vln] = *rep; + vln++, vcs = 0; + if (!hasam) { + zputc(&zr_cr); + zputc(&zr_nl); + } else { + if ((vln < nlnct) && nbuf[vln] && nbuf[vln]->chr) + rep = nbuf[vln]; + else + rep = &zr_sp; + zputc(rep); + zputc(&zr_cr); + if ((vln < olnct) && obuf[vln] && obuf[vln]->chr) + *obuf[vln] = *rep; + } } } |