saikyun / freja

Self-modifiable editor for coding graphical things
67 stars 3 forks source link

Backspace doesn't honor selection #46

Closed greenfork closed 3 years ago

greenfork commented 3 years ago
  1. Place cursor near the start of the buffer
  2. Select all the text from that point and to the very beginning of a buffer so the cursor is at offset 0
  3. Press backspace

Expected: deletes selected text Real: nothing happens

sogaiu commented 3 years ago

I got this too.

FWIW, it seems to work ok on other lines.

sogaiu commented 3 years ago

Also, the direction of the selection seems to matter.

If the selection is started from the left (the beginning of the buffer) to some other position on the same line, the problem doesn't occur for me.

sogaiu commented 3 years ago

I don't know if this is an appropriate patch, but the following has worked in light testing here:

    (when (and (= (gb :caret) 0)
               (not selection))

That's making a change around here: https://github.com/saikyun/freja/blob/9a7eefea90d390999cc58d889af46d250705cc1f/freja/new_gap_buffer.janet#L660

@saikyun How does that look?

saikyun commented 3 years ago

Merged PR, thanks!