mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-22 01:30:25 +01:00
Request redraw after write if terminal visible
Requests a redraw after writing to terminal if it is visible, otherwise terminal will not be updated if there are no other redraw requests. Fixes #53.
This commit is contained in:
parent
9896a362c3
commit
041e7a445f
3 changed files with 7 additions and 15 deletions
|
@ -15,7 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Fixed
|
### Fixed
|
||||||
- [#51][i51]: Fixed issue where terminal would lose focus on Tab/Arrow key presses
|
- [#51][i51]: Fixed issue where terminal would lose focus on Tab/Arrow key presses
|
||||||
when in a scene with other input nodes. Thanks [@ConteZero] for reporting.
|
when in a scene with other input nodes. Thanks [@ConteZero] for reporting.
|
||||||
|
- [#53][i53]: Fixed issue where terminal was not updating when there was no GUI
|
||||||
|
activity. Thanks [@ConteZero] for providing feedback on this issue.
|
||||||
|
|
||||||
|
[i53]: https://github.com/lihop/godot-xterm/issues/53
|
||||||
[i51]: https://github.com/lihop/godot-xterm/issues/51
|
[i51]: https://github.com/lihop/godot-xterm/issues/51
|
||||||
[@ConteZero]: https://github.com/ConteZero
|
[@ConteZero]: https://github.com/ConteZero
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ extends "../../terminal.gd"
|
||||||
signal exited(exit_code, signum)
|
signal exited(exit_code, signum)
|
||||||
|
|
||||||
var editor_settings: EditorSettings
|
var editor_settings: EditorSettings
|
||||||
var timer := Timer.new()
|
|
||||||
|
|
||||||
onready var pty = $PTY
|
onready var pty = $PTY
|
||||||
|
|
||||||
|
@ -51,20 +50,6 @@ func _ready():
|
||||||
)
|
)
|
||||||
_native_terminal._update_theme()
|
_native_terminal._update_theme()
|
||||||
|
|
||||||
# In editor _process is not called continuously unless the "Update Continuously"
|
|
||||||
# editor setting is enabled. This setting is disabled by default and uses 100%
|
|
||||||
# of one core when enabled, so best to leave it off and use a timer instead.
|
|
||||||
add_child(timer)
|
|
||||||
timer.wait_time = 0.025
|
|
||||||
timer.connect("timeout", self, "_poll")
|
|
||||||
timer.start()
|
|
||||||
|
|
||||||
|
|
||||||
func _poll():
|
|
||||||
if pty and pty.has_method("get_master"):
|
|
||||||
pty.get_master().poll()
|
|
||||||
update()
|
|
||||||
|
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if has_focus() and event is InputEventKey and event.is_pressed():
|
if has_focus() and event is InputEventKey and event.is_pressed():
|
||||||
|
|
|
@ -83,6 +83,10 @@ func write(data) -> void:
|
||||||
# Will be cleared when _flush() is called after VisualServer emits the "frame_pre_draw" signal.
|
# Will be cleared when _flush() is called after VisualServer emits the "frame_pre_draw" signal.
|
||||||
_buffer.push_back(data)
|
_buffer.push_back(data)
|
||||||
|
|
||||||
|
# Ensure redraw is requested if terminal is visible.
|
||||||
|
if visible:
|
||||||
|
update()
|
||||||
|
|
||||||
|
|
||||||
func _flush():
|
func _flush():
|
||||||
for data in _buffer:
|
for data in _buffer:
|
||||||
|
|
Loading…
Reference in a new issue