Skip to content

Commit

Permalink
Don't disable inputs immediately after submitting an input event
Browse files Browse the repository at this point in the history
  • Loading branch information
curiousdannii committed Dec 26, 2023
1 parent 9c45e35 commit 68522b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/glkote/web/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {KEY_CODE_DOWN, KEY_CODE_RETURN, KEY_CODE_UP, KEY_CODES_TO_NAMES, OFFSCRE
import * as protocol from '../../common/protocol.js'

import {is_pinch_zoomed} from './shared.js'
import {apply_text_run_styles, BufferWindow, Window} from './windows.js'
import {apply_text_run_styles, Window} from './windows.js'

const MAX_HISTORY_LENGTH = 25

Expand Down Expand Up @@ -60,7 +60,7 @@ export class TextInput {
private onfocus() {
// Ensure a buffer window is scrolled down
if (this.window.type === 'buffer' && !is_pinch_zoomed()) {
this.scroll_to_bottom()
this.window.scroll_to_bottom()
}
// Scroll the browser window over the next 600ms
scroll_window()
Expand Down Expand Up @@ -191,18 +191,14 @@ export class TextInput {
top: '',
width: '',
})
.prop('disabled', true)
//.prop('disabled', true)
.val('')
const inputparent = this.window.type === 'buffer' ? this.window.innerel : this.window.frameel
if (!this.el.parent().is(inputparent)) {
this.el.appendTo(inputparent)
}
}

private scroll_to_bottom = () => {
(this.window as BufferWindow).scroll_to_bottom()
}

private submit_char(val: string) {
this.window.send_text_event({
type: 'char',
Expand Down
3 changes: 2 additions & 1 deletion src/glkote/web/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,9 @@ export default class Windows extends Map<number, Window> {
if (!update && win.inputs) {
if (win.textinput.el.is(':focus')) {
this.active_window = win
win.textinput.el.trigger('blur')
//win.textinput.el.trigger('blur')
}
win.textinput.el.prop('disabled', true)
delete win.inputs
}
}
Expand Down

0 comments on commit 68522b5

Please sign in to comment.