[Aptitude-devel] r3021 - in branches/aptitude-0.3/aptitude: . src
Daniel Burrows
dburrows@costa.debian.org
Thu, 21 Apr 2005 02:01:42 +0000
Author: dburrows
Date: Thu Apr 21 02:01:39 2005
New Revision: 3021
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/desc_parse.cc
Log:
Hardwrap performatted lines.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Thu Apr 21 02:01:39 2005
@@ -1,5 +1,10 @@
2005-04-20 Daniel Burrows <dburrows@debian.org>
+ * src/desc_parse.cc:
+
+ Include comments on how lists ought to be handled, and hardwrap
+ preformatted lines as per Policy.
+
* src/vscreen/fragment.cc, src/vscreen/fragment.h, src/vscreen/testvscreen.cc:
Add a "hardwrapbox" which wraps lines hard to the fragment's
Modified: branches/aptitude-0.3/aptitude/src/desc_parse.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/desc_parse.cc (original)
+++ branches/aptitude-0.3/aptitude/src/desc_parse.cc Thu Apr 21 02:01:39 2005
@@ -11,6 +11,21 @@
using namespace std;
+// Notes on bulletting:
+//
+// A line beginning with two or more spaces, followed by a bullet
+// character and a space, is considered to be an element of a bulleted
+// list. Every succeeding line that begins with N+1 or more spaces,
+// where N is the number of spaces preceding the bullet, is considered
+// to be part of the same bulleted list, and is processed as if N+1
+// spaces had been stripped from its left margin, with the exception
+// that if the N+2nd character is not a space, the line is formatted
+// as if a leading space were present. (see below)
+//
+// Bullet characters are (maybe) "-", "+", and "*"; the
+// frontend may render them literally or modify their appearence as it
+// deems appropriate.
+
fragment *make_desc_fragment(string desc)
{
string::size_type loc=0;
@@ -38,7 +53,6 @@
switch(desc[loc])
{
case ' ':
- // preformatted:
{
++loc;
@@ -46,9 +60,8 @@
while(loc+amt<desc.size() && desc[loc+amt]!='\n')
++amt;
- // For now, clip it -- although I think that there may be
- // some merit in wrapping overlong preformatted lines.
- fragments.push_back(clipbox(text_fragment(string(desc, loc, amt))));
+ // Hard-wrap AS REQUIRED BY POLICY.
+ fragments.push_back(hardwrapbox(text_fragment(string(desc, loc, amt))));
loc+=amt;
if(loc<desc.size())