Fix startup bug
This commit is contained in:
@ -144,7 +144,7 @@ public class XPathPanelController implements Initializable, SettingsOwner {
|
|||||||
});
|
});
|
||||||
|
|
||||||
EventStream<Integer> keyCombo = EventStreams.eventsOf(xpathExpressionArea, KeyEvent.KEY_PRESSED)
|
EventStream<Integer> keyCombo = EventStreams.eventsOf(xpathExpressionArea, KeyEvent.KEY_PRESSED)
|
||||||
.filter(key -> (key.isControlDown() && key.getCode().equals(KeyCode.SPACE)))
|
.filter(key -> key.isControlDown() && key.getCode().equals(KeyCode.SPACE))
|
||||||
.map(searchPoint -> xpathExpressionArea.getCaretPosition());
|
.map(searchPoint -> xpathExpressionArea.getCaretPosition());
|
||||||
|
|
||||||
EventStreams.merge(keyCombo, changesEventStream).map(searchPoint -> {
|
EventStreams.merge(keyCombo, changesEventStream).map(searchPoint -> {
|
||||||
@ -152,16 +152,13 @@ public class XPathPanelController implements Initializable, SettingsOwner {
|
|||||||
String input = xpathExpressionArea.getText();
|
String input = xpathExpressionArea.getText();
|
||||||
if (searchPoint > input.length()) {
|
if (searchPoint > input.length()) {
|
||||||
searchPoint = input.length();
|
searchPoint = input.length();
|
||||||
input = input.substring(indexOfSlash, searchPoint);
|
|
||||||
} else {
|
|
||||||
input = input.substring(indexOfSlash, searchPoint);
|
|
||||||
}
|
}
|
||||||
|
input = input.substring(indexOfSlash, searchPoint);
|
||||||
|
|
||||||
return Tuples.t(indexOfSlash, input);
|
return Tuples.t(indexOfSlash, input);
|
||||||
})
|
})
|
||||||
.filter(t -> t._2.matches("[a-zA-Z]+"))
|
.filter(t -> StringUtils.isAlpha(t._2))
|
||||||
.subscribe(s -> autoComplete(s._1, s._2));
|
.subscribe(s -> autoComplete(s._1, s._2));
|
||||||
|
|
||||||
|
|
||||||
xpathExpressionArea.addEventHandler(KeyEvent.KEY_PRESSED, t -> {
|
xpathExpressionArea.addEventHandler(KeyEvent.KEY_PRESSED, t -> {
|
||||||
if (t.getCode() == KeyCode.ESCAPE) {
|
if (t.getCode() == KeyCode.ESCAPE) {
|
||||||
@ -196,10 +193,9 @@ public class XPathPanelController implements Initializable, SettingsOwner {
|
|||||||
}
|
}
|
||||||
autoCompletePopup.getItems().setAll(resultToDisplay);
|
autoCompletePopup.getItems().setAll(resultToDisplay);
|
||||||
|
|
||||||
autoCompletePopup.show(xpathExpressionArea, xpathExpressionArea
|
if (autoCompletePopup.isAutoFix())
|
||||||
.getCharacterBoundsOnScreen(slashPosition, slashPosition + input.length()
|
xpathExpressionArea.getCharacterBoundsOnScreen(slashPosition, slashPosition + input.length())
|
||||||
).get().getMaxX(), xpathExpressionArea.getCharacterBoundsOnScreen(slashPosition, slashPosition + input
|
.ifPresent(bounds -> autoCompletePopup.show(xpathExpressionArea, bounds.getMinX(), bounds.getMaxY()));
|
||||||
.length()).get().getMaxY());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initGenerateXPathFromStackTrace() {
|
private void initGenerateXPathFromStackTrace() {
|
||||||
|
Reference in New Issue
Block a user