[Home] [Downloads] [Search] [Help/forum]


Register forum user name 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, 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.
[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  Command window - more flexibility?

Command window - more flexibility?

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


Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Wed 26 Nov 2008 11:00 PM (UTC)

Amended on Wed 26 Nov 2008 11:04 PM (UTC) by Worstje

Message
I'm working on a little plugin (which I hope to share here once done), and running into a few minor problems.

1) I cannot set the position of the cursor, nor select a part of the text.
2) It is hard to track changes as stuff is being edited. Something akin to the OnWorldOutputResized (called OnPluginCommandChanged or something) would be really sweet. I know you can check/prevent stuff after ENTER is pressed with another callback, but that's a very annoying method to use. I could also run a timer that updates every second, but I'm always unhappy with timers - they both need to be turned on and they will also always lag behind a little which I found in the past annoys me with 'live' previews.

Basically, I am making a sort-of squiggly-line preview indicator for when I'm writing paragraphs of text. With the intention of using Ctrl+#n# to jump to the #n#th word that had an incorrect spelling and have it selected right away. On top of that, it would also show stuff with colorcodes and such interpreted properly, since I keep messing those up from time to time.

Edit: I know there is the standard Ctrl+J spellcheck which can pretty much do what I want. It just doesn't work well with my workflow and my own wish to literally preview what I'm writing. :)
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #1 on Fri 28 Nov 2008 12:32 AM (UTC)

Amended on Fri 28 Nov 2008 12:34 AM (UTC) by Worstje

Message
I figured I'd use a screenshot to bump this feature request up a bit. *eyeshift* It still has a lot of little issues I need to resolve (spellcheck hitting parts I don't want it to hit like the WHOMEVER in the screenshot), but hopefully the usefulness of the requested features mentioned in the post above becomes a bit clearer.

http://qs.merseine.nu/images/previewer1.png
[Go to top] top

Posted by Nick Gammon   Australia  (23,042 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Fri 28 Nov 2008 02:19 AM (UTC)
Message
I don't see any objection to adding this.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #3 on Fri 28 Nov 2008 03:56 AM (UTC)

Amended on Fri 28 Nov 2008 02:10 PM (UTC) by Worstje

Message
You, kind sir, are awesome! :D

Edit: on that note, if there's any features said Previewer plugin could use that I haven't thought of yet, please drop me a message and I'll try to put it in. I might as well make it as useful as humanly possible. :)
[Go to top] top

Posted by Nick Gammon   Australia  (23,042 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Sat 14 Feb 2009 02:46 AM (UTC)
Message
Script function SetCommandSelection added to version 4.38.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,042 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Sat 14 Feb 2009 03:02 AM (UTC)

Amended on Sat 14 Feb 2009 03:03 AM (UTC) by Nick Gammon

Message
Plugin callback OnPluginCommandChanged added to version 4.38. This lets you know when the command window has changed.

Example plugin:



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Command_Changed_Test"
   author="Nick Gammon"
   id="9c7ead5da253409e7a033b32"
   language="Lua"
   purpose="tests the OnPluginCommandChanged callback"
   date_written="2009-02-14 15:00"
   requires="4.38"
   version="1.0"
   >

</plugin>

<!--  Script  -->
<script>
<![CDATA[

function OnPluginCommandChanged ()
  print ("command now: '" .. GetCommand () .. "'")
end -- function

]]>
</script>
</muclient>



- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #6 on Sun 15 Feb 2009 04:02 PM (UTC)
Message
*goes to build a shrine in the basement dedicated to MUSHclient!*

I'll go find some time and work on this plugin again to finish up the rough edges I left for when these features were added. :) Thanks, Nick!
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #7 on Thu 19 Feb 2009 09:17 AM (UTC)
Message
A little 'bug' report of sorts that I'd love to see fixed if possible...

If you have a lot of text typed that does not fit in the command window, and you use SetCommandSelection(), the text is selected but out of sight. It would be nice is the visual bit of the edit box also scrolled along so I can see what I selected. Of course, once you go typing it scrolls itself up, but I found it works on my nerves enough to mention it here. :)

Another thing that I noticed with regards to the command window... resizing a world window sets the size of the command window to the height that it would have without auto-sizing on, rather than the height the edit box had prior to that. Nothing that bugs me in this case, but I guess it would be unintentional behaviour. :)
[Go to top] top

Posted by Nick Gammon   Australia  (23,042 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Thu 19 Feb 2009 06:45 PM (UTC)
Message
Quote:

It would be nice is the visual bit of the edit box also scrolled along so I can see what I selected.


I intended to do that, this was the code:


pmyView->GetEditCtrl().SetSel(First - 1, Last, TRUE);


The last argument was supposed to be "should I scroll the selection into view?".

However when I read the documentation more closely:


bNoScroll

Indicates whether the caret should be scrolled into view. If FALSE, the caret is scrolled into view. If TRUE, the caret is not scrolled into view.


So I had it backwards. I have changed it to FALSE for 4.40, which will scroll it into view.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #9 on Fri 20 Feb 2009 11:33 AM (UTC)

Amended on Fri 20 Feb 2009 11:34 AM (UTC) by Worstje

Message
A little 'bug' report...

The new callback OnPluginCommandChanged does not get triggered when you send the command and it clears due to the setting 'Auto-repeat command' being turned off.

I can go implement a workaround with OnPluginCommandEntered, but I'm not sure what kind of side-effects that eventually has if people use it to change the contents of the command window too.
[Go to top] top

Posted by Nick Gammon   Australia  (23,042 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Sat 21 Feb 2009 01:20 AM (UTC)
Message
Hmm, various places where the command window was programmatically changed (ie. other than typing or pasting) were not triggering the "on change" message.

I have tried to find the other places and made them do it too. (eg. if you hit escape to clear the command window).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


17,530 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]