Opened 10 years ago

Last modified 10 years ago

#496 new enhancement

Double-click = select whole function name

Reported by: Kristian Bredin Owned by:
Priority: minor Milestone: Cocoa IDE v?
Component: IDE Version: 1.3
Keywords: Cc:

Description

I much more often want to select the whole function name than a part of it. I typically do this as part of copy and paste.

Currently, double-clicking on a function name (such as make-instance) only selects the part where you click. AFAIK this is perfectly normal behavior, but it would be nice to have an easy way of selecting the whole name. In MCL (at least in 5.2) it's as I want it to be.

If it's deemed appropriate to keep it as it is = one click -move insertion point, 2 clicks -select part if separated with hyphen, and 3 clicks -select the whole line, then I'd vote for a click + dead key option, for instance: one click + Meta would select the whole word.

Change History (4)

comment:1 Changed 10 years ago by Kristian Bredin

What's the status for this one?

comment:2 Changed 10 years ago by rme

  • Milestone set to Cocoa IDE v?
  • Priority changed from normal to minor

I was about to comment that Mac OS text selection conventions exclude the "-" character as a word constituent. This is how TextEdit behaves, for instance. Interestingly, though, Apple's HIG says that a hyphen is in fact a word constituent:

http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGUserInput/XHIGUserInput.html#//apple_ref/doc/uid/TP30000361-TPXREF28

These rules seem not to be widely honored. For instance, according to these rules, $123,456.78 should be a word, but double-clicking it in TextEdit excludes the $ character.

At the moment, text selection handling is all done at the Cocoa level, via #/selectionRangeForProposedRange:granularity: et al., so it's not really feasible for users to customize the selection behavior.

At some future date when we can do mouse event handling at the Hemlock level, this would be a fairly straightforward user customization. I'm not sure that's it's a good idea to bake in option-click (or option-double-click) as "select word including hyphens". On the other hand, option-click currently has the default Cocoa behavior of selecting a rectangle of text, which Hemlock doesn't do anything with, so it's not like we'd be stepping on any existing functionality.

Sorry that this is sort of an inconclusive comment.

comment:3 Changed 10 years ago by Kristian Bredin

No worries about inconclusiveness, since it's probably the appropriate approach on this matter = not now, but maybe later in a "local, user context".

I know too little about feasibility on a technical level, but the paragraph named "Altering Selection Behaviour" in http://developer.apple.com/documentation/Cocoa/Conceptual/TextEditing/Tasks/Subclassing.html does open up a tiny bit of hope, even on the pure cocoa side of this matter, but the same paragraph does discourage the specialisation of behaviour for "language word" cases.

I _would_ argue that a code editor should answer to a set of needs that could be a bit different compared to ordinary text editing, but a quick check at the text editor in xcode, for instance, reveals the same selection behaviour as in textedit.

I would _even more_ argue that a lisp editor should (in a simple and natural way) allow selection of function names with one or several hyphens, but this might have to wait until later.

A temporary workaround (in user code) would be to skip the use of hyphens altogether and use underscores instead, as they seem to be considered as a word constituent. Not an ideal solution for me, but better than nothing.

comment:4 Changed 10 years ago by gz

(In [13186]) A bunch of Hemlock Lisp mode changes:

  • Add parsing support for |symbol quoting| and #| nested comments |#. This fixes bug 421.
  • Change comment syntax coloring color from light gray to brown. Use it to color #| |# blocks as well as ;;; comments. Do NOT use it to color escaped symbol constituents.
  • Add support for moving over lisp forms without pre-parsing info, for use when pre-parsing info is not available. Use this to allow navigation (i.e. c-m-f et. al.) inside strings and comment (seems like there would have been a ticket for this but I didn't find one).
  • Make meta-. work inside comments
  • Extend double-click selection to work inside comments/strings, ditto for Enter. This fixes bug 503 and bug 509.
  • Fix a couple bugs in pre-parsing of lines with escape at end. This was the underlying cause of bug 444, so this fixes bug 444.
  • Make triple-click select symbols vs. words for double-click. This addresses bug 496.
  • parse-over-block: fix the constant reparsing of the first line.
  • set-temporary-character-attributes: do not force reparsing, as this is called a lot.
  • fix macroexpand commands to act in-lisp context
  • Init hemlock syntax attributes from ccl::%standard-readtable%
  • Replace Editor Compile Defun and Editor Evaluate Defun with Editor Execute Defun, and replace Editor Compile Region and Editor Evaluate Region with Editor Execute Expression.
  • Make the form selected by double-clicking be the same as the form used for execution and macroexpansion commands, and make it be more general. This fixes bug 577 and bug 65 and bug 188.
  • some other changes that I no longer remember because I had this checked out for way too long...
Note: See TracTickets for help on using tickets.