diff --git a/copyparty/web/md.css b/copyparty/web/md.css
index 39a9b1d7..495de5a7 100644
--- a/copyparty/web/md.css
+++ b/copyparty/web/md.css
@@ -212,6 +212,10 @@ blink {
#toolsbox a+a {
text-decoration: none;
}
+ #lno {
+ position: absolute;
+ right: 0;
+ }
diff --git a/copyparty/web/md.html b/copyparty/web/md.html
index e38c069d..a4b482bf 100644
--- a/copyparty/web/md.html
+++ b/copyparty/web/md.html
@@ -26,6 +26,7 @@
non-ascii: whitelist
help
+ L#
{%- else %}
edit (basic)
edit (fancy)
diff --git a/copyparty/web/md2.js b/copyparty/web/md2.js
index 42f22553..899f0022 100644
--- a/copyparty/web/md2.js
+++ b/copyparty/web/md2.js
@@ -875,6 +875,40 @@ function cfg_uni(e) {
}
+var set_lno = (function () {
+ var t = null,
+ pi = null,
+ pv = null,
+ lno = ebi('lno');
+
+ function poke() {
+ clearTimeout(t);
+ t = setTimeout(fire, 20);
+ }
+
+ function fire() {
+ try {
+ clearTimeout(t);
+
+ var i = dom_src.selectionStart;
+ if (i === pi)
+ return;
+
+ var v = 'L' + dom_src.value.slice(0, i).split('\n').length;
+ if (v != pv)
+ lno.innerHTML = v;
+
+ pi = i;
+ pv = v;
+ }
+ catch (e) { }
+ }
+
+ timer.add(fire);
+ return poke;
+})();
+
+
// hotkeys / toolbar
(function () {
function keydown(ev) {
@@ -893,6 +927,8 @@ function cfg_uni(e) {
if (document.activeElement != dom_src)
return true;
+ set_lno();
+
if (ctrl(ev)) {
if (ev.code == "KeyH" || kc == 72) {
md_header(ev.shiftKey);
diff --git a/docs/notes.sh b/docs/notes.sh
index a4063842..aa3df7c2 100644
--- a/docs/notes.sh
+++ b/docs/notes.sh
@@ -79,10 +79,8 @@ command -v gdate && date() { gdate "$@"; }; while true; do t=$(date +%s.%N); (ti
# get all up2k search result URLs
var t=[]; var b=document.location.href.split('#')[0].slice(0, -1); document.querySelectorAll('#u2tab .prog a').forEach((x) => {t.push(b+encodeURI(x.getAttribute("href")))}); console.log(t.join("\n"));
-# rename all selected songs to + +
-var sel=msel.getsel(), ci=find_file_col('Title')[0], re=[]; for (var a=0; a {if (rsp.ok) f(); }); }; f();
+# debug md-editor line tracking
+var s=mknod('style');s.innerHTML='*[data-ln]:before {content:attr(data-ln)!important;color:#f0c;background:#000;position:absolute;left:-1.5em;font-size:1rem}';document.head.appendChild(s);
##
## bash oneliners
diff --git a/srv/test.md b/srv/test.md
index 7338b982..05affa33 100644
--- a/srv/test.md
+++ b/srv/test.md
@@ -1,11 +1,17 @@
### hello world
* qwe
-* asd
- * zxc
- * 573
- * one
- * two
+* rty
+* uio
+ * asd
+ * fgh
+ * jkl
+ * zxc
+ * vbn
+ * 573
+ * one
+ * two
+ * three
* |||
|--|--|