mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-08 01:10:23 +00:00
[ncman] print substituted macros
This commit is contained in:
parent
358a6306da
commit
32fd9a4478
@ -593,6 +593,7 @@ putpara(struct ncplane* p, const char* text){
|
||||
// cur indicates where the current text to be displayed starts.
|
||||
const char* cur = text;
|
||||
uint16_t style = 0;
|
||||
const char* posttext = NULL;
|
||||
while(*cur){
|
||||
b = 0;
|
||||
// find the next style marker
|
||||
@ -644,7 +645,7 @@ putpara(struct ncplane* p, const char* text){
|
||||
const char* macend = NULL;
|
||||
for(typeof(&*macros) m = macros ; m->tr ; ++m){
|
||||
if(strncmp(curend, m->macro, strlen(m->macro)) == 0){
|
||||
// FIXME emit thus far, write tr
|
||||
posttext = m->tr;
|
||||
macend = curend + strlen(m->macro);
|
||||
break;
|
||||
}
|
||||
@ -664,6 +665,12 @@ putpara(struct ncplane* p, const char* text){
|
||||
if(puttext(p, cur, textend) < 0){
|
||||
return -1;
|
||||
}
|
||||
if(posttext){
|
||||
if(puttext(p, posttext, posttext + strlen(posttext)) < 0){
|
||||
return -1;
|
||||
}
|
||||
posttext = NULL;
|
||||
}
|
||||
cur = curend;
|
||||
ncplane_set_styles(p, style);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user