diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-22 15:38:00 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-22 15:38:00 -0500 |
commit | 7ec31cd46f8fa08747ef27d4a143881b662259c0 (patch) | |
tree | b1a1f11e3e7878bcae40ba7d36da5078d6ebd0b2 | |
parent | 6d4330fd09f81e042f5fa81566567ca0234ae3eb (diff) | |
download | teleterm-7ec31cd46f8fa08747ef27d4a143881b662259c0.tar.gz teleterm-7ec31cd46f8fa08747ef27d4a143881b662259c0.zip |
also draw the cursor
-rw-r--r-- | teleterm-web/src/views/terminal.rs | 18 | ||||
-rw-r--r-- | teleterm/static/teleterm_web.js | 48 | ||||
-rw-r--r-- | teleterm/static/teleterm_web_bg.wasm | bin | 716255 -> 716386 bytes |
3 files changed, 39 insertions, 27 deletions
diff --git a/teleterm-web/src/views/terminal.rs b/teleterm-web/src/views/terminal.rs index 1cfb8ab..a8a0ba0 100644 --- a/teleterm-web/src/views/terminal.rs +++ b/teleterm-web/src/views/terminal.rs @@ -8,6 +8,7 @@ pub(crate) fn render(model: &crate::model::Model) -> Node<crate::Msg> { return seed::empty![]; }; let (rows, cols) = screen.size(); + let (cursor_row, cursor_col) = screen.cursor_position(); let mut grid = vec![]; for row_idx in 0..rows { @@ -20,7 +21,12 @@ pub(crate) fn render(model: &crate::model::Model) -> Node<crate::Msg> { } row.push(seed::td![ seed::attrs! { At::Class => "cell" }, - style_for_cell(cell), + style_for_cell( + cell, + cursor_row == row_idx + && cursor_col == col_idx + && !screen.hide_cursor() + ), contents ]) } @@ -30,10 +36,16 @@ pub(crate) fn render(model: &crate::model::Model) -> Node<crate::Msg> { seed::table![seed::attrs! { At::Class => "grid" }, grid] } -fn style_for_cell(cell: &vt100::Cell) -> seed::dom_types::Style { +fn style_for_cell( + cell: &vt100::Cell, + is_cursor: bool, +) -> seed::dom_types::Style { let mut fgcolor = cell.fgcolor(); let mut bgcolor = cell.bgcolor(); - if cell.inverse() { + if is_cursor { + fgcolor = vt100::Color::Rgb(0, 0, 0); + bgcolor = vt100::Color::Rgb(0, 0xff, 0); + } else if cell.inverse() { if fgcolor == bgcolor { fgcolor = vt100::Color::Rgb(0, 0, 0); bgcolor = vt100::Color::Rgb(0xd3, 0xd3, 0xd3); diff --git a/teleterm/static/teleterm_web.js b/teleterm/static/teleterm_web.js index d886582..713ad13 100644 --- a/teleterm/static/teleterm_web.js +++ b/teleterm/static/teleterm_web.js @@ -21,22 +21,22 @@ function __wbg_elem_binding0(arg0, arg1, arg2) { wasm.__wbg_function_table.get(75)(arg0, arg1, addHeapObject(arg2)); } function __wbg_elem_binding1(arg0, arg1, arg2) { - wasm.__wbg_function_table.get(296)(arg0, arg1, addHeapObject(arg2)); -} -function __wbg_elem_binding2(arg0, arg1, arg2) { wasm.__wbg_function_table.get(75)(arg0, arg1, addHeapObject(arg2)); } -function __wbg_elem_binding3(arg0, arg1) { +function __wbg_elem_binding2(arg0, arg1) { wasm.__wbg_function_table.get(227)(arg0, arg1); } +function __wbg_elem_binding3(arg0, arg1, arg2) { + wasm.__wbg_function_table.get(296)(arg0, arg1, addHeapObject(arg2)); +} function __wbg_elem_binding4(arg0, arg1, arg2) { wasm.__wbg_function_table.get(75)(arg0, arg1, addHeapObject(arg2)); } function __wbg_elem_binding5(arg0, arg1, arg2) { - wasm.__wbg_function_table.get(79)(arg0, arg1, arg2); + wasm.__wbg_function_table.get(75)(arg0, arg1, addHeapObject(arg2)); } function __wbg_elem_binding6(arg0, arg1, arg2) { - wasm.__wbg_function_table.get(75)(arg0, arg1, addHeapObject(arg2)); + wasm.__wbg_function_table.get(79)(arg0, arg1, arg2); } function __wbg_elem_binding7(arg0, arg1, arg2, arg3, arg4) { wasm.__wbg_function_table.get(323)(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4)); @@ -884,14 +884,14 @@ function init(module) { imports.wbg.__wbindgen_throw = function(arg0, arg1) { throw new Error(getStringFromWasm(arg0, arg1)); }; - imports.wbg.__wbindgen_closure_wrapper322 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper320 = function(arg0, arg1, arg2) { const state = { a: arg0, b: arg1, cnt: 1 }; const real = (arg0) => { state.cnt++; const a = state.a; state.a = 0; try { - return __wbg_elem_binding4(a, state.b, arg0); + return __wbg_elem_binding0(a, state.b, arg0); } finally { if (--state.cnt === 0) wasm.__wbg_function_table.get(76)(a, state.b); else state.a = a; @@ -902,16 +902,16 @@ function init(module) { const ret = real; return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper656 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper1078 = function(arg0, arg1, arg2) { const state = { a: arg0, b: arg1, cnt: 1 }; - const real = () => { + const real = (arg0) => { state.cnt++; const a = state.a; state.a = 0; try { - return __wbg_elem_binding3(a, state.b, ); + return __wbg_elem_binding3(a, state.b, arg0); } finally { - if (--state.cnt === 0) wasm.__wbg_function_table.get(228)(a, state.b); + if (--state.cnt === 0) wasm.__wbg_function_table.get(297)(a, state.b); else state.a = a; } } @@ -920,16 +920,16 @@ function init(module) { const ret = real; return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper1076 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper314 = function(arg0, arg1, arg2) { const state = { a: arg0, b: arg1, cnt: 1 }; const real = (arg0) => { state.cnt++; const a = state.a; state.a = 0; try { - return __wbg_elem_binding1(a, state.b, arg0); + return __wbg_elem_binding4(a, state.b, arg0); } finally { - if (--state.cnt === 0) wasm.__wbg_function_table.get(297)(a, state.b); + if (--state.cnt === 0) wasm.__wbg_function_table.get(76)(a, state.b); else state.a = a; } } @@ -945,7 +945,7 @@ function init(module) { const a = state.a; state.a = 0; try { - return __wbg_elem_binding5(a, state.b, arg0); + return __wbg_elem_binding6(a, state.b, arg0); } finally { if (--state.cnt === 0) wasm.__wbg_function_table.get(76)(a, state.b); else state.a = a; @@ -956,14 +956,14 @@ function init(module) { const ret = real; return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper318 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper322 = function(arg0, arg1, arg2) { const state = { a: arg0, b: arg1, cnt: 1 }; const real = (arg0) => { state.cnt++; const a = state.a; state.a = 0; try { - return __wbg_elem_binding2(a, state.b, arg0); + return __wbg_elem_binding1(a, state.b, arg0); } finally { if (--state.cnt === 0) wasm.__wbg_function_table.get(76)(a, state.b); else state.a = a; @@ -974,16 +974,16 @@ function init(module) { const ret = real; return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper320 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper658 = function(arg0, arg1, arg2) { const state = { a: arg0, b: arg1, cnt: 1 }; - const real = (arg0) => { + const real = () => { state.cnt++; const a = state.a; state.a = 0; try { - return __wbg_elem_binding6(a, state.b, arg0); + return __wbg_elem_binding2(a, state.b, ); } finally { - if (--state.cnt === 0) wasm.__wbg_function_table.get(76)(a, state.b); + if (--state.cnt === 0) wasm.__wbg_function_table.get(228)(a, state.b); else state.a = a; } } @@ -992,14 +992,14 @@ function init(module) { const ret = real; return addHeapObject(ret); }; - imports.wbg.__wbindgen_closure_wrapper314 = function(arg0, arg1, arg2) { + imports.wbg.__wbindgen_closure_wrapper318 = function(arg0, arg1, arg2) { const state = { a: arg0, b: arg1, cnt: 1 }; const real = (arg0) => { state.cnt++; const a = state.a; state.a = 0; try { - return __wbg_elem_binding0(a, state.b, arg0); + return __wbg_elem_binding5(a, state.b, arg0); } finally { if (--state.cnt === 0) wasm.__wbg_function_table.get(76)(a, state.b); else state.a = a; diff --git a/teleterm/static/teleterm_web_bg.wasm b/teleterm/static/teleterm_web_bg.wasm Binary files differindex ace642f..e1061ef 100644 --- a/teleterm/static/teleterm_web_bg.wasm +++ b/teleterm/static/teleterm_web_bg.wasm |