From: Christian Heller Date: Mon, 14 Dec 2020 21:37:21 +0000 (+0100) Subject: In clients, show text input cursor. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/balance?a=commitdiff_plain;h=aaaa37601edeb1faa412780fee546e32bf92f4d2;p=plomrogue2 In clients, show text input cursor. --- diff --git a/rogue_chat.html b/rogue_chat.html index 31a85a5..26e6bf8 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -970,7 +970,7 @@ let tui = { recalc_input_lines: function() { if (this.mode.has_input_prompt) { let _ = null; - [this.input_lines, _] = this.msg_into_lines_of_width(this.input_prompt + this.inputEl.value, this.window_width); + [this.input_lines, _] = this.msg_into_lines_of_width(this.input_prompt + this.inputEl.value + '█', this.window_width); } else { this.input_lines = []; } @@ -1554,7 +1554,7 @@ document.onclick = function() { }; tui.inputEl.addEventListener('keydown', (event) => { tui.show_help = false; - if (event.key == 'Enter') { + if (['Enter', 'ArrowLeft', 'ArrowRight'].includes(event.key)) { event.preventDefault(); } if ((!tui.mode.is_intro && event.key == 'Escape') diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 8eec3f6..07c8697 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -885,7 +885,8 @@ class TUI: if not self.mode.has_input_prompt: self.input_lines = [] else: - self.input_lines = msg_into_lines_of_width(input_prompt + self.input_, + self.input_lines = msg_into_lines_of_width(input_prompt + + self.input_ + '█', self.window_width) def move_explorer(direction):