• src/sbbs3/wordwrap.c

    From deuce@VERT to CVS commit on Mon Feb 9 22:40:05 2015
    src/sbbs3 wordwrap.c 1.16 1.17
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv3059

    Modified Files:
    wordwrap.c
    Log Message:
    Fix wrapping of lines longer than the wrap width. Do no break them to start their own line, instead, just break them at the end of the line and continue.

    Also, fix a bug where the intended "check next character" test was actually checking the last characer.

    Finally, use a common slightly wrong word-length calculating function rather than custom-rolled mildly wrong stuff in-line.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Tue Feb 10 00:34:28 2015
    src/sbbs3 wordwrap.c 1.17 1.18
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv4941

    Modified Files:
    wordwrap.c
    Log Message:
    More fixin' for the last commit... we need to fall-through from a soft CR
    into the wrapping bits since we've added a space.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From rswindell@VERT to CVS commit on Fri Mar 6 08:00:25 2015
    src/sbbs3 wordwrap.c 1.18 1.19
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv4747

    Modified Files:
    wordwrap.c
    Log Message:
    More stupid MS debug-assertion-in-isdigit avoidance.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Sun Apr 26 15:33:24 2015
    src/sbbs3 wordwrap.c 1.19 1.20
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv12551

    Modified Files:
    wordwrap.c
    Log Message:
    If we chop, make the next newline a hard CR.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Sun Apr 26 17:38:47 2015
    src/sbbs3 wordwrap.c 1.20 1.21
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv15125

    Modified Files:
    wordwrap.c
    Log Message:
    Reset icol on any LF, not just "hard CRs". This should fix the problems seen by access_d. Broken since v1.18 on Feb. 10th, 2015.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From Nightfox@VERT to deuce on Sun Apr 26 22:11:14 2015
    Re: src/sbbs3/wordwrap.c
    By: deuce to CVS commit on Sun Apr 26 2015 17:38:47

    Modified Files:
    wordwrap.c
    Log Message:
    Reset icol on any LF, not just "hard CRs". This should fix the problems seen by access_d. Broken since v1.18 on Feb. 10th, 2015.

    Hi Deuce - Just wondering if this change also has an effect on the JS word_wrap() function? I noticed that message text wrapped using word_wrap() in JS look the same as with Synchronet's built-in reader.

    Nightfox

    ---
    þ Synchronet þ Digital Distortion BBS - digitaldistortionbbs.com
  • From Deuce@VERT to Nightfox on Mon Apr 27 01:39:01 2015
    Re: src/sbbs3/wordwrap.c
    By: Nightfox to deuce on Sun Apr 26 2015 10:11 pm

    Hi Deuce - Just wondering if this change also has an effect on the JS word_wrap() function? I noticed that message text wrapped using word_wrap() in JS look the same as with Synchronet's built-in reader.

    Yes, the JS word_wrap() calls the wordwrap() function in wordwrap.c.

    Synchronet's built-in reader calls wordwrap() now, so they should look the same.

    ---
    http://DuckDuckGo.com/ a better search engine that respects your privacy.
    þ Synchronet þ My Brand-New BBS (All the cool SysOps run STOCK!)
  • From deuce@VERT to CVS commit on Thu May 7 04:02:06 2015
    src/sbbs3 wordwrap.c 1.21 1.22
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv19784

    Modified Files:
    wordwrap.c
    Log Message:
    Fix off-by-one error checking if the first word of the next line would have
    fit on the current line.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Wed Jul 8 23:53:49 2015
    src/sbbs3 wordwrap.c 1.22 1.23
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv28503

    Modified Files:
    wordwrap.c
    Log Message:
    Don't add a space to the beginning of a line when unwrapping a soft CR.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Wed Jul 8 23:57:32 2015
    src/sbbs3 wordwrap.c 1.23 1.24
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv28567

    Modified Files:
    wordwrap.c
    Log Message:
    Fix last commit... the "beginning of a line" is after the prefix.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Thu Jul 9 00:09:26 2015
    src/sbbs3 wordwrap.c 1.24 1.25
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv28678

    Modified Files:
    wordwrap.c
    Log Message:
    Make the ugly-usage HARD_CR macro do all the stuff a good hard CR does.
    Lines made up entirely of whitespace always end with a hard CR.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Sun Jul 12 16:00:28 2015
    src/sbbs3 wordwrap.c 1.25 1.26
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv19630

    Modified Files:
    wordwrap.c
    Log Message:
    More fixups...



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Sun Jul 12 20:01:30 2015
    src/sbbs3 wordwrap.c 1.26 1.27
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv23854

    Modified Files:
    wordwrap.c
    Log Message:
    Overhaul the wordwrap() function.

    The old code unwrapped from the old width and rewrapped to the new width in
    a single pass. While this was more efficient, it was very difficult to work
    on and understand the code.

    Now, wordwrap() is a two pass process. The first pass unwraps "paragraphs" (defined as being the text between two hard CRs) and the second pass wraps
    to the new width. This makes it simpler to understand and debug.

    This fixes some odd wrapping issues when quoting messages.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Mon Jul 13 01:33:45 2015
    src/sbbs3 wordwrap.c 1.27 1.28
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv27183

    Modified Files:
    wordwrap.c
    Log Message:
    Fix memory leak in wordwrap() where the paragraph array was never free()d.

    Add a great deal of comments for future-Deuce.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Tue Jul 14 14:22:38 2015
    src/sbbs3 wordwrap.c 1.28 1.29
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv20943

    Modified Files:
    wordwrap.c
    Log Message:
    Fix parsing of prefx that ends the line... ie: " >\r\n" since it doesn't have padding after it, it wasn't previously considered the same prefix.

    Fix prefix comparison by adding a function for it.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Tue Jul 14 14:24:05 2015
    src/sbbs3 wordwrap.c 1.29 1.30
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv20962

    Modified Files:
    wordwrap.c
    Log Message:
    Fix bug in last commit.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Tue Jul 14 14:28:39 2015
    src/sbbs3 wordwrap.c 1.30 1.31
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv21031

    Modified Files:
    wordwrap.c
    Log Message:
    All overly-long input lines end in a hard CR now.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Tue Jul 14 14:34:47 2015
    src/sbbs3 wordwrap.c 1.31 1.32
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv21236

    Modified Files:
    wordwrap.c
    Log Message:
    When chopping a long word to fit, take the leading whitespace into account.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Tue Jul 14 17:55:30 2015
    src/sbbs3 wordwrap.c 1.32 1.33
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv23930

    Modified Files:
    wordwrap.c
    Log Message:
    Write to the *new* line length, not the old one (doh!)



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Wed Jul 15 01:22:28 2015
    src/sbbs3 wordwrap.c 1.33 1.34
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv5552

    Modified Files:
    wordwrap.c
    Log Message:
    Bring back the "Only use CRs in the output if they're in the input" feature.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Fri Dec 4 01:23:18 2015
    src/sbbs3 wordwrap.c 1.40 1.41
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv2608

    Modified Files:
    wordwrap.c
    Log Message:
    Don't use strlen() every time you append to an "infinite line length paragraph"... track the length instead.

    Speeds up word_wrap() with huge messages that don't have many paragraphs.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Wed Dec 16 01:47:41 2015
    src/sbbs3 wordwrap.c 1.41 1.42
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv16938

    Modified Files:
    wordwrap.c
    Log Message:
    Clamp the initial paragraph allocation size to 4k rather than whatever the
    old line length was. Some usage specifies a huge old line length (such as 1<<30) to indicate that it's already one line perparagraph. In thise case, word_unwrap() would allocate oldlen+1 bytes to store the paragraph data in regardless of it never really being that long.

    Also, check the return value of word_unwrap(). Not checking it caused a ` crash with triggered finding the above mentioned bug.




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From rswindell@VERT to CVS commit on Thu Feb 22 02:00:24 2018
    src/sbbs3 wordwrap.c 1.42 1.43
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv6804

    Modified Files:
    wordwrap.c
    Log Message:
    Remove stale copyright date.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Fri Apr 5 14:44:34 2019
    src/sbbs3 wordwrap.c 1.43 1.44
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv640

    Modified Files:
    wordwrap.c
    Log Message:
    There appears to be a few places in this file that treat ^A^A as a literal Ctrl-A (ASCII 1) char. This is wrong. A literal Ctrl-A sequence is ^AA.
    I'm only addressing one of those instances in this commit since it *also* appears to be an off-by-one bug where it's treating *all* Ctrl-A sequences as though they were ^AA - so just #ifdef'ing out until Deuce takes a look at this.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Sun Jul 7 18:43:03 2019
    src/sbbs3 wordwrap.c 1.44 1.45
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv743

    Modified Files:
    wordwrap.c
    Log Message:
    Treat the "Conditional line-break" Ctrl-A code as the end of a word.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Sun Jul 7 19:34:45 2019
    src/sbbs3 wordwrap.c 1.45 1.46
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv1884

    Modified Files:
    wordwrap.c
    Log Message:
    Remove the special treatment of Ctrl-A/Ctrl-A:
    1. it didn't work (in the #if 0 block) because of checking the same char twice 2. Ctrl-A/Ctrl-A is no more special than Ctrl-A/Ctrl-B or Ctrl-A/Ctrl-Z
    (I think Deuce was thinking of Ctrl-A/A, but there are other printing
    Ctrl-A codes too, e.g. Ctrl-A/z).


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Sun Jul 7 19:40:38 2019
    src/sbbs3 wordwrap.c 1.46 1.47
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv9438

    Modified Files:
    wordwrap.c
    Log Message:
    0x1f is "Unit Separator" (US) in ASCII, not Delete (DEL).
    I'm assuming Deuce meant to type '\x7f' instead of '\x1f'.
    Replaced '\x1f' with the unambiguous DEL macro.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Sun Jul 7 21:27:52 2019
    src/sbbs3 wordwrap.c 1.47 1.48
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv23338

    Modified Files:
    wordwrap.c
    Log Message:
    wordwrap() now detects and supports UTF-8 encoded text.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Wed Jul 10 15:40:35 2019
    src/sbbs3 wordwrap.c 1.49 1.50
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv8677

    Modified Files:
    wordwrap.c
    Log Message:
    Fix bug introduced in r1.46: was counting (most) Ctrl-A codes as a single char rather than no char, when calculating word lengths. We needed that 'continue' here.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Wed Jul 10 20:08:49 2019
    src/sbbs3 wordwrap.c 1.50 1.51
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/home/rswindell/sbbs/src/sbbs3

    Modified Files:
    wordwrap.c
    Log Message:
    <Deuce> Looks like it's the memcpy writing two bytes into a place it shouldn't. <Deuce> Easiest fix would be to have outbuf_append adjust outlen to be "long enough" if doubling isn't.
    <Deuce> /* Not enough room, double the size. */
    <Deuce> *outlen *= 2;
    <Deuce> if(*outp - *outbuf + len >= *outlen)
    <Deuce> *outlen = *outp - *outbuf + len + 1
    <Deuce> So yeah, blindly doubling won't work for utf-8.
    <Deuce> Because a line will have more bytes than the number of characters in a line.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to Git commit to main/sbbs/master on Wed Feb 17 10:55:55 2021
    https://gitlab.synchro.net/main/sbbs/-/commit/20f7606022783313c57e61f6
    Modified Files:
    src/sbbs3/wordwrap.c
    Log Message:
    Fix CID 174276 various malloc()/realloc() failure handling

    Have free_paragraphs() explicitly allow paragraphs to be NULL and
    have everything use the fail_return which now free()s ret.
    ---
    ï¿­ Synchronet ï¿­ Vertrauen ï¿­ Home of Synchronet ï¿­ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on ChromeOS)@VERT to Git commit to main/sbbs/master on Fri Jun 23 17:50:20 2023
    https://gitlab.synchro.net/main/sbbs/-/commit/68b2fa751eadf95750306077
    Modified Files:
    src/sbbs3/wordwrap.c
    Log Message:
    Sanity-check the oldlen argument value to wordwrap()

    If the oldlen param value is less than one, set to a sane non-zero value (79). Fix issue #576
    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net