<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I think I’ve found an edge case with the string transformations for line.count:<div class=""><br class=""></div><div class="">In <font face="Menlo" class="">pv_trans.c</font>, the following code does not appear to consider the last line if there are multiple lines and the last one is not terminated with <font face="Menlo" class="">\n</font>.</div><div class=""><br class=""></div><div class=""><pre style="background-color: rgb(255, 255, 255); font-family: Menlo; font-size: 9pt;" class="">case TR_LINE_COUNT:<br class="">    n=0;<br class="">    for(i=0; i<val->rs.len; i++)<br class="">        if(val->rs.s[i]=='\n')<br class="">            n++;<br class="">    if(n==0 && val->rs.len>0)<br class="">        n = 1;<br class="">    val->flags = PV_TYPE_INT|PV_VAL_INT|PV_VAL_STR;<br class="">    val->ri = n;<br class="">    val->rs.s = int2str(val->ri, &val->rs.len);<br class="">    break;<br class=""><br class=""></pre><div class="">This means that my count is always one off unless I force a blank line at the end of my string.</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Also, this code does not cater for cases where there is a different line terminator, such as CR or CRLF as is the case when the string comes from a Mac or windows system, respectively; it might be useful to have a transformation for doing that as I’ve had to hack it using <font face="Menlo" class="">s.replace</font> with hexadecimal escape codes (<font face="Menlo" class="">\r</font> and <font face="Menlo" class="">\n</font> do not work) in a variable.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">With every blessing,</div><div class="">—</div><div class="">Daniel Donoghue</div><div class=""><br class=""></div></body></html>