From aaaa37601edeb1faa412780fee546e32bf92f4d2 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Mon, 14 Dec 2020 22:37:21 +0100 Subject: [PATCH] In clients, show text input cursor. --- rogue_chat.html | 4 ++-- rogue_chat_curses.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) 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): -- 2.30.2