mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
Correct IME position calculation with window padding
This commit is contained in:
@ -1316,8 +1316,8 @@ pub fn imePoint(self: *const Surface) apprt.IMEPos {
|
|||||||
const content_scale = self.rt_surface.getContentScale() catch .{ .x = 1, .y = 1 };
|
const content_scale = self.rt_surface.getContentScale() catch .{ .x = 1, .y = 1 };
|
||||||
|
|
||||||
const x: f64 = x: {
|
const x: f64 = x: {
|
||||||
// Simple x * cell width gives the top-left corner
|
// Simple x * cell width gives the top-left corner, then add padding offset
|
||||||
var x: f64 = @floatFromInt(cursor.x * self.size.cell.width);
|
var x: f64 = @floatFromInt(cursor.x * self.size.cell.width + self.size.padding.left);
|
||||||
|
|
||||||
// We want the midpoint
|
// We want the midpoint
|
||||||
x += @as(f64, @floatFromInt(self.size.cell.width)) / 2;
|
x += @as(f64, @floatFromInt(self.size.cell.width)) / 2;
|
||||||
@ -1329,8 +1329,8 @@ pub fn imePoint(self: *const Surface) apprt.IMEPos {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const y: f64 = y: {
|
const y: f64 = y: {
|
||||||
// Simple x * cell width gives the top-left corner
|
// Simple y * cell height gives the top-left corner, then add padding offset
|
||||||
var y: f64 = @floatFromInt(cursor.y * self.size.cell.height);
|
var y: f64 = @floatFromInt(cursor.y * self.size.cell.height + self.size.padding.top);
|
||||||
|
|
||||||
// We want the bottom
|
// We want the bottom
|
||||||
y += @floatFromInt(self.size.cell.height);
|
y += @floatFromInt(self.size.cell.height);
|
||||||
|
Reference in New Issue
Block a user