Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#7601 closed enhancement (fixed)

Improvement for shorten_line

Reported by: dreiss@… 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)

shorten-v1.patch (564 bytes ) - added by anonymous 16 years ago.
shorten-v2.patch (591 bytes ) - added by anonymous 16 years ago.

Download all attachments as: .zip

Change History (5)

by anonymous, 16 years ago

Attachment: shorten-v1.patch added

by anonymous, 16 years ago

Attachment: shorten-v2.patch added

comment:1 by Remy Blank, 16 years ago

Cc: mvaradachari@… added; mvarada removed
Owner: changed from mvaradachari@… to Remy Blank

I'll look into this shortly.

comment:2 by Remy Blank, 16 years ago

Resolution: fixed
Status: newclosed

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 Remy Blank, 16 years ago

Milestone: 0.11.2

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.