mIRC Home    About    Download    Register    News    Help

Print Thread
"/" works in focused editbox. #225265 29/08/10 06:09 PM
Joined: Aug 2010
Posts: 134
T
Thels Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Quote:
Hint: If you type / into an editbox and press the enter key, it will show the last line you entered in that editbox. If you type /! it will show the last line you typed in the last window you were in.


When you use "/editbox -an /" or "/editbox -ano /", it will recall the last line entered in whatever editbox has focus, and not necessarily the editbox in which the "/" command was entered.

If that is working as intended, then I think the help file should receive a small clarification.

Reproduction:

Make the following alias:
Code:
alias f6 editbox -an /


Use Alt-Q to enable the 2nd editbox.
Enter "first" in the first editbox and press enter.
Enter "second" in the second editbox and press enter.
Enter "text" in the first editbox, without pressing enter.
Select the second editbox.
Press F6.

The text in the first editbox disappears, which indicates that editbox correctly executed in the first editbox. However, it recalls the text "second" in the second editbox, because that editbox has focus.


Learning something new every day.
Re: "/" works in focused editbox. [Re: Thels] #225320 30/08/10 01:47 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
All it's doing is clearing the first editbox. It's still showing the last line entered from the active editbox, which is what the help file says it does.

In your example, the / is done from the second editbox, not the first because the second one is active.

Quote:
it will show the last line you entered in that editbox


"that" means the current (active) editbox where the / was done. When you press F6, it's sending it from the active editbox. I'm not sure why you think it should be sending it from the inactive editbox.

That said, there is a bug either in the help file or in how it's working. It does not press enter. My guess is that it's because of how the / part works, but that should be explained better in the help file or else changed to work as you'd expect it to.

Quote:
The -n switch fills the editbox and presses the enter key in the editbox.


You can test that with a single editbox and your alias. It will show the last text, but won't press enter. I think that may be where you're getting confused. It's clearing the first editbox, so you think it's pressing enter, but that part is working normally (though I don't know why it's clearing the first one). The issue is just that it doesn't press enter.


Invision Support
#Invision on irc.irchighway.net
Re: "/" works in focused editbox. [Re: Riamus2] #225321 30/08/10 03:33 PM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
Riamus2, the command "/" is being executed in the first editbox, but is acting on the active editbox (the second editbox) instead of the editbox where the "/" command was input (the first editbox). Of course, these can only be different when using the "/editbox" command.

(To be clear, notice that the "-a" switch with /editbox means it is inputting the text on the active WINDOW, not the active editbox. The "-o" switch is used to reference the second editbox, while otherwise the first editbox is assumed.)

Similarly, typing "/editbox -n windowname /" into a window other than windowname will cause nothing to happen except clearing the contents of the first editbox of windowname.

Again, to be clear, the bug here is that the command "/" does not work as expected when it is input into an editbox that is not the active editbox.

As for the last part of your post, I don't see any issue with "/editbox -n". It does in fact press ENTER in any test I've tried.

Re: "/" works in focused editbox. [Re: drum] #225346 31/08/10 08:44 AM
Joined: Aug 2010
Posts: 134
T
Thels Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Agree with drum there.

It does insert "/" and then press enter. After that, the last line is recalled, and of course it doesn't press enter again (we don't want it to.) If you'd want it to press enter again, thereby repeating the history line, you'd have to use a 0 second timer, and then "/editbox -avn", which should press enter without changing the contents first (I didn't test this).

I haven't tried executing "/" in editboxes for other windows. I did execute "/!" in the Status Window while it was not the active window, and then recall the contents with $editbox(Status Window), and that worked fine. Unfortunately, "/!" does not allow you to keep stepping back like "/" does.

As for my example, if you change the alias to:

Code:
alias f6 editbox -afn /


You will then notice that it does recall the text in the left editbox, not the right one.

Last edited by Thels; 31/08/10 08:45 AM.

Learning something new every day.
Re: "/" works in focused editbox. [Re: Thels] #225353 31/08/10 04:18 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Originally Posted By: Thels
It does insert "/" and then press enter.


Yeah, it does that. I wasn't thinking about that when I replied. wink

In any case, I think it *should* show the last line in the active editbox regardless where mIRC's running that command. I don't think mIRC is handling that second editbox correctly in this case. I think the / should be done in the active editbox as well. It doesn't make sense to have it working in an inactive editbox on the active window instead of the active editbox in the active window for the original example, imo.


Invision Support
#Invision on irc.irchighway.net
Re: "/" works in focused editbox. [Re: Riamus2] #225369 31/08/10 09:03 PM
Joined: Aug 2010
Posts: 134
T
Thels Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Originally Posted By: Riamus2
In any case, I think it *should* show the last line in the active editbox regardless where mIRC's running that command.


It could be considered a sense of logic. I myself disagree.

Normally, when a user manually enters "/", of course you want the result to be in the active editbox, but since you can only manually enter it in the active editbox, that's a non-issue.

If a script runs "/" in a specific editbox, it feels natural to me, that the effect should occur in that specific editbox, and not whatever editbox the user happens to be selecting.

Last edited by Thels; 31/08/10 09:03 PM.

Learning something new every day.
Re: "/" works in focused editbox. [Re: Riamus2] #225377 31/08/10 11:56 PM
Joined: Dec 2002
Posts: 344
D
drum Offline
Pan-dimensional mouse
Offline
Pan-dimensional mouse
D
Joined: Dec 2002
Posts: 344
Originally Posted By: Riamus2
In any case, I think it *should* show the last line in the active editbox regardless where mIRC's running that command. I don't think mIRC is handling that second editbox correctly in this case. I think the / should be done in the active editbox as well.


The whole point of "/editbox -n" is to be able to simulate commands executed in an editbox other than the active one. What good is that if the command operates on the active editbox instead of the editbox in which the command was executed?

Re: "/" works in focused editbox. [Re: drum] #225381 01/09/10 01:24 AM
Joined: Dec 2002
Posts: 5,036
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,036
The reason for this is that /editbox by default works on the main editbox and not the command editbox. However all editbox processing routines work on the editbox with the focus. So the routines are getting confused.

Pressing the F6 with "alias f6 editbox -an /" should only affect the main editbox, regardless of which editbox has the focus. This will be fixed in the next version.

Re: "/" works in focused editbox. [Re: Khaled] #225709 08/09/10 11:43 AM
Joined: Aug 2010
Posts: 134
T
Thels Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
Just tried it with 7.11, and there it works as expected, without the need to change focus smile.

A question, though.

Quote:
44.Extended /editbox -fN switch, where N = 1 sets focus and N = 2 uses editbox with current focus.


The -o switch (or lack thereof) was the switch that determined which editbox was selected, while the -f switch was setting focus to that editbox.

Now -f or -f1 causes an action (set focus), while -f2 determines which box is selected.

Wouldn't it be better to use the -o switch for it?

"-o" or "-o1" = use secondary editbox.
"-o2" = use editbox with focus.


Learning something new every day.
Re: "/" works in focused editbox. [Re: Thels] #225720 08/09/10 04:18 PM
Joined: Dec 2002
Posts: 5,036
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,036
The -f switch in previous and current versions is used to set the focus to the main editbox. If used with -o it sets the focus to the second editbox.

The -f2 switch, on the other hand, does not set focus. It uses the editbox which has the focus. This allows you to create an alias that uses /editbox -f2 to work with the editbox that currently has the focus.

Re: "/" works in focused editbox. [Re: Khaled] #225747 08/09/10 08:28 PM
Joined: Aug 2010
Posts: 134
T
Thels Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Aug 2010
Posts: 134
I understand that. I just fail to see the logic of using "-f2", since -f and -f2 do two completely different things.

-f changes the active focus, -f2 does not.

-f2 affects which editbox is affected by the command, -f does not.

It works as you said it does, it just feels weird to have one switch do two completely different things. So it's more of a suggestion than a bug report.

Since -o influences on which editbox the command works, -f2 is much closer to -o than to -f. Therefor, -o2 makes more sense than -f2 does. That could just be my opinion, though.

If you use both -f2 and -o, -f2 takes priority.

Either way, thanks for the fix, and the extra feature smile


Learning something new every day.