Hello community, here is the log from the commit of package neovim-gtk for openSUSE:Factory checked in at 2020-01-27 00:22:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/neovim-gtk (Old) and /work/SRC/openSUSE:Factory/.neovim-gtk.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "neovim-gtk" Mon Jan 27 00:22:51 2020 rev:3 rq:767261 version:0.2.0+git.1579960262.0af8952 Changes: -------- --- /work/SRC/openSUSE:Factory/neovim-gtk/neovim-gtk.changes 2019-12-05 17:34:16.269448755 +0100 +++ /work/SRC/openSUSE:Factory/.neovim-gtk.new.26092/neovim-gtk.changes 2020-01-27 00:23:23.361523899 +0100 @@ -1,0 +2,7 @@ +Sat Jan 25 23:01:54 UTC 2020 - Matej Cepl <[email protected]> + +- Update to version 0.2.0+git.1579960262.0af8952: + * fix build + * Fix mouse selection while dragging with leftclick, fixes #185 + +------------------------------------------------------------------- Old: ---- neovim-gtk-0.2.0+git.1575188169.31fd179.tar.xz New: ---- neovim-gtk-0.2.0+git.1579960262.0af8952.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ neovim-gtk.spec ++++++ --- /var/tmp/diff_new_pack.YqUDuQ/_old 2020-01-27 00:23:25.161524747 +0100 +++ /var/tmp/diff_new_pack.YqUDuQ/_new 2020-01-27 00:23:25.165524749 +0100 @@ -1,7 +1,7 @@ # # spec file for package neovim-gtk # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,7 +20,7 @@ %define binname nvim-gtk Name: neovim-gtk -Version: 0.2.0+git.1575188169.31fd179 +Version: 0.2.0+git.1579960262.0af8952 Release: 0 Summary: GTK UI for Neovim License: GPL-3.0-only ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.YqUDuQ/_old 2020-01-27 00:23:25.201524766 +0100 +++ /var/tmp/diff_new_pack.YqUDuQ/_new 2020-01-27 00:23:25.201524766 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/daa84/neovim-gtk</param> - <param name="changesrevision">31fd179c9a772104c601ab5cea16e3ad42ec1f4a</param> + <param name="changesrevision">0af8952171c5375a4435cf3790e08c3b9ee29e8d</param> </service> </servicedata> \ No newline at end of file ++++++ neovim-gtk-0.2.0+git.1575188169.31fd179.tar.xz -> neovim-gtk-0.2.0+git.1579960262.0af8952.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/neovim-gtk-0.2.0+git.1575188169.31fd179/src/shell.rs new/neovim-gtk-0.2.0+git.1579960262.0af8952/src/shell.rs --- old/neovim-gtk-0.2.0+git.1575188169.31fd179/src/shell.rs 2019-12-01 09:16:09.000000000 +0100 +++ new/neovim-gtk-0.2.0+git.1579960262.0af8952/src/shell.rs 2020-01-25 14:51:02.000000000 +0100 @@ -552,6 +552,9 @@ mouse_pressed: bool, scroll_delta: (f64, f64), + // previous editor position (col, row) + prev_pos: (u64, u64), + mouse_cursor: MouseCursor, } @@ -560,6 +563,7 @@ UiState { mouse_pressed: false, scroll_delta: (0.0, 0.0), + prev_pos: (0, 0), mouse_cursor: MouseCursor::None, } @@ -1047,14 +1051,7 @@ fn mouse_input(shell: &mut State, input: &str, state: ModifierType, position: (f64, f64)) { if let Some(mut nvim) = shell.try_nvim() { - let &CellMetrics { - line_height, - char_width, - .. - } = shell.render_state.borrow().font_ctx.cell_metrics(); - let (x, y) = position; - let col = (x / char_width).trunc() as u64; - let row = (y / line_height).trunc() as u64; + let (col, row) = mouse_coordinates_to_nvim(shell, position); let input_str = format!("{}<{},{}>", keyval_to_input_string(input, state), col, row); nvim.input(&input_str) @@ -1062,6 +1059,21 @@ } } +/** + * Translate gtk mouse event coordinates to nvim (col, row). + */ +fn mouse_coordinates_to_nvim(shell: &State, position: (f64, f64)) -> (u64, u64) { + let &CellMetrics { + line_height, + char_width, + .. + } = shell.render_state.borrow().font_ctx.cell_metrics(); + let (x, y) = position; + let col = (x / char_width).trunc() as u64; + let row = (y / line_height).trunc() as u64; + (col, row) +} + fn gtk_button_release(shell: &mut State, ui_state: &mut UiState, ev: &EventButton) -> Inhibit { ui_state.mouse_pressed = false; @@ -1079,7 +1091,15 @@ fn gtk_motion_notify(shell: &mut State, ui_state: &mut UiState, ev: &EventMotion) -> Inhibit { if shell.mouse_enabled && ui_state.mouse_pressed { - mouse_input(shell, "LeftDrag", ev.get_state(), ev.get_position()); + let ev_pos = ev.get_position(); + let pos = mouse_coordinates_to_nvim(shell, ev_pos); + + // if we fire LeftDrag on the same coordinates multiple times, then + // we get: https://github.com/daa84/neovim-gtk/issues/185 + if pos != ui_state.prev_pos { + mouse_input(shell, "LeftDrag", ev.get_state(), ev_pos); + ui_state.prev_pos = pos; + } } ui_state.apply_mouse_cursor(MouseCursor::Text, shell.drawing_area.get_window()); ++++++ neovim-gtk-vendor.tar.xz ++++++ /work/SRC/openSUSE:Factory/neovim-gtk/neovim-gtk-vendor.tar.xz /work/SRC/openSUSE:Factory/.neovim-gtk.new.26092/neovim-gtk-vendor.tar.xz differ: char 26, line 1
