mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-10-26 22:10:45 +00:00
replace: scroll to top too
This commit is contained in:
1 parent
cc8494e6e1
commit
9a9f9e5293
3 files changed
+4
-2
No files matched your search
@@ -954,7 +954,8 @@ var isSame;
|
||||
}
|
||||
|
||||
cm.setSelection(cursor.from(), cursor.to());
|
||||
cm.scrollIntoView({ from: cursor.from(), to: cursor.to() });
|
||||
//cm.scrollIntoView({ from: cursor.from(), to: cursor.to() });
|
||||
cm.scrollTo(null, cm.charCoords(cursor.from(), 'local').top); // cXd scroll line to top
|
||||
highlightCurrentMatch(cursor.from(), cursor.to());
|
||||
|
||||
confirmDialog(cm, getDoReplaceConfirm(cm), cm.phrase("Replace?"), [
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
var isSame;!function(t){"object"==typeof exports&&"object"==typeof module?t(require("codemirror")):"function"==typeof define&&define.amd?define(["codemirror"],mod):t(CodeMirror)}((function(t){"use strict";var e=/[\w?.,%]+/;t.registerHelper("hint","anyword",(function(n,i){for(var o=i&&i.word||e,r=i&&i.range||500,s=i&&i.extraWords||EXTRAWORDS,a=n.getCursor(),c=n.getLine(a.line),l=a.ch,h=l;h&&o.test(c.charAt(h-1));)--h;var u=h!=l&&c.slice(h,l);u&&(u=u.toLowerCase()),isSame=s.some((t=>t.toLowerCase()===u));for(var f=i&&i.list||[],d={},p=new RegExp(o.source,"gi"),m=-1;m<=1;m+=2)for(var g=a.line,v=Math.min(Math.max(g+m*r,n.firstLine()),n.lastLine())+m;g!=v;g+=m){var y,C=n.getLine(g),x=(C=(C=C.replace(/\/{2}.*/g,"")).replace(/(=|-|\+|\*|<|>)\d+/g,"")).match(/\w+(?:,(\S+)){2}/);for(x&&(C=C.replace(x[1]," "+x[1])),C.includes("#")&&(p=new RegExp(/[\w?#.,%]+/,"gi"));y=p.exec(C);)g==a.line&&y[0].toLowerCase()===u||u&&0!=y[0].toLowerCase().lastIndexOf(u,0)||Object.prototype.hasOwnProperty.call(d,y[0])||(d[y[0]]=!0,f.push(y[0]))}f.sort(),f.reverse();let b=new Map(f.map((t=>[t.toLowerCase(),t])));(f=[...b.values()]).sort();var w=s.filter((t=>t.toLowerCase().startsWith(u||"")));w.sort(),f=f.concat(w);let N=new Map(f.map((t=>[t.toLowerCase(),t])));return(f=[...N.values()]).sort((function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())})),{list:f,from:t.Pos(a.line,h),to:t.Pos(a.line,l)}}))})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("codemirror")):"function"==typeof define&&define.amd?define(["codemirror"],mod):t(CodeMirror)}((function(t){"use strict";function e(e,n){if(this.cm=e,this.options=n,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length,this.options.updateOnCursorActivity){var i=this;e.on("cursorActivity",this.activityFunc=function(){i.cursorActivity()})}t.signal(this,"startCompletion",this)}t.showHint=function(t,e,n){if(!e)return t.showHint(n);n&&n.async&&(e.async=!0);var i={hint:e};if(n)for(var o in n)i[o]=n[o];return t.showHint(i)},t.defineExtension("showHint",(function(n){n=function(t,e,n){var i=t.options.hintOptions,o={};for(var r in c)o[r]=c[r];if(i)for(var r in i)void 0!==i[r]&&(o[r]=i[r]);if(n)for(var r in n)void 0!==n[r]&&(o[r]=n[r]);o.hint.resolve&&(o.hint=o.hint.resolve(t,e));return o}(this,this.getCursor("start"),n);var i=this.listSelections();if(!(i.length>1)){if(this.somethingSelected()){if(!n.hint.supportsSelection)return;for(var o=0;o<i.length;o++)if(i[o].head.line!=i[o].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();var r=this.state.completionActive=new e(this,n);r.options.hint&&(t.signal(this,"startCompletion",this),r.update(!0))}})),t.defineExtension("closeHint",(function(){this.state.completionActive&&this.state.completionActive.close()}));var n=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},i=window.cancelAnimationFrame||clearTimeout;function o(t){return"string"==typeof t?t:t.text}function r(t,e){for(;e&&e!=t;){if("LI"===e.nodeName.toUpperCase()&&e.parentNode==t)return e;e=e.parentNode}}function s(e,n){this.id="cm-complete-"+Math.floor(Math.random(1e6)),this.completion=e,this.data=n,this.picked=!1;var i=this,s=e.cm,a=s.getInputField().ownerDocument,c=a.defaultView||a.parentWindow,l=this.hints=a.createElement("ul");l.setAttribute("role","listbox"),l.setAttribute("aria-expanded","true"),l.id=this.id;var h=e.cm.options.theme;l.className="CodeMirror-hints "+h,this.selectedHint=n.selectedHint||0;for(var u=n.list,f=0;f<u.length;++f){var d=l.appendChild(a.createElement("li")),p=u[f],m="CodeMirror-hint"+(f!=this.selectedHint?"":" CodeMirror-hint-active");null!=p.className&&(m=p.className+" "+m),d.className=m,f==this.selectedHint&&d.setAttribute("aria-selected","true"),d.id=this.id+"-"+f,d.setAttribute("role","option"),p.render?p.render(d,n,p):d.appendChild(a.createTextNode(p.displayText||o(p))),d.hintId=f}var g=e.options.container||a.body,v=s.cursorCoords(e.options.alignWithWord?n.from:null),y=v.left,C=v.bottom,x=!0,b=0,w=0;if(g!==a.body){var N=-1!==["absolute","relative","fixed"].indexOf(c.getComputedStyle(g).position)?g:g.offsetParent,O=N.getBoundingClientRect(),S=a.body.getBoundingClientRect();b=O.left-S.left-N.scrollLeft,w=O.top-S.top-N.scrollTop}l.style.left=y-b+"px",l.style.top=C-w+"px";var M=c.innerWidth||Math.max(a.body.offsetWidth,a.documentElement.offsetWidth),E=c.innerHeight||Math.max(a.body.offsetHeight,a.documentElement.offsetHeight);g.appendChild(l),s.getInputField().setAttribute("aria-autocomplete","list"),s.getInputField().setAttribute("aria-owns",this.id),s.getInputField().setAttribute("aria-activedescendant",this.id+"-"+this.selectedHint);var H,L=e.options.moveOnOverlap?l.getBoundingClientRect():new DOMRect,T=!!e.options.paddingForScrollbar&&l.scrollHeight>l.clientHeight+1;if(setTimeout((function(){H=s.getScrollInfo()})),L.bottom-E>0){var k=L.bottom-L.top;if(v.top-Line truncated
|
||||
var isSame;!function(t){"object"==typeof exports&&"object"==typeof module?t(require("codemirror")):"function"==typeof define&&define.amd?define(["codemirror"],mod):t(CodeMirror)}((function(t){"use strict";var e=/[\w?.,%]+/;t.registerHelper("hint","anyword",(function(n,i){for(var o=i&&i.word||e,r=i&&i.range||500,s=i&&i.extraWords||EXTRAWORDS,a=n.getCursor(),c=n.getLine(a.line),l=a.ch,h=l;h&&o.test(c.charAt(h-1));)--h;var u=h!=l&&c.slice(h,l);u&&(u=u.toLowerCase()),isSame=s.some((t=>t.toLowerCase()===u));for(var f=i&&i.list||[],d={},p=new RegExp(o.source,"gi"),m=-1;m<=1;m+=2)for(var g=a.line,v=Math.min(Math.max(g+m*r,n.firstLine()),n.lastLine())+m;g!=v;g+=m){var y,C=n.getLine(g),x=(C=(C=C.replace(/\/{2}.*/g,"")).replace(/(=|-|\+|\*|<|>)\d+/g,"")).match(/\w+(?:,(\S+)){2}/);for(x&&(C=C.replace(x[1]," "+x[1])),C.includes("#")&&(p=new RegExp(/[\w?#.,%]+/,"gi"));y=p.exec(C);)g==a.line&&y[0].toLowerCase()===u||u&&0!=y[0].toLowerCase().lastIndexOf(u,0)||Object.prototype.hasOwnProperty.call(d,y[0])||(d[y[0]]=!0,f.push(y[0]))}f.sort(),f.reverse();let b=new Map(f.map((t=>[t.toLowerCase(),t])));(f=[...b.values()]).sort();var w=s.filter((t=>t.toLowerCase().startsWith(u||"")));w.sort(),f=f.concat(w);let N=new Map(f.map((t=>[t.toLowerCase(),t])));return(f=[...N.values()]).sort((function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())})),{list:f,from:t.Pos(a.line,h),to:t.Pos(a.line,l)}}))})),function(t){"object"==typeof exports&&"object"==typeof module?t(require("codemirror")):"function"==typeof define&&define.amd?define(["codemirror"],mod):t(CodeMirror)}((function(t){"use strict";function e(e,n){if(this.cm=e,this.options=n,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length,this.options.updateOnCursorActivity){var i=this;e.on("cursorActivity",this.activityFunc=function(){i.cursorActivity()})}t.signal(this,"startCompletion",this)}t.showHint=function(t,e,n){if(!e)return t.showHint(n);n&&n.async&&(e.async=!0);var i={hint:e};if(n)for(var o in n)i[o]=n[o];return t.showHint(i)},t.defineExtension("showHint",(function(n){n=function(t,e,n){var i=t.options.hintOptions,o={};for(var r in c)o[r]=c[r];if(i)for(var r in i)void 0!==i[r]&&(o[r]=i[r]);if(n)for(var r in n)void 0!==n[r]&&(o[r]=n[r]);o.hint.resolve&&(o.hint=o.hint.resolve(t,e));return o}(this,this.getCursor("start"),n);var i=this.listSelections();if(!(i.length>1)){if(this.somethingSelected()){if(!n.hint.supportsSelection)return;for(var o=0;o<i.length;o++)if(i[o].head.line!=i[o].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();var r=this.state.completionActive=new e(this,n);r.options.hint&&(t.signal(this,"startCompletion",this),r.update(!0))}})),t.defineExtension("closeHint",(function(){this.state.completionActive&&this.state.completionActive.close()}));var n=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},i=window.cancelAnimationFrame||clearTimeout;function o(t){return"string"==typeof t?t:t.text}function r(t,e){for(;e&&e!=t;){if("LI"===e.nodeName.toUpperCase()&&e.parentNode==t)return e;e=e.parentNode}}function s(e,n){this.id="cm-complete-"+Math.floor(Math.random(1e6)),this.completion=e,this.data=n,this.picked=!1;var i=this,s=e.cm,a=s.getInputField().ownerDocument,c=a.defaultView||a.parentWindow,l=this.hints=a.createElement("ul");l.setAttribute("role","listbox"),l.setAttribute("aria-expanded","true"),l.id=this.id;var h=e.cm.options.theme;l.className="CodeMirror-hints "+h,this.selectedHint=n.selectedHint||0;for(var u=n.list,f=0;f<u.length;++f){var d=l.appendChild(a.createElement("li")),p=u[f],m="CodeMirror-hint"+(f!=this.selectedHint?"":" CodeMirror-hint-active");null!=p.className&&(m=p.className+" "+m),d.className=m,f==this.selectedHint&&d.setAttribute("aria-selected","true"),d.id=this.id+"-"+f,d.setAttribute("role","option"),p.render?p.render(d,n,p):d.appendChild(a.createTextNode(p.displayText||o(p))),d.hintId=f}var g=e.options.container||a.body,v=s.cursorCoords(e.options.alignWithWord?n.from:null),y=v.left,C=v.bottom,x=!0,b=0,w=0;if(g!==a.body){var N=-1!==["absolute","relative","fixed"].indexOf(c.getComputedStyle(g).position)?g:g.offsetParent,O=N.getBoundingClientRect(),S=a.body.getBoundingClientRect();b=O.left-S.left-N.scrollLeft,w=O.top-S.top-N.scrollTop}l.style.left=y-b+"px",l.style.top=C-w+"px";var M=c.innerWidth||Math.max(a.body.offsetWidth,a.documentElement.offsetWidth),E=c.innerHeight||Math.max(a.body.offsetHeight,a.documentElement.offsetHeight);g.appendChild(l),s.getInputField().setAttribute("aria-autocomplete","list"),s.getInputField().setAttribute("aria-owns",this.id),s.getInputField().setAttribute("aria-activedescendant",this.id+"-"+this.selectedHint);var H,L=e.options.moveOnOverlap?l.getBoundingClientRect():new DOMRect,T=!!e.options.paddingForScrollbar&&l.scrollHeight>l.clientHeight+1;if(setTimeout((function(){H=s.getScrollInfo()})),L.bottom-E>0){var k=L.bottom-L.top;if(v.top-Line truncated
|
||||
@@ -643,6 +643,7 @@ div.CodeMirror-dragcursors {
|
||||
|
||||
.search-next-highlight {
|
||||
background-color: orange !important;
|
||||
color: black !important;
|
||||
}
|
||||
|
||||
/* Used to force a border model for a node */
|
||||
|
||||
Reference in new issue
Block a user