MCPcopy Index your code
hub / github.com/antlr/codebuff / toComponentPosition

Method toComponentPosition

output/java8/1.4.14/STViz.java:349–359  ·  view source on GitHub ↗
(JTextComponent component, int position)

Source from the content-addressed store, hash-verified

347 }
348
349 protected int toComponentPosition(JTextComponent component, int position) {
350 int[] windowsLineEndings = (int[])component.getDocument().getProperty(WINDOWS_LINE_ENDINGS);
351 if ( windowsLineEndings==null || windowsLineEndings.length==0 ) {
352 return position;
353 }
354 int index = Arrays.binarySearch(windowsLineEndings, position);
355 if ( index>=0 ) {
356 return position-index;
357 }
358 return position-(-index-1);
359 }
360
361 protected int toEventPosition(JTextComponent component, int position) {
362 int result = position;

Callers 2

toEventPositionMethod · 0.95
highlightMethod · 0.95

Calls 2

getPropertyMethod · 0.65
binarySearchMethod · 0.45

Tested by

no test coverage detected