Skip to content

Commit 72c1930

Browse files
javier-godoypaodb
authored andcommitted
refactor: replace internal use of getOption/setOption with options
Close #55
1 parent 51d2fae commit 72c1930

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/main/java/com/flowingcode/vaadin/addons/xterm/XTermBase.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ private CompletableFuture<JsonValue> invoke(boolean hasResult, String name, Obje
124124
} else {
125125
arg = (Serializable) args[0];
126126
}
127-
return executeJs(false, "this.terminal.setOption($0,$1)", name, arg);
127+
return executeJs(false, "this.terminal.options[$0]=$1", name, arg);
128128
} else if (args == null || args.length == 0) {
129129
return executeJs(hasResult, "return this.terminal[$0]()", name);
130130
} else if (args.length == 1) {
@@ -157,8 +157,8 @@ public XTermBase() {
157157
optionsProxyClass
158158
.getConstructor(InvocationHandler.class)
159159
.newInstance(new ProxyInvocationHandler());
160-
this.terminalProxy = (ITerminal) proxy;
161-
this.terminalOptionsProxy = (ITerminalOptions) proxy;
160+
terminalProxy = (ITerminal) proxy;
161+
terminalOptionsProxy = (ITerminalOptions) proxy;
162162
} catch (InstantiationException
163163
| IllegalAccessException
164164
| InvocationTargetException
@@ -173,7 +173,7 @@ public XTermBase() {
173173
div.getStyle().set("height", "100%");
174174
getElement().appendChild(div);
175175

176-
this.deferredCommands = new LinkedList<>();
176+
deferredCommands = new LinkedList<>();
177177

178178
Registration r[] = new Registration[1];
179179
r[0] = getElement().addEventListener("terminal-initialized", ev -> afterInitialization());

src/main/resources/META-INF/frontend/fc-xterm/xterm-clipboard-mixin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class ClipboardAddon extends TerminalAddon<IClipboardMixin> {
6565
let initializer = ()=>{
6666
//paste with right click
6767
this._disposables.push(onEvent('contextmenu', ev => {
68-
if (this.$.pasteWithRightClick && !terminal.getOption('rightClickSelectsWord')) {
68+
if (this.$.pasteWithRightClick && !terminal.options.rightClickSelectsWord) {
6969
ev.preventDefault();
7070
if (_internalClipboard!==undefined) readText().then(text=>terminal.paste(text));
7171
}

src/main/resources/META-INF/frontend/fc-xterm/xterm-element.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export class XTermElement extends LitElement implements TerminalMixin {
153153
super.connectedCallback();
154154

155155
let term = this.terminal;
156-
term.setOption('convertEol', true);
156+
term.options.convertEol = true;
157157

158158
//onLineFeed doesn't distinguish lines from user input and lines from terminal.write
159159
//<N CSI is handled by console-feature
@@ -164,7 +164,7 @@ export class XTermElement extends LitElement implements TerminalMixin {
164164
//https://gist.github.com/literallylara/7ece1983fab47365108c47119afb51c7
165165
//(C) Lara Sophie Schütt 2016, CC0
166166
for(var i=44100*0.1,d="";i--;)d+=String.fromCharCode(~~((Math.sin(i/44100*2*Math.PI*800)+1)*128));
167-
term.setOption('bellSound',"data:Audio/WAV;base64,"+btoa("RIFFdataWAVEfmt "+atob("EAAAAAEAAQBErAAARKwAAAEACABkYXRh/////w==")+d));
167+
term.options.bellSound = "data:Audio/WAV;base64,"+btoa("RIFFdataWAVEfmt "+atob("EAAAAAEAAQBErAAARKwAAAEACABkYXRh/////w==")+d);
168168

169169
term.attachCustomKeyEventHandler(ev => {
170170
if (ev.type!=='keydown') return false;
@@ -193,7 +193,7 @@ export class XTermElement extends LitElement implements TerminalMixin {
193193
}
194194

195195
_disabledChanged(disabled: boolean) {
196-
this.terminal.setOption('disableStdin', disabled);
196+
this.terminal.options.disableStdin=disabled;
197197
this.terminal.write(disabled?"\x1b[?25l":"\x1b[?25h");
198198
}
199199

0 commit comments

Comments
 (0)