Closed rgieseke closed 3 years ago
Try the attached/following patch. It blocks the default attempt to restore the previous caret position when buffer contents are replaced. When the blocker is hit, it removes itself so that future, non-textredux events can still trigger the default behavior.
--- textredux-main/core/buffer.lua 2021-05-25 14:31:39.000000000 -0400 +++ textredux/core/buffer.lua 2021-06-11 11:29:59.005523457 -0400 @@ -288,6 +288,11 @@ self:set_save_point() end
+local function block_event()
--[[-- Refreshes the buffer. A refresh works by ensuring that it's possible to write to the buffer and invoking the @{on_refresh} handler. After the refresh is complete, the @@ -302,7 +307,10 @@ self:update(function() self.hotspots = {} self:clear_all()
Wicked! Thanks for the quick reply, this works very well.
The saving/restoring of buffer positions changed with the latest beta
https://github.com/orbitalquark/textadept/blob/1e693f06a6556b87ed4f56a3635a0c10640b1f92/modules/textadept/history.lua
This interferes with Textredux' handling of search text where the position at a filtered line should be kept.
I can workaround this as described in https://github.com/rgieseke/textredux/issues/76
I wonder whether there could be a way to add some check to the checks to "ignore" in
https://github.com/orbitalquark/textadept/blob/1e693f06a6556b87ed4f56a3635a0c10640b1f92/modules/textadept/history.lua#L47
to detect something like Textredux use-case? (Maybe it's to special and i can use the above workaround.)