Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: more multiple-cursor commands #1517

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

Book-reader
Copy link

@Book-reader Book-reader commented Sep 6, 2024

this pr adds more commands to multiple-cursors.lisp that emulates the mark-next/previous-like-this functionality from multiple-cursors.el as well as adding a add-cursors-to-previous-line command to match the add-cursors-to-next-line command.

example.mp4.webm

things I have not done yet:

  • fix mark-previous-like-this not working at all
  • fix mark-previous-like-this skipping every second match when cursor is to the left of the mark (buffer-point < buffer-mark)
  • fix mark-next-like-this always placing fake cursor on the right side of the mark, even when the real cursor is on the left side
    • find a way to start of the mark as the first point marked instead of the top-left always being the start of the mark.
  • allow multiple cursors to be on the same line (now cannot be on the same char)
  • add tests
  • add default keyboard shortcuts
  • add description to mark-previous-like-this and mark-next-like-this
  • make mark-next/previous-like-this run add-cursors-to-next/previous-line when nothing is marked (to match multiple-cursors.el)
  • allow multiple fake cursors to be on the same line, but not on the same point
  • fix mark-next-like-this not working with multiple lines
    • initial support
    • fix only deleting the last line marked by the fake cursor (probably something to do with not setting point-line)
    • fix not working when mark does not start at the beginning of the line
  • fix multiple cursors being in the same space until something is typed, duplicating the letter typed

issues with multiple cursors out of scope of this PR:

  • once you mark something with a fake cursor it has a phantom mark that stays until the fake cursor is removed or until something else is marked.
  • undoing an edit done by a fake cursor causes the real cursor to jump to that point.
  • in multiple-cursors.el, the fake cursors stay when using keyboard-escape-quit and are only cleared with keyboard-quit. this allows calling keyboard-escape-quit to unmark the current buffer without removing all the fake cursors. in lem there is only keyboard-quit which both unmarks the buffer and removes all the cursors.

I am not very good with lisp so please tell me if there are any problems with my code.
I have moved multiple-cursors.lisp to extensions/ because add-cursors-to-next-like-this uses isearch and I could not figure out how to import the needed functions and commands when it was in lem-core.

@Book-reader Book-reader marked this pull request as draft September 6, 2024 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant