|
Lines 54-60
Link Here
|
| 54 |
Hashtable lineStyles, Hashtable bidiSegments, |
54 |
Hashtable lineStyles, Hashtable bidiSegments, |
| 55 |
int tabLength, Rectangle clientArea) { |
55 |
int tabLength, Rectangle clientArea) { |
| 56 |
super(device, regularFont); |
56 |
super(device, regularFont); |
| 57 |
this.logicalContent = logicalContent; |
57 |
this.logicalContent = prefixLineNumbers(logicalContent); |
| 58 |
this.lineBackgrounds = lineBackgrounds; |
58 |
this.lineBackgrounds = lineBackgrounds; |
| 59 |
this.lineStyles = lineStyles; |
59 |
this.lineStyles = lineStyles; |
| 60 |
this.bidiSegments = bidiSegments; |
60 |
this.bidiSegments = bidiSegments; |
|
Lines 62-68
Link Here
|
| 62 |
this.gc = gc; |
62 |
this.gc = gc; |
| 63 |
calculateLineHeight(); |
63 |
calculateLineHeight(); |
| 64 |
setTabLength(tabLength); |
64 |
setTabLength(tabLength); |
| 65 |
content = new WrappedContent(this, logicalContent); |
65 |
content = new WrappedContent(this, this.logicalContent); |
| 66 |
// wrapLines requires tab width to be known |
66 |
// wrapLines requires tab width to be known |
| 67 |
content.wrapLines(); |
67 |
content.wrapLines(); |
| 68 |
} |
68 |
} |
|
Lines 264-267
Link Here
|
| 264 |
protected boolean isFullLineSelection() { |
264 |
protected boolean isFullLineSelection() { |
| 265 |
return false; |
265 |
return false; |
| 266 |
} |
266 |
} |
|
|
267 |
|
| 268 |
protected StyledTextContent prefixLineNumbers(StyledTextContent logicalContent) |
| 269 |
{ |
| 270 |
StyledTextContent content = logicalContent; |
| 271 |
String nl = content.getLineDelimiter(); |
| 272 |
int lineNumLenMax = String.valueOf(content.getLineCount()).length(); |
| 273 |
int newCharCount = content.getCharCount() |
| 274 |
+ (content.getLineCount() * (lineNumLenMax + 2)); |
| 275 |
StringBuffer buf = new StringBuffer(newCharCount + 16); |
| 276 |
|
| 277 |
for (int i = 0; i < content.getLineCount(); i++) { |
| 278 |
String lineNum = String.valueOf(i + 1); |
| 279 |
for (int j = 0; j < (lineNumLenMax - lineNum.length()); j++) { |
| 280 |
buf.append(" "); |
| 281 |
} |
| 282 |
buf.append(lineNum); |
| 283 |
buf.append(" "); |
| 284 |
buf.append(content.getLine(i)); |
| 285 |
buf.append(nl); |
| 286 |
} |
| 287 |
|
| 288 |
content.setText(buf.toString()); |
| 289 |
return content; |
| 290 |
} |
| 267 |
} |
291 |
} |