Fossil

History of src/comformat.c of 8ccedde4c6b4bdd5
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

History of file src/comformat.c at check-in 8ccedde4c6b4bdd5

2025-12-23
16:06
Assorted fixes of typos and grammar in code comments. No functional changes. file: [e28d054cbc] check-in: [e2bdc10572] user: danield branch: trunk, size: 31625
2025-12-05
15:35
Import the recent changes to the sqlite3_qrf_wcwidth() function from SQLite check-in [https://sqlite.org/src/info/35f39f7cb1|35f39f7cb1] to cli_wcwidth() for feature parity. file: [33eed34a0f] check-in: [98287b7b05] user: florian branch: trunk, size: 31625
2025-09-21
04:16
Fix an out-of-bounds array access in the function to decode a UTF-8 sequence (similar to a problem reported on the SQLite Forum: https://sqlite.org/forum/forumpost/184b372388). file: [71069fe975] check-in: [59879abe16] user: florian branch: trunk, size: 31656
2025-07-23
15:58
Minor optimization: replace calls to mprintf("%s", X) with fossil_strdup(X). file: [cc02fc5b7e] check-in: [4c3e1728e1] user: danield branch: trunk, size: 31656
2025-03-21
18:31
Enhance the html_to_plaintext() routine with a flags argument so that it can take over the job previously done by search_snippet_to_plaintext(). file: [f21be09a54] check-in: [fd59eb178b] user: drh branch: trunk, size: 31656
2025-03-03
14:25
Rework the command-line arguments to the "fossil test-comment-format" command. file: [1a354d3e4f] check-in: [2b2bc057f6] user: drh branch: trunk, size: 31621
13:34
Fix misspelled "--canonical" option on "fossil test-comment-format". file: [ddb4c824cf] check-in: [9813e6f85d] user: drh branch: trunk, size: 31166
12:07
Change the "legacy comment printing algorithm" to the "canonical comment printing algorithm". Omit the --comfmtflags and --comment-format global flags. Simplify the comment printing code. file: [dde639e5d0] check-in: [35302d9e50] user: drh branch: trunk, size: 31165
2025-02-27
12:22
Fix a bug in comment_print() discovered by the fuzzer enhancement of the previous check-in. This bug has existed for a long time and is not the result of recent changes. file: [2fc0384966] check-in: [8ccedde4c6] user: drh branch: trunk, size: 29863
2025-02-26
21:03
Fix the comment formatter so that it does not crash with ill-formatted VT100 escapes. file: [47ef4bbf3c] check-in: [2aa79ed752] user: drh branch: trunk, size: 29825
18:07
Enhance the comment_print() subroutine so that it understands that VT100 escape codes are zero-width characters, and allocates text to lines accordingly. file: [6de05a9ee1] check-in: [32f954a1f2] user: drh branch: trunk, size: 29779
2024-10-06
04:23
Restore an error handling path deleted by an optimization. file: [dc2c4c667d] check-in: [cc8a3116d1] user: florian branch: comment-formatter-wcwidth, size: 29303
2024-10-05
13:27
Fix some compiler warnings reported by clang 17.0.6 on FreeBSD. file: [46534203db] check-in: [b9e34fa9d2] user: florian branch: comment-formatter-wcwidth, size: 29200
13:06
Try two optimizations (to be reverted after further measurements, if they don't pay off): (0) Abort forward scanning for space characters as soon as the scanned characters don't fit on the current line. (1) Shortcut for ASCII characters on UTF-8 string analysis. file: [6c6afe6a2a] check-in: [4e8dd7df46] user: florian branch: comment-formatter-wcwidth, size: 30024
2024-10-02
14:47
Update the comment for the code copied from the SQLite shell. file: [2d5f1cd84f] check-in: [d98999f801] user: florian branch: comment-formatter-wcwidth, size: 29818
14:45
Have the `test-comment-format' command call `verify_all_options()' to report unknown command-line options. file: [6bf11474b2] check-in: [fb0845d1aa] user: florian branch: comment-formatter-wcwidth, size: 29818
14:43
Fix the off-by-one errors if a fullwidth character only fits partially, and take into account character widths when scanning forward to find the distance to the next space. file: [b44e5e9b02] check-in: [d5479ba7c6] user: florian branch: comment-formatter-wcwidth, size: 29794
2024-09-30
18:21
Fix the unicode code-point width estimating function to align with the SQLite CLI. file: [e8203b0d28] check-in: [e483b3b15f] user: drh branch: trunk, size: 29634
2024-09-28
18:19
Copy the wcwidth() implementation from SQLite over into comformat.c, so that comformat.c does not depend on SQLite. Fix the comformat routine so that it does not begin a new line with spaces. file: [9a78e4ddc8] check-in: [7b581b48a0] user: drh branch: comment-formatter-wcwidth, size: 29754
2024-09-27
04:52
Quick test whether the `cli_wcwidth()' function [https://sqlite.org/src/vdiff?branch=variable-width-char | recently added to the SQLite shell] can be used by the comment formatter to take character widths into account when calculating word-break positions. TODOs: (0) Fix the "modern" (i.e. non-legacy) comment formatter being off by one if a fullwidth character only fits partially. (1) Add tests for the comment formatters with non-ASCII input. (2) Implement a modified `decodeUtf8()' function (which is static, anyway) that also accepts single-byte UTF-8 characters and may allow for some simplifications to the comment formatter algorithms. file: [e944c9c701] check-in: [b2dbdc8afb] user: florian branch: comment-formatter-wcwidth, size: 22589
2024-01-09
17:04
Fix an off-by-one error in the text line-break algorithm of comformat.c. file: [1a178e0c15] check-in: [eb2100db42] user: drh branch: trunk, size: 22321
2023-02-17
14:37
A large collection of compiler warning fixes re. signed/unsigned comparison from Daniel D. file: [be18377aa1] check-in: [c71f711ec9] user: stephan branch: compiler-warnings, size: 22320
2023-01-09
13:06
Further consistency improvements in docs for various commands. file: [97d5b986e4] check-in: [2512d2d472] user: km branch: trunk, size: 22300
2022-10-18
17:01
Minor comment reformatting. file: [d746b2c378] check-in: [0df4abc74b] user: stephan branch: trunk, size: 22306
16:55
Cache get_comment_format() result to avoid that the global config db is queried once per timeline row, which brings fossil to a standstill when ~/ is NFS-mounted. Discussion in [forum:9aaefe4e536e01bf]. file: [4a6b420128] check-in: [6e62c8510f] user: stephan branch: trunk, size: 22306
2020-08-25
06:32
Fix HTML formatting issues with a few built-in help pages. file: [649d55a2d8] check-in: [11384f1874] user: drh branch: trunk, size: 22031
2020-05-05
00:41
diff -y: set the default width automatically based on the terminal width. file: [a2e181ecf3] check-in: [3504672187] user: ashepilko branch: trunk, size: 22031
2020-04-05
23:45
Match the COMMAND and WEBPAGE names with _cmd and _page functions; [https://fossil-scm.org/forum/forumpost/045bffda68|forumpost/045bffda68] file: [0fa2382463] check-in: [06afb7022f] user: ashepilko branch: api-cleanup, size: 22439
2019-01-27
15:38
Add the global --comment-format command-line option as an alias for --comfmtflags. file: [e9fe5da3fa] check-in: [a0d10b91f7] user: florian branch: comment-format-setting, size: 22435
15:35
Add the "comment-format" setting to set the default options for printing timeline comments to the console, as discussed here: [https://fossil-scm.org/forum/forumpost/d9954370c7]. file: [9cf5cabd2f] check-in: [bc62fa1710] user: florian branch: comment-format-setting, size: 22410
2018-11-28
23:43
Minor stylistic changes to the comment formatter. file: [e97f8902b5] check-in: [cc9c422d83] user: drh branch: comment-formatter-utf8, size: 21342
2018-11-24
07:49
Minor optimizations: drop a few redundant comparisons and calculations, and take advantage of the logical AND short-circuit by testing the least expensive and most unlikely condition first. Also fold away the iterative comments into cross references. file: [5d847583fb] check-in: [490d38ff2e] user: florian branch: comment-formatter-utf8, size: 21330
07:16
Fix two bugs (introduced with this branch) that become manifest with invalid UTF-8 sequences. file: [cf4a82f353] check-in: [b86a2fc7eb] user: florian branch: comment-formatter-utf8, size: 22191
2018-11-16
19:39
Fix a bug (already present on trunk) with the (non-legacy) comment printing algorithm, detected while running the regression tests from test/comment.test with UTF-8 text: the function to print the indent (modified to a calculate-only function on this branch) was handed a pointer to the current line index and the current line index, thus performing checks at (current line index * 2), causing random increments of the current line index. file: [8e984136d0] check-in: [70dd8f744f] user: florian branch: comment-formatter-utf8, size: 22151
14:02
More coding style fixes. file: [ec7e42fc49] check-in: [2dca9b82d9] user: florian branch: comment-formatter-utf8, size: 22184
11:26
Coding style fixes. file: [52c3a79604] check-in: [aadbbb38d6] user: florian branch: comment-formatter-utf8, size: 22193
11:14
For better word breaking results with the (non-legacy) comment printing algorithm, make sure the lookahead to the next space character is UTF-8-aware. Also make sure the per-line remaining character count is decremented properly for UTF-8 sequences. The neuralgic points now handle UTF-8 sequences correctly, and they could be enhanced to work with the effective display width, if required (to handle combining characters, and East Asian Wide and Fullwidth characters). file: [d3b5101eae] check-in: [c9ec3d1886] user: florian branch: comment-formatter-utf8, size: 22199
2018-11-15
15:32
Ensure the line buffer for the legacy comment printing algorithm can hold maximum-length UTF-8 sequences. file: [67acfea24d] check-in: [29d3a2ed4e] user: florian branch: comment-formatter-utf8, size: 20468
15:16
Fix a problem with initial indent introduced by the previous check-in, so that all regression tests from test/comment.test now succeed. Also eliminate three more calls to fossil_print(). Regarding performance, the legacy comment printing algorithm is outnumbered by factor 2-3, with these changes. file: [d99410c0c4] check-in: [b029ed2222] user: florian branch: comment-formatter-utf8, size: 20389
12:43
Add output buffering to the (non-legacy) comment printing algorithm, to reduce calls to fossil_print(). The resulting performance improvement can be up to factor 10, with a perceptible difference even for short comments (measured and tested on Windows with MSVC builds, and on Ubuntu with GCC builds). (For comparison: for the legacy comment printing algorithm, the extra UTF-8 checks added by this branch impair performance by 0.12-1.8%, depending on whether the input contains predominantly multi-byte vs. ASCII-only sequences.) file: [d0f31fe1eb] check-in: [16fde3ff66] user: florian branch: comment-formatter-utf8, size: 19941
2018-10-17
14:16
Modify the comment formatter to avoid output of incomplete UTF-8 sequences, and to avoid line breaks inside UTF-8 sequences. See [https://fossil-scm.org/forum/forumpost/1247e4a3c4] for detailed information and tests. file: [d6da53c0cb] check-in: [1bbca2c3f8] user: florian branch: comment-formatter-utf8, size: 19408
2017-11-30
17:58
Refactor the symlink processing logic so that most of the file access routines take a new parameter indicating the conditions under which symlinks should and should not be followed. This should fix a few bugs related to symlink processing. Lots of testing required before merging to trunk. file: [4d18073b1a] check-in: [e7767de263] user: drh branch: symlink-refactor, size: 17161
2017-06-15
03:37
Fix TTY comment line break logic for UTF8 multi-byte characters. file: [ba3c29ae04] check-in: [e62161976e] user: drh branch: trunk, size: 17143
2015-04-21
07:12
Fix auto-adjust of CLI timeline to terminal width on Linux. Thanks to Warren Young for analysis and patch! file: [f570981a7b] check-in: [d32ca59282] user: jan.nijtmans branch: trunk, size: 17120
2014-10-20
15:01
Add a custom static analysis program that verifies the arguments to printf-style varargs routines used in Fossil. Adjust the source code to be more robust for printf format errors and to fix a few minor problems found by the static checker. file: [24b2de2bad] check-in: [0a7e326fa4] user: drh branch: compile-time-print-checking, size: 17154
2014-07-24
21:27
Add another flag to the new comment printing algorithm capable of stripping superfluous CR/LFs while preserving other spacing. file: [8847b181ba] check-in: [d7d265502a] user: mistachkin branch: trunk, size: 17122
20:54
Fix boundary case in the new comment printing algorithm that sometimes results in extra new lines. file: [13e999b153] check-in: [4532733830] user: mistachkin branch: trunk, size: 15831
05:56
Improve clarity of the new comment printing algorithm. file: [b07774f9b5] check-in: [8e7d2a6586] user: mistachkin branch: trunk, size: 15841
05:05
Factor out the common terminal width detection code for comment printing into a new function. file: [339895f0e8] check-in: [351de029f3] user: mistachkin branch: trunk, size: 15756
03:52
For the new comment printing algorithm, make sure to indent after forcing a line break due to the original comment text being detected. file: [5cb5620841] check-in: [856c60611f] user: mistachkin branch: trunk, size: 15829
2014-07-23
21:52
For the test-comment-format command, also treat the original comment text argument as a file name when the --file option is specified. Fix memory leaks when the --file and --decode options are used together. file: [0333000424] check-in: [378dad36ba] user: mistachkin branch: trunk, size: 15199
21:37
When available, pass the original comment text as well as the (possibly prefixed) comment into comment_print(). Add COMMENT_PRINT_ORIG_BREAK flag to the new comment printing algorithm. Change the width argument for the test-comment-format command into an option. Add --origbreak option to the test-comment-format command. file: [c438ef4aef] check-in: [0d0b80fd1c] user: mistachkin branch: trunk, size: 15004
18:26
Add --file option to the test-comment-format test command. file: [4819fffb58] check-in: [b1b352e1cc] user: mistachkin branch: trunk, size: 12789
2014-07-20
05:09
Correct usage syntax error message for the 'test-comment-format' command. file: [f3163ecf5f] check-in: [68cd1f5b59] user: mistachkin branch: experimental, size: 12493
04:24
Enhance comments that describe the new comment printing function. file: [2e2a786bce] check-in: [4a5352c25d] user: mistachkin branch: experimental, size: 12483
02:35
Add -comfmtflags command line option to set the comment printing flags, defaulting to the legacy comment printing algorithm. file: [2961f12931] check-in: [18a97b3a8f] user: mistachkin branch: experimental, size: 11067
02:10
Merge updates from trunk. file: [8cbf7419f5] check-in: [5ea6a95a7b] user: mistachkin branch: experimental, size: 11071
2014-07-10
10:01
./src/comformat.c: In function ‘comment_print’: ./src/comformat.c:70:5: warning: implicit declaration of function ‘ioctl’ [-Werror=implicit-function-declaration] if( ioctl(0, TIOCGWINSZ, &w)!=-1 ){ ^ file: [7c0c33604a] check-in: [32205fdc41] user: jan.nijtmans branch: trunk, size: 4565
2014-06-21
01:38
Add --trimspace option to the 'test-comment-format' test command. file: [e3a9141fd7] check-in: [4e3f915c00] user: mistachkin branch: experimental, size: 11013
01:32
Re-add the legacy comment printing algorithm. Currently, it is being retained primarily for testing and comparison purposes. file: [48158b1105] check-in: [0463c7bfb1] user: mistachkin branch: experimental, size: 10867
2014-06-20
19:15
Merge updates from trunk. file: [69604bb174] check-in: [fc84a01a8b] user: mistachkin branch: respectformatting, size: 4285
19:11
Add and adjust comment tests from the experimental branch. file: [8af38bff09] check-in: [2920e7df00] user: mistachkin branch: trunk, size: 4507
18:56
Reorganize the new code, making internal functions private. Add COMMENT_PRINT_TRIM_SPACE flag, on by default. file: [c8235b73b4] check-in: [856d10ae81] user: mistachkin branch: experimental, size: 7932
18:31
Further refinements and more tests. file: [f67f6c7be3] check-in: [70ba07c368] user: mistachkin branch: experimental, size: 7560
03:56
Initial draft of the ability to break a multi-line comment on word boundaries using the new algorithm. file: [71deb666ce] check-in: [10b47cc350] user: mistachkin branch: experimental, size: 7367
2014-06-19
21:25
Complete re-write of the comment printing algorithm, taking the preservation of any pre-existing formatting within the comment into account. No attempt is made to avoid breaking a line in the middle of a word. file: [c2ce9ab204] check-in: [89aa595f88] user: mistachkin branch: experimental, size: 5738
05:43
Merge updates from branch. Gracefully handle the case where the first line contains no spaces. file: [3b4fe0fa2d] check-in: [d547629280] user: mistachkin branch: experimental, size: 4477
03:04
Merge variable name change. file: [31e911e2f7] check-in: [05ea665fef] user: mistachkin branch: experimental, size: 4283
03:03
Rename the zBuf variable to zLine, to improve clarity. file: [0e8b6f0124] check-in: [b68446e291] user: mistachkin branch: respectformatting, size: 4180
02:39
Experimental changes for more precise handling of new lines. file: [12b03962df] check-in: [816faa5af9] user: mistachkin branch: experimental, size: 4274
02:39
Even more style improvements. file: [131c930f7e] check-in: [c7c3d99a60] user: mistachkin branch: respectformatting, size: 4172
01:32
Further code style improvements. file: [9237f26a09] check-in: [504b0ae080] user: mistachkin branch: respectformatting, size: 4188
01:20
Merge updates from trunk. file: [21b1905bb0] check-in: [4b675fb0e6] user: mistachkin branch: respectformatting, size: 4174
01:19
Add 'decode' option to the 'test-comment-format' test command. file: [4fdfe49443] check-in: [8da0f34462] user: mistachkin branch: trunk, size: 4402
00:48
Merge updates from trunk. file: [5f650fc6d6] check-in: [3221e519b6] user: mistachkin branch: respectformatting, size: 3731
00:47
Enhance the 'test-comment-format' test command. file: [56c032988b] check-in: [6a3b39a06b] user: mistachkin branch: trunk, size: 3959
2014-06-18
23:30
Improve clarity of presentation via several stylistic changes. file: [33208642d3] check-in: [41804ab180] user: mistachkin branch: respectformatting, size: 3508
15:07
make fossil timeline to respect the log formatting aka multiline logs. Suggested by Baptiste Daroussin. file: [9fe836e409] check-in: [10eea3abd4] user: jan.nijtmans branch: respectformatting, size: 3542
2014-06-17
22:15
On non-Windows systems that appear to lack the TIOCGWINSZ define, fallback to using the legacy behavior of hard-coding a reasonable default maximum line length. file: [77af14c142] check-in: [54cc57e7a3] user: mistachkin branch: trunk, size: 3736
20:16
Remove superfluous include and add a missing blank line. file: [d7394281f0] check-in: [4c194957c8] user: mistachkin branch: autoadjust, size: 3199
2014-06-16
21:02
Adjust width auto-detection on Windows for more reasonable line breaks when the final character is a '-'. Seen with comment for check-in [4514910a5f] and a console width of 233. file: [6dd42e5c77] check-in: [f4cab56c64] user: mistachkin branch: autoadjust, size: 3219
20:28
Improvements to error handling and code formatting. file: [7d8e9e5ffb] check-in: [9270ae240d] user: mistachkin branch: autoadjust, size: 3223
09:05
Merge trunk. Make it work on Windows too. Variable width output on more commands. file: [300c75f1a9] check-in: [40710b7a05] user: jan.nijtmans branch: autoadjust, size: 3092
2014-03-14
13:57
Enhance the "whatis" command to report on attachments and to include raw tags so that cluster artifacts are identified. Add the "test-whatis-all" command to run "whatis" on every artifact in the repository. file: [e3d453354c] check-in: [5cdc39dc2d] user: drh branch: trunk, size: 2637
2014-01-28
08:20
More removals of unnecessary end-of-line spaces. No change in code. file: [ef14fd3e1d] check-in: [45f35169f2] user: jan.nijtmans branch: trunk, size: 2602
2013-10-29
10:55
Add option -W|--width to the "fossil timeline" and "fossil finfo" commands. Defaults to 79. file: [53bb36cde3] check-in: [2eb492e282] user: jan.nijtmans branch: trunk, size: 2603
2013-10-26
09:06
Allow comment_print() to handle lines >400 characters. Add parameter "width" to print_timeline() function. file: [92c6bd1006] check-in: [b2455507cb] user: jan.nijtmans branch: trunk, size: 2646
2013-10-25
12:42
Merge trunk. Add the "-W|--width WIDTH" option to "fossil timeline". Default is 80. file: [6fec4b4b83] check-in: [3710f2ac5b] user: jan.nijtmans branch: timeline_cmd_dash_n_fix, size: 2547
2012-08-29
13:57
Allow UTF-8 characters in sources. translate.exe will translate it to ASCII file: [61d352f1cc] check-in: [9f6abc5968] user: jan.nijtmans branch: msvc-broken, size: 2515
2012-03-29
14:54
Add vim modline everywhere file: [76c82b997c] check-in: [a496d8e88d] user: mgagnon branch: mgagnon_fix, size: 2558
2011-04-27
18:21
Attempt to get Fossil working on windows systems that do not use UTF8 in the shell. file: [4c6ab3776e] check-in: [e805fa8db9] user: drh branch: windows-i18n, size: 2516
2010-10-14
19:14
Remove all use of ctypes.h in order to avoid compiler warnings and other problems associated with changing locales. file: [8591c01b2b] check-in: [2fac809165] user: drh branch: trunk, size: 2480
2010-05-16
19:08
Change from GPL to the Simplified BSD License. file: [cb5f71dc87] check-in: [c06edd231f] user: drh branch: clear-title, size: 2459
2007-07-21
14:10
Added: Initial check-in of m1 sources. file: [26c0414fd8] check-in: [dbda8d6ce9] user: drh branch: trunk, size: 2735