Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentTest.java9
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.java7
2 files changed, 13 insertions, 3 deletions
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentTest.java
index c0fa842aa..b852dac69 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/DocumentTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -105,6 +105,13 @@ public class DocumentTest extends TestCase {
fDocument= null;
}
+
+ public void testEmptyDocument() {
+ IDocument document= new Document();
+ int lines= document.getNumberOfLines();
+ assertEquals(1, lines);
+ }
+
public void testDelete1() {
try {
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.java b/org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.java
index 9da272733..d2903c9d3 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/ILineTracker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -62,7 +62,10 @@ public interface ILineTracker {
/**
* Returns the number of lines.
- *
+ * <p>
+ * Note that a document always has at least one line.
+ * </p>
+ *
* @return the number of lines in this tracker's line structure
*/
int getNumberOfLines();

Back to the top