• Read with word-wrap

    From Dmxrob@VERT/STLWEST to All on Wed Feb 13 13:30:31 2019
    I want to read in a text string up to 160 characters. Usingãconsole.getstr(maxlen=160) it is stopping at the 80th position (for a 80x25ãscreen). Ideally what I'd like to happen is when it hits that border it wouldãjust wrap text. I've seen this behaviour before on SBBS, but before I wroteãsome javascript to try and do it myself I wanted to see if there was a built-inãmethod I'm just not seeing.ããThanks,ããRobããdmxrob þ BBSing from St. Louis, Missouri since 1988ãã---ã þ Synchronet þ Gateway to the West - St. Louis, Missouri - bbs.dmxrob.netã
  • From Mortifis@VERT/ALLEYCAT to Dmxrob on Wed Feb 13 16:53:17 2019
    I want to read in a text string up to 160 characters. Usingã > console.getstr(maxlen=160) it is stopping at the 80th position (for a 80x25ã > screen). Ideally what I'd like to happen is when it hits that border itã > would just wrap text. I've seen this behaviour before on SBBS, but before Iã > wrote some javascript to try and do it myself I wanted to see if there was aã > built-in method I'm just not seeing.ãã > Thanks,ãã > RobããNot sure if this will help, but in the web/msgs/reply.ssjs there is a block:ããtemplate.body=msgbase.get_msg_body(false,parseInt(http_request.query.reply_to),ãtrue);ãif(this.word_wrap != undefined) {ã // quote_msg adds three chars to each line. Re-wrap to 76 chars...ã // with the extra three, we're still under 80 *.ã template.body=quote_msg(word_wrap(template.body,76),79);ã}ãelse {ã template.body=template.body.replace(/^(.)/mg,"> $1");ã}ããmight get you started on a solutionãã---ã þ Synchronet þ AlleyCat! BBS -
    http://alleycat.synchro.net:81ã
  • From Digital Man@VERT to Dmxrob on Wed Feb 13 18:11:08 2019
    Re: Read with word-wrapã By: Dmxrob to All on Wed Feb 13 2019 01:30 pmãã > I want to read in a text string up to 160 characters. Usingã > console.getstr(maxlen=160) it is stopping at the 80th position (for a 80x25ã > screen). Ideally what I'd like to happen is when it hits that border itã > would just wrap text.ããWhen reading the last column, terminal behavior is not predictable (someãterminals will auto-wrap and others may not) - so getstr() avoids using theãlast column. v3.16 and older versions of SBBS would not check the maxlenãargument and may cause the terminal to autowrap (again, depending on theãterminal) but this would also cause problems with editing the text enteredãbefore the wrap (backspace, etc.) and the BBS's idea of what the user is seeingãor not seeing would get out of sync.ãã > I've seen this behaviour before on SBBS, but before Iã > wrote some javascript to try and do it myself I wanted to see if there was aã > built-in method I'm just not seeing.ããIf you want to support multiple lines of input, the K_WRAP mode flag forãgetstr() is probably what you want to use. It'll store (in a temporary buffer)ãwhatever text caused a wrap and use it in the next call to getstr(). So youãcould call getstr(79, K_WRAP), then getstr(79) to 2 lines of 158 chars totalã(for example).ããThere is no right-to-left type scrolling supported by getstr() for enteringãlines wider than the terminal, but that would be a good/useful feature to haveã(ala long string input in SCFG/echocfg/etc.).ãã digital manããThis Is Spinal Tap quote #25:ãViv Savage: Have... a good... time... all the time. That's my philosophy.ãNorco, CA WX: 50.0øF, 82.0% humidity, 2 mph SW wind, 0.03 inches rain/24hrsã---ã þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.netã