Skip to content

Commit

Permalink
Merge pull request #10 from studycwq/master
Browse files Browse the repository at this point in the history
临时性处理有时候idea会出现无法删除字符和选择字符的问题
  • Loading branch information
RikudouPatrickstar authored Apr 14, 2022
2 parents c9e6c04 + a58ae14 commit 4c733d0
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions idea.patch
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ index 07c1334b8..01d5910de 100644
}

public static long getXICFocus() {
@@ -156,6 +182,71 @@ public class XInputMethod extends X11InputMethod {
@@ -156,6 +182,80 @@ public class XInputMethod extends X11InputMethod {
return peer.getContentWindow();
}

Expand Down Expand Up @@ -271,9 +271,18 @@ index 07c1334b8..01d5910de 100644
+ Method getCaretLocations = editor.getClass().getMethod("getCaretLocations", boolean.class);
+ Object[] locations = (Object[])getCaretLocations.invoke(editor, false);
+ Field point = locations[0].getClass().getField("myPoint");
+ Point2D.Double pd = (Point2D.Double)point.get(locations[0]);
+ caret_x = (int)pd.x;
+ caret_y = (int)pd.y;
+ Object myPoint = point.get(locations[0]);
+ if (myPoint instanceof Point) {
+ // convert to Point
+ Point p = (Point) myPoint;
+ caret_x = p.x;
+ caret_y = p.y;
+ } else {
+ // convert to Point2D.Double
+ Point2D.Double pd = (Point2D.Double) myPoint;
+ caret_x = (int)pd.x;
+ caret_y = (int)pd.y;
+ }
+ }
+
+
Expand Down Expand Up @@ -308,7 +317,7 @@ index 07c1334b8..01d5910de 100644
/*
* Native methods
*/
@@ -164,6 +255,6 @@ public class XInputMethod extends X11InputMethod {
@@ -164,6 +264,6 @@ public class XInputMethod extends X11InputMethod {
private native boolean recreateXICNative(long window, long px11data, int ctxid);
private native int releaseXICNative(long px11data);
private native void setXICFocusNative(long window,
Expand Down

0 comments on commit 4c733d0

Please sign in to comment.