How to use bell character (BEL, CTRL-G, \x07) with xterm.js? - xtermjs

How do I add use the bell character with Xterm.js? I see a couple of entries in the sources 'options' defaults, but dont get anything whether i send it from the shell or write it directly to the terminal, even with those set to true. I tried overloading the term.bell function with one containing a window.navigator.vibrate, and that works if I call it directly, but doesnt fire in response to a bell character.

Ok. So testing determined nothing is blocking the bell character ("\x07" or "\u0007") from getting through to xterm.js. It just doesnt respond, even if you enable the flags in the options. The code in the source looks like it should work, but something internal is not connected. Since I am avoiding actual changes to the source to make upgrades to xterm.js straightforward and out of the box, I worked a little magic. Here's a hack to get the bell character working:
Make a function that fires on the "message" event from your websocket. In it, check for a match for BEL. Then have it do your voodoo if it detects it. Something like:
sock.addEventListener('message',function(v){ if(v.match(/\x07/)){ /*voodoo here*/ } });
Where v is event, \x07 is BEL, and voodoo is code or an invocation to blip the screen white briefly, make a chirp, vibrate if your getting around on "mobile", or open a portal to the single-sock dimension.
Annoyingly, now I need to look up more ansi codes and find a pattern, as some end in a BEL character. So this will work by itself, but will be set off by some codes not intended to act as BEL, because they contain that character. More on this later....
FYI, not sure if this works with term.attach(). I have my own thing that does some preprocessing anyway, so basically all I had to do was splice in the if/match, but cut that out, the above code is the minimal cut-paste version.
Hope this helps someone else. Bug out.

Related

Why don't Proximity Prompts work without a character?

I'm in a pickle. (not literally, of course)
I had a ship game, which used Proximity Prompts to enter the docks. This worked well enough. However, that was for a click to move system, and now I'm attempting to make a direct control system (e.g. you press WASD to move your ship instead of clicking a point on the ocean), and as such, there is no character in the game, and have done everything else without a character.
In short: They don't work now and I have no clue why.
The script is near enough the exact same on both games (The original game's script has a lot more other functions in it, but nothing that would affect this), and so is the configuration of the Proximity Prompt. But I don't see how it could be to do with the lack of a player Character, and if it is, how do I edit the default code for it, to work without one? (I had a look, but couldn't find anything useful) As it doesn't seem like it will have direct dependence on the character, as any animations or custom behaviour would have to be done connecting to the ProximityPromptService/Prompt itself to add those via the events.
This is literally the whole server-side script I have for it.
local proximitypromptservice = game:GetService("ProximityPromptService")
local function get_player_data (player)
... --Unrelated, it's just a function to get player data, no issues here.
end
proximitypromptservice.PromptTriggered:Connect(function(promptobject,player)
print("Prompt TRIGGERED") --Not seen in the log when the Prompt is pressed.
if promptobject.Name == "DockControl" then
print("DOCKCONTROL")
if player.IsLoading.Value == false then
game.ReplicatedStorage.Dock.AccessDock:Fire(player,...)
end
end
end)
It's probably worth noting that when you press the key, e.g. E, it does the hold Duration animation and then disappears, and reappears as you'd normally expect. Creating a custom docking system is not out of the question, but I would really really prefer not to create an overcomplicated, clunky system for something that should work out of the box.
Any help would be appreciated,
The Frog.
PS: Also tried this on both local and server scripts as a child of the prompt to no avail.
script.Parent.Triggered:Connect(function()
print("TRIGGERED")
end)

Going back up a line in psql shell

Does anyone know a short cut to going back up a line in psql? I've tried ending with ); and then hitting the up arrow. I can retrieve the line of code that I want and then correct it, but then what? The initial mistake prevented me from CREATING A TABLE, so do I recreate the remaining lines of code from this point forward to finish creating the table. I'm trying to avoid retyping 10 lines of information. I'm using the postgres database and the instructor accomplishing this with very little effort; however, I cannot see the commands he is using to recreate several lines of text which a appear to use only one key. If you look at 52:00 - 53:00 on the instructional video timeline you will see what I mean. After he ends the code with ); He immediately recreates the previous block of code. How does he do this?
Video Link
https://www.youtube.com/watch?v=qw--VYLpxG4
They just cut out parts of the video. No big magic there.
But you could use \e to start your default editor containing the last command you sent. That may be the most efficient way to do this.

UITextView, with spell checking, how to use `ignoreWord`?

Regarding the spell checking in iOS, it's possible to tell the checker to ignore a word (or learn a word),
https://developer.apple.com/documentation/uikit/uitextchecker
func ignoreWord(String)
Tells the receiver to ignore the specified word when spell-checking.
- Apple doco
Say I have a UITextView which opens. I want spell checking On.
I know the user may type "fattie" which would get the red underline.
How do I tell that text view in that instance, to, ignore "fattie" ?
An obvious use case ...
User is typing in "#tag" type friends; in our data of course we know what all the tags are, it's absurd they get marked as spelling errors.
It seems incredible one can't just say "don't underline these words - - list".
Code example ....
So we have
var t: UITextView
and then, there must be "some way" to:
yourTextView.something->something.textChecker.ignoreWord("fattie"
.. some way to get to the text view's textChecker instance! How ?!?!
Partial answer: I just stumbled on to that, bizarrely, you can just call
UITextChecker.learnWord("fattie")
UITextChecker.learnWord("blahdee")
from, apparently, just anywhere in an app.
However this raises many issues,
• How to call the 'ignore' one, which seems better
• That one still makes the user tap the annoying, stupid, "in quotes" OK box in the suggestions bar - it seems to have not really "learned" anything
• Disturbingly, I think this goes for the "WHOLE PHONE". I only want it in that instance of the user using that text view.
A mystery!

Making tagsoup markup cleansing optional

Tagsoup is interfering with input and formatting it incorrectly. For instance when we have the following markup
Text outside anchor
It is formatted as follows
Text outside anchor
This is a simple example but we have other issues as well. So we made tagsoup cleanup/formatting optional by adding an extra attribute to textarea control.
Here is the diff(https://github.com/binnyg/orbeon-forms/commit/044c29e32ce36e5b391abfc782ee44f0354bddd3).
Textarea would now look like this
<textarea skip-cleanmarkup="true" mediatype="text/html" />
Two questions
Is this the right approach?
If I provide a patch can it make it to orbeon codebase?
Thanks
BinnyG
Erik, Alex, et al
I think there are two questions here:
The first Concern is a question of Tag Soup and the clean up that happens OOTB: Empty tags are converted to singleton tags which when consumed/sent to the client browser as markup gets "fixed" by browsers like firefox but because of the loss of precision they do the wrong thing.
Turning off this clean up helps in this case but for this issue alone is not really the right answer because we it takes away a security feature and a well-formed markup feature... so there may need to be some adjustment to the handling of at least certain empty tags (other than turning them in to invalid singleton tags.)
All this brings us to the second concern which is do we always want those features in play? Our use-case says no. We want the user to be able to spit out whatever markup they want, invalid or not. We're not putting the form in an app that needs to protect the user from cross script coding, we're building a tool that lets users edit web pages -- hence we have turned off the clean-up.
But turning off cleanup wholesale? Well it's important that we can do it if that's what our usecase calls for but the implementation we have is all or nothing. It would be nice to be able to define strategies for cleanup. Make that function plug-able. For example:
* In the XML Config of the system define a "map" of config names to class names which implement the a given strategy. In the XForm Def the author would specify the name from the map.
If TagSoup transforms:
Text outside anchor
Into:
Text outside anchor
Wouldn't that be bug in TagSoup? If that was the case, then I'd say that it is better to fix this issue rather than disable TagSoup. But, it isn't a bug in TagSoup; here is what seems to be happening. Say the browsers sends the following to the client:
<a shape="rect"></a>After<br clear="none">
This goes through TagSoup, the result goes through the XSLT clean-up code, and the following is sent to the browser:
<a shape="rect"/>After<br clear="none"/>
The issue is on the browser, which transforms this into:
<a shape="rect">After</a><br clear="none"/>
The problem is that we serialize this as XML with Dom4jUtils.domToString(cleanedDocument), while it would be more prudent to serialize it as HTML. Here we could use the Saxon serializer. It is also used from HTMLSerializer. Maybe you can try changing this code to use it instead of using Dom4jUtils.domToString(). You'll let us know what you find when a get a chance to do that.
Binesh and I agree, if there is a bug it would be a good idea to address the issue closer to the root. But I think the specific issue he is only part of the matter.
We're thinking it would be best to have some kind of name-to-strategy mapping so that RTEs can call in the server-side processing that is right for them or the default if it's not specified.

special character coming when i am using & and p

I dont know what exactly i have to type in title for this ,i tried my best
anyway coming to topic
I am making one acc checker for that purpose ,i am sending user and pass from my bsskinedit1 and bsskinedit2
here is my code
s:='http:\\site.com..premlogin='+bsskinedit.text+'&password='+bsskinedit2.text
but it giving some error ,then i used showmessage whats wrong with it then i came with strange result
see below
observer after 4 & and p combining together and appearing as a some new symbol :(
can any one tell me why its coming like this ?
Your code (where you build the URL) is most likely correct (I guess the above has some typos?!), but when you display the URL in a label for instance, the & character is treated as indicator for an accelerator key.
By Windows design, accelerator keys
enable the user to access a menu
command from the keyboard by pressing
Alt along the appropriate letter,
indicated in your code by the
preceding ampersand (&). The character
after the and sign (&) appears
underlined in the menu.
If you want to display the & character itself, you have to set your string variable to &&.
By placing two ampesands together - you state that the character following the first one is not used as the accelerator - rather you actually want to get it (only one) displayed.
Just use your debugger if you want to see the real value that your string variables have, don't output them to a message box or the like... It may have side effects, as you can see.
Regarding the URL you build: I can't possibly know how it has to be correctly, but at least you should use the right slashes!
s := 'http://site.com...'
(All quotes from delphi.about.com)
In addition to what Mef said, you can use OutputDebugString to add your string to the event log in its raw form, so you don't need to modify it before displaying it. Delphi should capture those strings automatically if you're running from the debugger. If you aren't running it from Delphi you can use DebugView instead, which captures the messages from any running applications.

Resources