crlf mode, cursor style config; changed Attrs Word to 3B

legacy-screen
Ondřej Hruška 7 years ago
parent 22101cc000
commit 131389b6a7
  1. 8
      jssrc/term_input.js
  2. 8
      jssrc/term_screen.js
  3. 9
      lang/en.php
  4. 19
      pages/cfg_term.php

@ -22,6 +22,7 @@ var Input = (function() {
mt_click: false, mt_click: false,
mt_move: false, mt_move: false,
no_keys: false, no_keys: false,
crlf_mode: false,
}; };
/** Send a literal message */ /** Send a literal message */
@ -53,7 +54,7 @@ var Input = (function() {
var keymap = { var keymap = {
'tab': '\x09', 'tab': '\x09',
'backspace': '\x08', 'backspace': '\x08',
'enter': '\x0d', 'enter': opts.crlf_mode ? '\x0d\x0a' : '\x0d',
'ctrl+enter': '\x0a', 'ctrl+enter': '\x0a',
'esc': '\x1b', 'esc': '\x1b',
'up': ca('\x1bOA', '\x1b[A'), 'up': ca('\x1bOA', '\x1b[A'),
@ -205,11 +206,12 @@ var Input = (function() {
sendString: sendStrMsg, sendString: sendStrMsg,
/** Enable alternate key modes (cursors, numpad, fn) */ /** Enable alternate key modes (cursors, numpad, fn) */
setAlts: function(cu, np, fn) { setAlts: function(cu, np, fn, crlf) {
if (opts.cu_alt != cu || opts.np_alt != np || opts.fn_alt != fn) { if (opts.cu_alt != cu || opts.np_alt != np || opts.fn_alt != fn || opts.crlf_mode != crlf) {
opts.cu_alt = cu; opts.cu_alt = cu;
opts.np_alt = np; opts.np_alt = np;
opts.fn_alt = fn; opts.fn_alt = fn;
opts.crlf_mode = crlf;
// rebind keys - codes have changed // rebind keys - codes have changed
_bindFnKeys(); _bindFnKeys();

@ -226,15 +226,15 @@ var Screen = (function () {
// console.log("Cursor at ",num, num2); // console.log("Cursor at ",num, num2);
// Attributes // Attributes
num = parse2B(str, i); i += 2; // fg bg attribs num = parse3B(str, i); i += 3;
cursor.hidden = !(num & (1<<0)); // DEC opt "visible" cursor.hidden = !(num & (1<<0)); // DEC opt "visible"
cursor.hanging = !!(num & (1<<1)); cursor.hanging = !!(num & (1<<1));
// console.log("Attributes word ",num.toString(16)+'h');
Input.setAlts( Input.setAlts(
!!(num & (1<<2)), // cursors alt !!(num & (1<<2)), // cursors alt
!!(num & (1<<3)), // numpad alt !!(num & (1<<3)), // numpad alt
!!(num & (1<<4)) // fn keys alt !!(num & (1<<4)), // fn keys alt
!!(num & (1<<12)) // crlf mode
); );
var mt_click = !!(num & (1<<5)); var mt_click = !!(num & (1<<5));
@ -250,6 +250,8 @@ var Screen = (function () {
$('.x-term-conf-btn').toggleClass('hidden', !show_config_links); $('.x-term-conf-btn').toggleClass('hidden', !show_config_links);
$('#action-buttons').toggleClass('hidden', !show_buttons); $('#action-buttons').toggleClass('hidden', !show_buttons);
// bits 9-11 are cursor shape (not implemented)
fg = 7; fg = 7;
bg = 0; bg = 0;
attrs = 0; attrs = 0;

@ -51,6 +51,7 @@ return [
'term.default_fg_bg' => 'Text / background', 'term.default_fg_bg' => 'Text / background',
'term.buttons' => 'Button labels', 'term.buttons' => 'Button labels',
'term.theme' => 'Color scheme', 'term.theme' => 'Color scheme',
'term.cursor_shape' => 'Cursor style',
'term.parser_tout_ms' => 'Parser timeout', 'term.parser_tout_ms' => 'Parser timeout',
'term.display_tout_ms' => 'Redraw delay', 'term.display_tout_ms' => 'Redraw delay',
'term.display_cooldown_ms' => 'Redraw cooldown', 'term.display_cooldown_ms' => 'Redraw cooldown',
@ -58,8 +59,16 @@ return [
'term.show_config_links' => 'Show nav links', 'term.show_config_links' => 'Show nav links',
'term.show_buttons' => 'Show buttons', 'term.show_buttons' => 'Show buttons',
'term.loopback' => 'Local Echo', 'term.loopback' => 'Local Echo',
'term.crlf_mode' => 'Enter sends CR+LF',
'term.button_msgs' => 'Button codes<br>(ASCII, dec, CSV)', 'term.button_msgs' => 'Button codes<br>(ASCII, dec, CSV)',
'cursor.block_blink' => 'Block, blinking',
'cursor.block_steady' => 'Block, steady',
'cursor.underline_blink' => 'Underline, blinking',
'cursor.underline_steady' => 'Underline, steady',
'cursor.bar_blink' => 'I-bar, blinking',
'cursor.bar_steady' => 'I-bar, steady',
// terminal color labels // terminal color labels
'color.0' => 'Black', 'color.0' => 'Black',
'color.1' => 'Red', 'color.1' => 'Red',

@ -108,6 +108,18 @@
<input class="short" type="text" name="btn5" id="btn5" value="%h:btn5%"> <input class="short" type="text" name="btn5" id="btn5" value="%h:btn5%">
</div> </div>
<div class="Row">
<label><?= tr("term.cursor_shape") ?></label>
<select name="cursor_shape" id="cursor_shape">
<option value="0"><?= tr("cursor.block_blink") ?></option>
<option value="2"><?= tr("cursor.block_steady") ?></option>
<option value="3"><?= tr("cursor.underline_blink") ?></option>
<option value="4"><?= tr("cursor.underline_steady") ?></option>
<option value="5"><?= tr("cursor.bar_blink") ?></option>
<option value="6"><?= tr("cursor.bar_steady") ?></option>
</select>
</div>
<div class="Row buttons"> <div class="Row buttons">
<a class="button icn-ok" href="#" onclick="qs('#form-1').submit()"><?= tr('apply') ?></a> <a class="button icn-ok" href="#" onclick="qs('#form-1').submit()"><?= tr('apply') ?></a>
</div> </div>
@ -153,6 +165,12 @@
<input type="hidden" id="fn_alt_mode" name="fn_alt_mode" value="%fn_alt_mode%"> <input type="hidden" id="fn_alt_mode" name="fn_alt_mode" value="%fn_alt_mode%">
</div> </div>
<div class="Row checkbox" >
<label><?= tr('term.crlf_mode') ?></label><!--
--><span class="box" tabindex=0 role=checkbox></span>
<input type="hidden" id="crlf_mode" name="crlf_mode" value="%crlf_mode%">
</div>
<div class="Row checkbox" > <div class="Row checkbox" >
<label><?= tr('term.show_buttons') ?></label><!-- <label><?= tr('term.show_buttons') ?></label><!--
--><span class="box" tabindex=0 role=checkbox></span> --><span class="box" tabindex=0 role=checkbox></span>
@ -179,6 +197,7 @@
<script> <script>
$('#default_fg').val(%default_fg%); $('#default_fg').val(%default_fg%);
$('#default_bg').val(%default_bg%); $('#default_bg').val(%default_bg%);
$('#cursor_shape').val(%cursor_shape%);
$('#theme').val(%theme%); $('#theme').val(%theme%);
function showColor() { function showColor() {

Loading…
Cancel
Save