feat: focus editor on click
This commit is contained in:
parent
9e7639e034
commit
ce2a40031a
1 changed files with 4 additions and 0 deletions
|
|
@ -6362,6 +6362,10 @@ pub const EditorWidget = struct {
|
||||||
|
|
||||||
fn mouse_click_event(self: *Self, event: input.Event, btn: input.Mouse, y: c_int, x: c_int, ypx: c_int, xpx: c_int) Result {
|
fn mouse_click_event(self: *Self, event: input.Event, btn: input.Mouse, y: c_int, x: c_int, ypx: c_int, xpx: c_int) Result {
|
||||||
if (event != input.event.press) return;
|
if (event != input.event.press) return;
|
||||||
|
if (!self.focused) switch (btn) {
|
||||||
|
input.mouse.BUTTON1, input.mouse.BUTTON2, input.mouse.BUTTON3 => _ = tui.set_focus_by_mouse_event(),
|
||||||
|
else => {},
|
||||||
|
};
|
||||||
const ret = (switch (btn) {
|
const ret = (switch (btn) {
|
||||||
input.mouse.BUTTON1 => &mouse_click_button1,
|
input.mouse.BUTTON1 => &mouse_click_button1,
|
||||||
input.mouse.BUTTON2 => &mouse_click_button2,
|
input.mouse.BUTTON2 => &mouse_click_button2,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue