comparison dwtx/jface/text/Document.d @ 161:f8d52b926852

...
author Frank Benoit <benoit@tionex.de>
date Wed, 27 Aug 2008 14:49:30 +0200
parents 6dcb0baaa031
children
comparison
equal deleted inserted replaced
160:3678e4f1a766 161:f8d52b926852
176 * </p> 176 * </p>
177 * <p> 177 * <p>
178 * See {@link GapTextStore} and <code>TreeLineTracker</code> for algorithmic behavior of the used 178 * See {@link GapTextStore} and <code>TreeLineTracker</code> for algorithmic behavior of the used
179 * document structures. 179 * document structures.
180 * </p> 180 * </p>
181 * 181 *
182 * @see dwtx.jface.text.GapTextStore 182 * @see dwtx.jface.text.GapTextStore
183 * @see dwtx.jface.text.CopyOnWriteTextStore 183 * @see dwtx.jface.text.CopyOnWriteTextStore
184 */ 184 */
185 public class Document : AbstractDocument { 185 public class Document : AbstractDocument {
186 /** 186 /**
218 return isLineInformationRepairNeeded(text) || isLineInformationRepairNeeded(get(offset, length)); 218 return isLineInformationRepairNeeded(text) || isLineInformationRepairNeeded(get(offset, length));
219 } 219 }
220 220
221 /** 221 /**
222 * Checks whether the line information needs to be repaired. 222 * Checks whether the line information needs to be repaired.
223 * 223 *
224 * @param text the text to check 224 * @param text the text to check
225 * @return <code>true</code> if the line information must be repaired 225 * @return <code>true</code> if the line information must be repaired
226 * @since 3.4 226 * @since 3.4
227 */ 227 */
228 private bool isLineInformationRepairNeeded(String text) { 228 private bool isLineInformationRepairNeeded(String text) {
248 return true; 248 return true;
249 } 249 }
250 250
251 if (defaultLD is null) 251 if (defaultLD is null)
252 return false; 252 return false;
253 253
254 defaultLD= getDefaultLineDelimiter(); 254 defaultLD= getDefaultLineDelimiter();
255 255
256 if (defaultLD.length() is 1) { 256 if (defaultLD.length is 1) {
257 if (rIndex !is -1 && !"\r".equals(defaultLD)) //$NON-NLS-1$ 257 if (rIndex !is -1 && !"\r".equals(defaultLD)) //$NON-NLS-1$
258 return true; 258 return true;
259 if (nIndex !is -1 && !"\n".equals(defaultLD)) //$NON-NLS-1$ 259 if (nIndex !is -1 && !"\n".equals(defaultLD)) //$NON-NLS-1$
260 return true; 260 return true;
261 } else if (defaultLD.length() is 2) 261 } else if (defaultLD.length is 2)
262 return rIndex is -1 || nIndex - rIndex !is 1; 262 return rIndex is -1 || nIndex - rIndex !is 1;
263 263
264 return false; 264 return false;
265 } 265 }
266 266
267 } 267 }