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

[DRAFT] feature: sync mark region for vi-mode. #1633

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sakurawald
Copy link
Contributor

Related issue: #1590

To sync the mark-region between vi-mode and mouse-clicking:

  1. Ensure the vi-visual-char mode is entered, when selecting a region using mouse.
  2. Sync the *start-point* for vi-visual-mode.

This pr contains some cons:

  1. The visual-overlay may not be cleared correctly: The visual-overlay will be cleared after you pressed y key in vi-visaul mode, if (current-point) > *start-point* (In right-side). It will not be cleared if (current-point) < *start-point* (In left-side).
  2. Press v key again in vi-visual-char mode will not clear the visual-overlay selected by mouse.

Anyway, this pr:

  1. Ensure the vi-mode will be vi-visual-char mode, if you use mouse to select a mark region.
  2. Press y key in vi-visual-char mode can copy the correct string into clip-board. (Though it will not ensure the visual-overlay be synced.)

@sakurawald sakurawald changed the title feature: sync mark region for vi-mode. [DRAFT] feature: sync mark region for vi-mode. Nov 22, 2024
@sakurawald
Copy link
Contributor Author

sakurawald commented Nov 23, 2024

This impl only work in lem self-hack mode, and failed to pass the compilation.

The main point is to:

  1. If a mark region is selected by mouse-clicking, then enter vi-visual-char mode automatically.
  2. Set the *start-point* for vi-visual-char mode.
  3. Ensure the visual-overlay in vi-mode will be cleared after be consumed, e.g. after v key pressed in visual mode or after y key pressed in visual mode.

There are some tasks should be done:

  1. Extract the vi-mode specific code from the core code, to avoid the access of lem-vi-mode package.
  2. Maybe use a hook to listen the mark region changed event, and set the *start-point* for vi-visual-char mode.
  3. The visual-overlay in vi-mode didn't disapper in some cases, like if the (current-point) < *start-point*, then the visual-overlay will not be cleared, and requries extra esc key to clear this overlay.

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