Klafyvel / nvim-smuggler

Send code to your Julia REPL, get diagnostics in return.
MIT License
21 stars 2 forks source link

fix: treat textchange as single character chunk , use get_cursor instead of marks [ and ] #43

Closed ArbitRandomUser closed 2 months ago

ArbitRandomUser commented 2 months ago

i'll get to it soon , i was thinking we treat every character change as a chunk, find intersecting chunks in buffer and invalidate them. Since a single character change will occur only inside one chunk of the buffer, finding all intersecting chunks is unnecessary. Maybe we refactor this to just find the current chunk the cursor is in ?

Klafyvel commented 2 months ago

Ok, my mistake I found a problem with this approach, and indeed it shows in normal mode. If your changes overlap the evaluated chunk, it is not detected. Case in point: Visual-block select a portion of code that contains an evaluated chunk and add a space at the begining of each line. Because the cursor is never in the chunk we miss the modification. Perhaps we should have two detection mechanisms: one cursor-based for insertion mode, and one mark-based for other modes.

ArbitRandomUser commented 2 months ago

sorry for all the indentation mixups , just realized the file is tab indented and ive setup vim to expand tabs

ArbitRandomUser commented 2 months ago

actually it seems to have a mix of both, fig

Klafyvel commented 2 months ago

Thanks, I'll have a look tonight!

On Thu, Sep 12, 2024, 14:20 John George Francis @.***> wrote:

@ArbitRandomUser https://github.com/ArbitRandomUser requested your review on: #43 https://github.com/Klafyvel/nvim-smuggler/pull/43 fix: treat textchange as single character chunk , use get_cursor instead of marks [ and ].

— Reply to this email directly, view it on GitHub https://github.com/Klafyvel/nvim-smuggler/pull/43#event-14231914152, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPL4L4I5HVSIPNB3OOLQLDZWGBJPAVCNFSM6AAAAABOBQGMOOVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJUGIZTCOJRGQYTKMQ . You are receiving this because your review was requested.Message ID: @.***>

Klafyvel commented 2 months ago

Thank you very much for your help on this!