CTRL+Backspace Code

Posted by Samga on Sun 12 Dec 2010 02:27 PM — 10 posts, 56,304 views.

#0
I downloaded the source code for 4.02 and am looking for the key combination code that is CTRL+Backspace taking the last word from the command history and putting it into the command window. I just want to remove it, because I, being a programmer at work, use CTRL+Backspace ALL the time, and sometimes, I'll be playing and need to restart a whole sentence, hitting CTRL+Backspace a lot of times, only to remember what CTRL+Backspace does in MUSHClient.

I was going to suggest adding an option for the way CTRL+Backspace works in Global Preferences or something, but I figured I could just remove it myself.

I'll be sifting through the code to find it, but if one of you knows exactly where it is and can tell me, I'd appreciate it.

Thanks.
Netherlands #1
Have some examples of apps that use Ctrl-Backspace to remove the last word? I never heard of this before (although it does kinda make sense given the effect of Ctrl-Left and Ctrl-Right. Amusing detail though: in MUSHclient, Ctrl-Delete seems to delete everything on the same line after the cursor.

Reason I ask is that Notepad does not have your Ctrl-Backspace functionality, which means it isn't a 'standard' Windows effect. Although it would seem Opera does have this effect as I just tried it out here.

All in all, I'm not opposed at all to making this change to be the default. The old behaviour makes very little practical sense to me personally.
#2
Visual Studio for one. Chrome, Firefox, IE even. Microsoft Word, OpenOffice, Digsby, Pidgin, Yahoo Messenger, MSN Messenger, AIM...I could go on.

Basically, every other application I use, aside from the few ones, like notepad and the command line, does CTRL+Backspace like mentioned.

edit: Also, the CTRL+Delete function you speak of is the same as Notepad's.
Amended on Sun 12 Dec 2010 03:22 PM by Samga
USA #3
btw, newer source code is available on http://github.com/nickgammon/mushclient
Australia Forum Administrator #4
Samga said:

I'll be sifting through the code to find it, but if one of you knows exactly where it is and can tell me, I'd appreciate it.



In sendvw.cpp:


void CSendView::OnRepeatLastWord() 
{
// can't, if no previous command
if (m_msgList.IsEmpty ())
  return;

CString strLine = m_msgList.GetTail ();

  strLine.TrimRight ();

int iPos = strLine.ReverseFind (' ');

CString strWord = strLine.Mid (iPos + 1);

GetEditCtrl().ReplaceSel (strWord, TRUE);

}

Australia Forum Administrator #5
The idea of the original behaviour was this ...

You did some action with something, eg.


punch kobold


And now you want to do something else to it, eg.


kick kobold


So you type:


kick <ctrl+backspace>


That's less keystrokes. It's similar to the Bash shell where you recall the last word with <Esc> .
#6
Is there a way to disable behavior and revert to "normal" ctrl+backspace behavior as mentioned without removing source code?
Australia Forum Administrator #7
What is the normal behaviour exactly?

Anyway you can use the Accelerator script function to do something with it, eg.


Accelerator ("Ctrl+Backspace", "foo" )


Or, AcceleratorTo.
#8
He's referring to the way I described it. For instance, if you go to reply to this thread, and type a few words in the message box, then hit CTRL+Backspace, it deletes the word directly behind your cursor. He was practically hoping that something had been implemented for the user to toggle between the two implementations. Keep your implementation, but allow the user to switch it to the "normal" CTRL+Backspace functionality.
Australia Forum Administrator #9
You can always press Shift+Ctrl+Left-arrow followed by Delete.

That's two keys rather than one, but it lets you delete a whole word.