#7601 closed enhancement (fixed)
Improvement for shorten_line
Reported by: | Owned by: | Remy Blank | |
---|---|---|---|
Priority: | low | Milestone: | 0.11.2 |
Component: | version control/log view | Version: | |
Severity: | normal | Keywords: | |
Cc: | mvaradachari@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
We've run into an unfortunate behavior or shorten_line. When a commit message starts with something like "This is in reference to 123456\n————————————————————————", shorten_line chops off the "123456" in the revision log view. This is because when it is looking for word boundaries it searches for spaces first and only searches for newlines if no spaces are found.
These patches make it always find the last whitespace character. I've included two versions that are functionally identical but use slightly different styles.
These patches are in the public domain, or under the same license as Trac, or assigned copyright to Edgewall, or whatever you want.
Attachments (2)
Change History (5)
by , 16 years ago
Attachment: | shorten-v1.patch added |
---|
by , 16 years ago
Attachment: | shorten-v2.patch added |
---|
comment:1 by , 16 years ago
Cc: | added; removed |
---|---|
Owner: | changed from | to
comment:2 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Using rsplit()
might be problematic here. From the Python documentation:
First, whitespace characters (spaces, tabs, newlines, returns, and formfeeds) are stripped from both ends. Then, words are separated by arbitrary length strings of whitespace characters. Consecutive whitespace delimiters are treated as a single delimiter ("'1 2 3'.split()" returns "['1', '2', '3']"). Splitting an empty string or a string consisting of just whitespace returns an empty list.
So an rsplit()[0]
on a string of whitespace would raise an exception.
Fixed in [7511]. Thanks for the bug report.
comment:3 by , 16 years ago
Milestone: | → 0.11.2 |
---|
I'll look into this shortly.