Skip to content
This repository was archived by the owner on Apr 16, 2026. It is now read-only.
This repository was archived by the owner on Apr 16, 2026. It is now read-only.

Rectangular selection failed after upgrade #6067

Closed

Description

@fortooon

Hi, all.

I try to upgrade CodeMirror from 5.14.2 to 5.49.2 and note that rectangle selection work incorrectly even after use new option :
configureMouse : function() { return {unit: "rectangle"};}
In 5.14.2 version we used special option option("alwaysRectangularSelection", false); that we used in method
function leftButtonSelect( in condition
if ((chromeOS ? e.shiftKey && e.metaKey : e.altKey) || cm.options.alwaysRectangularSelection) {
that help us do such kind of rectangle selection:
rec_selection_2

I found that in new version it logic can be implemented just by using configureMouse option such way configureMouse : function() { return {unit: "rectangle"};}.
But in case when we start to select from shorter string and end after longer on another shorter, result selection don't include some part of text in 2d line :
optimised

to reproduce it, plz see online demo http://jsfiddle.net/8r09tgv6/

After research code, I found that changes with xRel in coordsCharInner method not supported by posFromMouse in condition if (forRect && coords.xRel == 1 && line.length == coords.ch) { because now xRel can be more than 1.

So fix like coords.xRel > 0 help in this situation.
Is there any way around it? Or this fix is correct?

Activity

  1. marijnh commented on Nov 19, 2019

    @marijnh
    Member

    Thanks for debugging that. Your proposed fix makes sense—implemented in attached patch.

  2. added a commit that references this issue on Jan 6, 2020
    25fc887
  3. added a commit that references this issue on Jan 21, 2020
    2e3f6d4
  4. added a commit that references this issue on Oct 31, 2020
    14d7274
  5. added a commit that references this issue on Sep 5, 2024
    18a8ae2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions