I keep hitting the 'Toggle Comment' command with no selection, expecting it to work on the current line only, but it does the whole file. I find this behavior counter-intuitive. Does anyone else? And if so, is it possible to have it changed? -pete
On 07.11.2005, at 15:57, peter royal wrote:
I keep hitting the 'Toggle Comment' command with no selection, expecting it to work on the current line only, but it does the whole file. I find this behavior counter-intuitive. Does anyone else? And if so, is it possible to have it changed?
I would like to second that request. If I want to comment everything (which is rare enough), I can easily do Cmd-A Cmd-/. This change of behaviour would be really useful. If Allan doesn't want to change the default behaviour, maybe it would be possible to add a (hidden?) option for it?
Jonas
On Nov 7, 2005, at 9:08 AM, Jonas Witt wrote:
On 07.11.2005, at 15:57, peter royal wrote:
I keep hitting the 'Toggle Comment' command with no selection, expecting it to work on the current line only, but it does the whole file. I find this behavior counter-intuitive. Does anyone else? And if so, is it possible to have it changed?
I would like to second that request. If I want to comment everything (which is rare enough), I can easily do Cmd-A Cmd-/. This change of behaviour would be really useful. If Allan doesn't want to change the default behaviour, maybe it would be possible to add a (hidden?) option for it?
I think the logic behind it is that it follows the general principle that a command accepts as input either a selected text or, in the absence of selected text, the entire document. It makes very good sense in most cases, and I consider the consistency in the behavior very important. It is probably just one extra keystroke to select the line, right? I admit it doesn't happen often that you would want to uncomment the entire document. I wouldn't object to the presence of a variable setting this behavior though. But I feel it should be easy to change the command in the uncomment bundle to just work on the given line if there is no selection.
Jonas
Haris
On 07/11/2005, at 16.08, Jonas Witt wrote:
[...] This change of behaviour would be really useful. If Allan doesn't want to change the default behaviour, maybe it would be possible to add a (hidden?) option for it?
The problem is that Toggle Comment is just a script that works on the selection, so there's no easy way to change it.
Though I can add that it aborts when there is no selection, maybe showing a tool tip.
On Nov 7, 2005, at 10:19 AM, Allan Odgaard wrote:
On 07/11/2005, at 16.08, Jonas Witt wrote:
[...] This change of behaviour would be really useful. If Allan doesn't want to change the default behaviour, maybe it would be possible to add a (hidden?) option for it?
The problem is that Toggle Comment is just a script that works on the selection, so there's no easy way to change it.
Though I can add that it aborts when there is no selection, maybe showing a tool tip.
Then perhaps a toggle so when command input is "Selected Text", it can default to the current line rather than the whole document when nothing is selected?
Similar to how the "MySQL Query" command works, operate on: $ {TM_SELECTED_TEXT:-$TM_CURRENT_LINE}
-pete
On 07/11/2005, at 16.27, peter royal wrote:
The problem is that Toggle Comment is just a script that works on the selection, so there's no easy way to change it [...]
Then perhaps a toggle so when command input is "Selected Text", it can default to the current line rather than the whole document when nothing is selected?
The problem is with the output option, which is to replace selection. However, I think I can add an “or [ Word | Line | Paragraph | Document ]” to the right of the input popup, when the input choice is set to “Selected Text” -- that would set the fallback choice, which currently (always) defaults to document.
On 08/11/2005, at 17.03, Allan Odgaard wrote:
[...] The problem is with the output option, which is to replace selection. However, I think I can add an “or [ Word | Line | Paragraph | Document ]” to the right of the input popup [...]
For those who didn't get this from the release notes, such option now exist, and Toggle Comment makes use of it, so it can be used w/o a selection. A few other commands have also been updated to make use of this.
On 07/11/05, peter royal peter.royal@pobox.com wrote:
I keep hitting the 'Toggle Comment' command with no selection, expecting it to work on the current line only, but it does the whole file. I find this behavior counter-intuitive. Does anyone else? And if so, is it possible to have it changed?
This sounds like the problem Allan gave me a fix for a little while ago:
[...] Is it possible for me to make this change?
The easiest is probably to record a macro which first does: Edit -> Select -> Line, then Toggle Comment.
The Select Line will extended current selection to line boundaries, so it should work even when there already is a selection (for line mode comments).
If you give the new macro a scope of source.ruby, it'll be more specific than source (which the original command uses), so you can assign cmd-/ to this new macro w/o touching the org. command.
[Original message: Date: 21-Oct-2005 11:16 Subject: Re: [TxMt] Cmd+/ shouldn't do select-all]
Regards,
matt
-- Matt Mower :: http://matt.blogs.it/