• src/sbbs3/wordwrap.c

    From deuce@VERT to CVS commit on Monday, February 09, 2015 22:40:05
    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 Tuesday, February 10, 2015 00:34:28
    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 Friday, March 06, 2015 08:00:25
    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 Sunday, April 26, 2015 15:33:24
    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 Sunday, April 26, 2015 17:38:47
    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/DIGDIST to deuce on Sunday, April 26, 2015 22:11:14
    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/SYNCNIX to Nightfox on Monday, April 27, 2015 01:39:01
    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 Thursday, May 07, 2015 04:02:06
    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 Wednesday, July 08, 2015 23:53:49
    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 Wednesday, July 08, 2015 23:57:32
    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 Thursday, July 09, 2015 00:09:26
    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 Sunday, July 12, 2015 16:00:28
    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 Sunday, July 12, 2015 20:01:30
    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 Monday, July 13, 2015 01:33:45
    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 Tuesday, July 14, 2015 14:22:38
    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 Tuesday, July 14, 2015 14:24:05
    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 Tuesday, July 14, 2015 14:28:39
    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 Tuesday, July 14, 2015 14:34:47
    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 Tuesday, July 14, 2015 17:55:30
    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 Wednesday, July 15, 2015 01:22:28
    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 Friday, July 24, 2015 00:28:24
    src/sbbs3 wordwrap.c 1.34 1.35
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv13888

    Modified Files:
    wordwrap.c
    Log Message:
    Switch to size_t to fix warnings on Windows builds.




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From rswindell@VERT to CVS commit on Friday, July 24, 2015 16:46:42
    src/sbbs3 wordwrap.c 1.35 1.36
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv1862

    Modified Files:
    wordwrap.c
    Log Message:
    Added stupid typecast to keep the msvc debug builds from asserting when
    "high ASCII" is passed to the word-wrap function.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Tuesday, July 28, 2015 20:46:59
    src/sbbs3 wordwrap.c 1.36 1.37
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv4064

    Modified Files:
    wordwrap.c
    Log Message:
    Allow cmp_prefix() to deal with NULL bytes in the passed prefix (treated
    as a zero-length string), and don't use any prefix "stuff" when handle_quotes if not set.




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Tuesday, July 28, 2015 20:52:31
    src/sbbs3 wordwrap.c 1.37 1.38
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv4493

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

    -- "he breaks more than he fixes"



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Tuesday, July 28, 2015 20:58:35
    src/sbbs3 wordwrap.c 1.38 1.39
    Update of /cvsroot/sbbs/src/sbbs3
    In directory cvs:/tmp/cvs-serv5082

    Modified Files:
    wordwrap.c
    Log Message:
    Another issue with not handling quotes...




    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ telnet://vert.synchro.net
  • From deuce@VERT to CVS commit on Friday, December 04, 2015 01:23:18
    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 Wednesday, December 16, 2015 01:47:41
    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 Thursday, February 22, 2018 02:00:24
    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 Sunday, July 07, 2019 18:43:03
    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 Sunday, July 07, 2019 19:34:45
    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 Sunday, July 07, 2019 19:40:38
    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 Sunday, July 07, 2019 21:27:52
    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 Wednesday, July 10, 2019 15:40:35
    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 Wednesday, July 10, 2019 20:08:49
    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 Wednesday, February 17, 2021 10:55:55
    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 Friday, June 23, 2023 17:50:20
    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