From a1843428319d1f96acaaf42e81e701de9988d06f Mon Sep 17 00:00:00 2001 From: mitchell <70453897+orbitalquark@users.noreply.github.com> Date: Wed, 14 Apr 2021 22:46:20 -0400 Subject: Attempt to restore view scroll state after `textadept.editing.filter_through()`. Also prefer `view.first_visible_line =` rather than `view:scroll_lines()` since the latter is only needed when display lines are involved. --- modules/textadept/editing.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'modules/textadept/editing.lua') diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index ae98720e..540c5aec 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -596,7 +596,7 @@ end function M.filter_through(command) assert(not (WIN32 and CURSES), 'not implemented in this environment') assert_type(command, 'string', 1) - local s, e = buffer.selection_start, buffer.selection_end + local s, e, top_line = buffer.selection_start, buffer.selection_end, view.first_visible_line if s == e then -- Use the whole buffer as input. buffer:target_whole_document() @@ -629,6 +629,7 @@ function M.filter_through(command) end end buffer:replace_target(output:iconv('UTF-8', _CHARSET)) + view.first_visible_line = top_line if s == e then buffer:goto_pos(s) return -- cgit v1.2.3