sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
811 stars 39 forks source link

Dragging when text is selected does not deselect text #1258

Open AndrewHoos opened 8 years ago

AndrewHoos commented 8 years ago

Summary

When Text is selected and a user drags in the unselected whitespace of the document the text is not unselected. This is more noticeable when working with trackpad inputs (e.g. Apple's Magic Trackpad 2) because unintentional miniature drags may occur. This is confusing to the user because different behavior is observed between clicks and drags, but clicks and drags are hard to distinguish on trackpad input device.

See also: https://github.com/SublimeTextIssues/Core/issues/1028

Expected behavior

Text should be deselected when a user clicks or drags in the unselected whitespace margin to the right of the text.

Actual behavior

Text is not deselected when a user drags in the unselected whitespace margin to the right of the text. Text is deselected when a user clicks in the unselected whitespace margin to the right of the text.

Steps to reproduce

Click (behaves correctly)

  1. Open text document
  2. Select all text (command+a)
  3. Click in the right margin (not the gutter)

Drag (behaves incorrectly)

  1. Open text document
  2. Select all text (command+a)
  3. Drag in the right margin (not the gutter)

    Environment

    • Operating system and version:
    • [X] Mac OS ... macOS Sierra
    • Sublime Text:
    • Build 3114
FichteFoll commented 8 years ago

I always considered this to be a feature, being able to drag anywhere on the line if the newline character is also part of the selection. Although I also found it annoying at first.

If you don't want any of that, you can set "drag_text": false.

AndrewHoos commented 8 years ago

@FichteFoll This does not match the text editing behavior of every other text editor or view in OS X. You can't drag anywhere in the selected line. Because the selection in sublime does not extend all the way to the right margin like TextEdit or BBEdit there is a section where you can't drag the text and you can't deselect the text with a drag. If all the text on the screen is selected it is legitimately challenging to deselect the text using a trackpad because it is to easy to unintentionally drag when you meant to click. No other text editor has a problem with this. It seems that there is a minimum displacement threshold in other editors before a drag is considered a drag instead of click

samoli commented 7 years ago

If all the text on the screen is selected it is legitimately challenging to deselect the text using a trackpad because it is to easy to unintentionally drag when you meant to click.

It's very difficult to deselect text with the Magic Mouse too (maybe since Sierra?). Setting "drag_text": false solves the problem.

Meshparts commented 7 years ago

You cannot seriously consider "drag_text": false as a valid solution to this issue. Dragging text is used very often so it's a needed feature! The solution should be to only drag text if the user clicks inside the selected text. If the user clicks outside the selected text, the selection should be removed.

rjorgs commented 7 years ago

I have a magic mouse and setting "drag_text": false solved this for me as well after recently upgrading to Sierra.

MattDMo commented 6 years ago

So I'm seeing some very strange behavior:

macOS 10.13.3 ST3 Build 3160 iMac with both a Bluetooth Apple Magic Trackpad (the old one) and a Logitech M510 wireless mouse that connects to their stupid dongle thingy. The Logitech mouse gives the undesired behavior - clicking on selected text does nothing. However, clicking on the same selected text with the trackpad deselects it and places the cursor where I clicked, which is what should happen! WTF?

The dragging action (keeping the selection selected) should only occur on button1 down followed by dragging. button1 down then up should deselect the text and place the cursor at the location of the click.

tonyarnold commented 5 years ago

@MattDMo I'm seeing the same thing with a Magic Mouse. It's making ST3 unusable for me - I click around like an idiot every time I want to place a cursor inside some selected text 😦