Check-in [4fec6e8cc6]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:improve double-click handler in TSB
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4fec6e8cc65d55a5279bdd1179b3af47c50cdf8e
User & Date: chw 2019-07-08 09:12:22
Context
2019-07-10
04:34
better fixes for ticket [36481a3e08] check-in: d5b30d3ec3 user: chw tags: trunk
2019-07-08
09:14
merge with trunk check-in: 104960adc4 user: chw tags: wtf-8-experiment
09:12
improve double-click handler in TSB check-in: 4fec6e8cc6 user: chw tags: trunk
09:10
add tk upstream changes check-in: dd4e9fa22a user: chw tags: trunk
Changes

Changes to undroid/tsb/examples/cheatsheet.tsb.

2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
<center><h2>Taygete Scrap Book Cheat Sheet<br><br></h2></center>} 2 {h3 "Important (internal) global variables"} 3 {table {{global variable}} [info global {[A-Z]*}]} 4 {#HTML
<dl>
 <dt><b>ID</b></dt>
 <dd>The current input field during evaluation, an integer number.</dd>
 <dt><b>W</b></dt>
 <dd>The Webview for displaying the page.</dd>
 <dt><b>H</b></dt>
 <dd>The history array of input fields, keys are integer numbers starting from 1.</dd>

</dl>} 5 {# current state of history array
table {key value} [array get H]} 6 {h3 "Useful procs in the global namespace"} 7 {lsort [info proc {[a-z]*}]} 8 {#HTML
<dl>
 <dt><code><b>gets</b></code>, <code><b>read</b></code></dt>
 <dd>Overriden, reading from <code>stdin</code> channel yields empty
     string.</dd><br>
 <dt><code><b>h1</b> string</code>, <code><b>h2..h5</b></code></dt>







|
>







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<center><h2>Taygete Scrap Book Cheat Sheet<br><br></h2></center>} 2 {h3 "Important (internal) global variables"} 3 {table {{global variable}} [info global {[A-Z]*}]} 4 {#HTML
<dl>
 <dt><b>ID</b></dt>
 <dd>The current input field during evaluation, an integer number.</dd>
 <dt><b>W</b></dt>
 <dd>The Webview for displaying the page.</dd>
 <dt><b>H</b></dt>
 <dd>The history array of input fields, keys are integer numbers
     starting from 1.</dd>
</dl>} 5 {# current state of history array
table {key value} [array get H]} 6 {h3 "Useful procs in the global namespace"} 7 {lsort [info proc {[a-z]*}]} 8 {#HTML
<dl>
 <dt><code><b>gets</b></code>, <code><b>read</b></code></dt>
 <dd>Overriden, reading from <code>stdin</code> channel yields empty
     string.</dd><br>
 <dt><code><b>h1</b> string</code>, <code><b>h2..h5</b></code></dt>

Changes to undroid/tsb/tsb.tcl.

1034
1035
1036
1037
1038
1039
1040










1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061


1062
1063
1064
1065
1066
1067
1068
		if (output.innerHTML.length > 0) {
		    output.style.color = 'inherit';
		    output.innerHTML = '';
		}
	    }
	    needsClear[id] = null;
	};











	var Inhide = function(id, hide) {
	    var input = document.getElementById('in' + id);
	    var outpre = document.getElementById('out' + id + '-pre');
	    var outraw = document.getElementById('out' + id + '-raw');
	    if ((outpre.clientWidth == 0 || outpre.clientHeight == 0) &&
	        (outraw.clientWidth == 0 || outraw.clientHeight == 0)) {
		hide = false;
	    }
	    /* Type coercion! */
	    if (hide == true) {
		input.style.display = 'none';
		outpre.addEventListener('dblclick', function(event) {
		    Inhide(id, 0);
		});
		outraw.addEventListener('dblclick', function(event) {
		    Inhide(id, 0);
		});
	    } else {
		outraw.removeEventListener('dblclick', null);
		outpre.removeEventListener('dblclick', null);


		input.style.display = 'inline';
	    }
	};

	var Winput = function(id, str) {
	    var input = document.getElementById('code' + id);
	    input.value = str;







>
>
>
>
>
>
>
>
>
>












|
|
|
|
|
|
|
|
|
>
>







1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
		if (output.innerHTML.length > 0) {
		    output.style.color = 'inherit';
		    output.innerHTML = '';
		}
	    }
	    needsClear[id] = null;
	};

	var ClrSel = function() {
	    var selection = window.getSelection ?
		window.getSelection() : document.selection ?
		document.selection : null;
	    if (!!selection) {
		selection.empty ?
		    selection.empty() : selection.removeAllRanges();
	    }
	};

	var Inhide = function(id, hide) {
	    var input = document.getElementById('in' + id);
	    var outpre = document.getElementById('out' + id + '-pre');
	    var outraw = document.getElementById('out' + id + '-raw');
	    if ((outpre.clientWidth == 0 || outpre.clientHeight == 0) &&
	        (outraw.clientWidth == 0 || outraw.clientHeight == 0)) {
		hide = false;
	    }
	    /* Type coercion! */
	    if (hide == true) {
		input.style.display = 'none';
		var F = function(event) {
		    outraw.removeEventListener('dblclick', F);
		    outpre.removeEventListener('dblclick', F);
		    Inhide(id, 0);
		    ClrSel();
		    event.returnValue = false;
		    return false;
		};
		outpre.addEventListener('dblclick', F);
		outraw.addEventListener('dblclick', F);
	    } else if (input.style.display === 'none') {
		input.style.display = 'inline';
	    }
	};

	var Winput = function(id, str) {
	    var input = document.getElementById('code' + id);
	    input.value = str;