Would be better to simply execute the current selection, whatever it is.
So just take the string from field.selectionStart to field.selectionEnd
On 2012-07-13 09:53, Thirion wrote:
SquirreL SQL does that. Works really well too.
I guess for JSP pages you could add something like this to get the
current cursor index:
<script type = "text/javascript">
function showCursorPos(myField){
if (myField.selectionStart || myField.selectionStart
== '0') {
alert('Cursor is on index ' + myField.selectionStart);
}else{
alert('dunno');
}
}
</script>
<form name = "myform">
<textarea name = "txtQuery" rows = "10" cols = "50">Blah
blah, fishpaste</textarea>
<br><br>
<input type ="button" value="Get Cursor Index"
onclick="showCursorPos(document.myform.txtQuery )">
</form>
You can then search backward until you either reach the beginning or
an empty line and use that as the start index, and search forward
until you either reach the end or an empty line as the end index. If
the browser doesn't support the syntax, just use the current behaviour.
I quickly tested this and it gave me the correct index using Chrome,
IE and Firefox.
--
You received this message because you are subscribed to the Google
Groups "H2 Database" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/h2-database/-/tpx2IM-l64AJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.