Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Bug reports ➜ Copying output using keyboard shortcut (Ctrl+C) while all keys to command box on

Copying output using keyboard shortcut (Ctrl+C) while all keys to command box on

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  3  

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Tue 24 Jul 2007 12:41 AM (UTC)
Message
I've been happily upgrading along for quite a few versions, and at some point (I wish I had been paying attention but I haven't) the handling of Ctrl+C started to differ. My current version is 4.14.

I am unsure if I had 'All typing goes to command window' on in the past, but I am pretty sure I did since I used to click there and just start typing to have my output.

With it off, I can select text and Ctrl+C to have output copied to the clipboard. With it on, I can NOT use Ctrl+C to copy stuff and I end up copying nothing, which is quite annoying. Yes, I can rightclick the selected text, but since the popup menu is so large, I usually end up having to go back to the top of the screen which is slow and cumbersome.

I am 100% positive that I used to have these two 'features' work alongside eachother pre-v4.0, but that is as far as my knowledge or experiences go. Can this 'old' behavior be re-instated? (click on output and typing goes to command box while selecting output and Ctrl+C copies to clipboard)
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Tue 24 Jul 2007 12:54 AM (UTC)
Message
Nope, it's never worked. Because the Typing Window is always highlighted, you cannot Ctrl+C the output window because it is not highlighted.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #2 on Tue 24 Jul 2007 01:32 AM (UTC)
Message
I am pretty sure it worked. That or I did something really funky in the past. >_> Besides, it doesn't look like the caret is in the command box if you click on the output area with the option turned on.

Well, if it isn't a bug report, it is a feature request! ^_^
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #3 on Tue 24 Jul 2007 01:40 AM (UTC)
Message
I'm pretty sure it never worked. Look at my post I made 4 years ago.
http://www.gammon.com.au/forum/bbshowpost.php?id=2369

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #4 on Tue 24 Jul 2007 01:42 AM (UTC)
Message
We'll settle on me doing funky stuff, then.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #5 on Tue 24 Jul 2007 01:43 AM (UTC)
Message
The option "All typing goes to command window" does exactly what it claims to do. As soon as you type something, including Ctrl+C, the focus moves to the command window first.

If you RH-click, the very first menu option is "copy", so it should be easy enough to copy then. Or, you can click on the "copy" button on the button bar (about the 7th button).

Or, just turn off "All typing goes to command window" - if the focus is not in the command window all you have to do is hit <Tab> to move it there.

Another possibility, if you are just copying single words, is to turn on "double click pastes word". That way, if you double-click a word, it gets copied and pasted into the command window.

I don't think it ever worked the way you describe.

Quote:

Besides, it doesn't look like the caret is in the command box if you click on the output area with the option turned on.


The focus is in the output window until you type something.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #6 on Tue 24 Jul 2007 01:46 AM (UTC)
Message
The "Copy selection to clipboard" option might be what you used to use. I was going to mention that but couldn't find it, as it was in the Output configuration and not the Command configuration.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #7 on Tue 24 Jul 2007 02:11 AM (UTC)
Message
Is there any way to put in an option to have Ctrl+C check if there is highlighted text in the output window before checking the input window? Come to think of it, I can't seem to find a script function to check for highlighted text in the output windows when I did a quick scan. Does this function exist? I was going to make a plugin to deal with this, but hit a wall with checking for highlighted text.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #8 on Tue 24 Jul 2007 02:32 AM (UTC)
Message
No, as that other post explained, Ctrl and C are separate keystrokes, and for the idea of switching focus to work at all, it has to be on the Ctrl keypress.

As for finding the selection, see:

http://www.gammon.com.au/scripts/doc.php?function=GetSelectionStartColumn


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #9 on Tue 24 Jul 2007 02:50 AM (UTC)
Message
But even if you press Ctrl-C, the text highlighted in the output window is still highlighted, at least for me it is. My idea is to add a flag could be added so that when you press Ctrl-C, the focus does switch to the command window like normal. The difference is that it checks the output window for any highlighted text first, then will either grab the highlighted output text, or if none exists go grab the highlighted text in the command window. Then, if you press Ctrl-P, the text will be placed as normal in the command window.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Nick Gammon   Australia  (23,122 posts)  Bio   Forum Administrator
Date Reply #10 on Tue 24 Jul 2007 03:14 AM (UTC)

Amended on Tue 24 Jul 2007 03:15 AM (UTC) by Nick Gammon

Message
This might work for you. Put this script into your script file:


function CopySelection ()

-- find the selection range

  local startline, endline, startcol, endcol = 
    GetSelectionStartLine (),
    GetSelectionEndLine (),
    GetSelectionStartColumn (),
    GetSelectionEndColumn ()

  -- if a single line selected, take that word  

  if startline > 0 and 
     endline == startline and
     startcol > 0 and
     endcol > 0 then

    local selection = string.sub (GetLineInfo (startline, 1), startcol, endcol - 1)

    SetClipboard (selection)

  else
    DoCommand ("copy")
  end -- if

end -- function CopySelection 



Then make an accelerator:


/Accelerator ("Ctrl+C", "/CopySelection ()")


What this will do, on a Ctrl+C, is try to find the selected text in the output window, and if found, copy it to the clipboard, otherwise execute the DoCommand ("copy") function, which will copy the "normal" selection.

The code above only handles a single-line selection, but you could modify it a bit to handle multiple lines.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #11 on Tue 24 Jul 2007 04:58 AM (UTC)
Message
Here's the script I've been poking with:
function Copy2()
  local line1, line2 = GetSelectionStartLine (), GetSelectionEndLine ()
  local col1, col2 = GetSelectionStartColumn (), GetSelectionEndColumn ()
  if line1 == 0 then
    -- copy command window if output window has nothing
    DoCommand( "copy" )
  else
    local copystring = ""
    local x = col1
    local i = line1
    while i <= line2 do
      if i < line2 then
        copystring = copystring..string.sub(GetLineInfo(i).text, x).."\n"
	x = 1
      else
        copystring = copystring..string.sub(GetLineInfo(i).text, x, col2-1)
        -- subtract 1 from col2 or you get an extra character for some reason
      end
      i = i + 1
      SetClipboard( copystring )
    end
  end
end -- function Copy2

I haven't had any issues so far with it with nearly an hour of testing it out. Everyone feel free to let me know if you can make it break or make the code a bit more smooth than this quick hack job.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #12 on Tue 24 Jul 2007 05:04 AM (UTC)

Amended on Tue 24 Jul 2007 05:05 AM (UTC) by Shaun Biggs

Message
Accelerator ("Ctrl+C", "/Copy2()")
function Copy2()
  local line1, line2 = GetSelectionStartLine (), GetSelectionEndLine ()
  local col1, col2 = GetSelectionStartColumn (), GetSelectionEndColumn ()
  if line1 == 0 then
    DoCommand( "copy" )
  else
    local copystring = ""
    while line1 <= line2 do
      if line1 < line2 then
        copystring = copystring..string.sub(GetLineInfo(line1).text, col1).."\n"
	col1 = 1
      else
        copystring = copystring..string.sub(GetLineInfo(line1).text, col1, col2-1)
      end
      line1 = line1 + 1
    end
    SetClipboard( copystring )
  end
end -- function Copy2

bah, stupid redundant variables... got rid of x and i, since they just mirrored other variables in there anyway. Also moved SetClipboard to the right spot so it doesn't repeatedly copying everything to the clipboard each time it grabs a new line.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #13 on Thu 02 Aug 2007 11:46 AM (UTC)
Message
Is anyone else using my copy function here? I've noticed that it does have one really weird quirk. It only copies on every other press of ctrl-C for some odd reason. Doesn't matter if there is anything in the command window or not, but it will only grab things off the output window on the second try.

I can't really find any reason for this to happen, and I've been testing it for a good three days now that it finally clicked in my head that this was happening.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #14 on Thu 02 Aug 2007 01:43 PM (UTC)
Message
I wasn't using it yet. I've been a bit too busy as of late. It looks very useful, but that quirk is rather depressing; I'd sooner stick with the built-in copying and no focus to command box.

Thanks for your hard work though, I am sure someone has a use for it. (I'll be testing it of course!)
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


94,191 views.

This is page 1, subject is 3 pages long: 1 2  3  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.