gchq / stroom

Stroom is a highly scalable data storage, processing and analysis platform.
https://gchq.github.io/stroom-docs/
Apache License 2.0
430 stars 55 forks source link

ACE editor has a <hide> button, what is it doing? #2779

Open stroomdev10 opened 2 years ago

stroomdev10 commented 2 years ago

When viewing a large single line source stream, the ACE editor has a clickable <hide> button. Pressing the button appears to switch Word Wrap off, but the Wrap state looks messed up.

at055612 commented 2 years ago

Look for ace_toggle_wrap in stroom-core-client-widget/src/main/java/edu/ycp/cs/dh/acegwt/public/ace/ace.js

Seems if the line is over a set length it adds the button which when clicked will toggle the state of wordwrap but this then puts ace out of sync with what Stroom thinks the wrap state is.

    this.$renderOverflowMessage = function(parent, screenColumn, token, value, hide) {
        token && this.$renderToken(parent, screenColumn, token,
            value.slice(0, this.MAX_LINE_LENGTH - screenColumn));

        var overflowEl = this.dom.createElement("span");
        overflowEl.className = "ace_inline_button ace_keyword ace_toggle_wrap";
        overflowEl.textContent = hide ? "<hide>" : "<click to see more...>";

        parent.appendChild(overflowEl);        
    };

...

            if (dom.hasCssClass(target, "ace_toggle_wrap")) {
                session.setOption("wrap", !session.getUseWrapMode());
                editor.renderer.scrollCursorIntoView();
            }
at055612 commented 2 years ago

When displaying the editor right click menu we may need to ask ace what the wrap state is.