vigna/ne

Bug when using Through with request_string

soveran opened this issue · 3 comments

There is a display bug when calling a filter with a request_string prompt.

Given this text:

abc

Set a mark over the 'a' and place the cursor after the 'c'. Then run the following command:

Through sed 's/a/x/'

Expected result:

xbc

Now, undo the change and repeat the process but calling Through without an argument:

Through
Filter: sed 's/a/x/'

The result is the same:

xbc

But once the cursor moves, the 'x' becomes an 'a' even though the character in that position is now an 'x', as can be verified with a call to Refresh.

The first bad commit I've found is cf658b2.

Thanks @soveran for the detailed bug report.

highlight_mark(...,true) caches a copy of the character and its attributes at the mark, which simplifies the job of highlight_mark(...,false) which restores the character with its original attributes. The assumption of course is that the character at the mark doesn't change in the mean time. To achieve that, we should only highlight_mark(...,true) when waiting for user input, and always highlight_mark(...,false) before we act on that input.

That's the intent of commit adee884. You can either cherry-pick that one, or pull the master branch.

Excellent, it works perfectly now. Thanks!

vigna commented

No, thank you for the most precise bug report ever ;)