Skip to content

Commit

Permalink
Fix type() & typeUnsurely()
Browse files Browse the repository at this point in the history
- Call click(x,y) instead of move(x,y), like enter()/paste()
- Call Chars.toString() to paste in individual char, not all of text
  • Loading branch information
esotericpig committed Mar 29, 2020
1 parent a00ff33 commit 88dab93
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/com/esotericpig/jeso/botbuddy/BotBuddy.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.esotericpig.jeso.botbuddy;

import com.esotericpig.jeso.Chars;
import com.esotericpig.jeso.Duplicable;
import com.esotericpig.jeso.OSFamily;
import com.esotericpig.jeso.Sys;
Expand Down Expand Up @@ -665,7 +666,7 @@ protected BotBuddy type(String text,boolean ensure) {

if(keyCodes == null) {
if(ensure) {
paste(text); // Ensure success
paste(Chars.toString(keyChar)); // Ensure success
}
}
else {
Expand All @@ -679,11 +680,11 @@ protected BotBuddy type(String text,boolean ensure) {
}

public BotBuddy type(int x,int y,int keyCode) {
return move(x,y).type(keyCode);
return click(x,y).type(keyCode);
}

public BotBuddy type(int x,int y,String text) {
return move(x,y).type(text);
return click(x,y).type(text);
}

public BotBuddy types(int... keyCodes) {
Expand All @@ -699,7 +700,7 @@ public BotBuddy typeUnsurely(String text) {
}

public BotBuddy typeUnsurely(int x,int y,String text) {
return move(x,y).typeUnsurely(text);
return click(x,y).typeUnsurely(text);
}

public BotBuddy unstash() {
Expand Down

0 comments on commit 88dab93

Please sign in to comment.