diff options
-rw-r--r-- | editor/code_editor.cpp | 2 | ||||
-rw-r--r-- | modules/bullet/space_bullet.cpp | 4 | ||||
-rw-r--r-- | modules/gdscript/language_server/gdscript_language_server.cpp | 50 | ||||
-rw-r--r-- | modules/gdscript/language_server/gdscript_language_server.h | 5 | ||||
-rw-r--r-- | modules/gdscript/language_server/lsp.hpp | 2 | ||||
-rw-r--r-- | scene/gui/line_edit.cpp | 4 |
6 files changed, 47 insertions, 20 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index e5b4cbdda1..fa713349d4 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -900,7 +900,7 @@ void CodeTextEditor::update_editor_settings() { text_editor->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/navigation/smooth_scrolling")); text_editor->set_v_scroll_speed(EditorSettings::get_singleton()->get("text_editor/navigation/v_scroll_speed")); text_editor->set_draw_minimap(EditorSettings::get_singleton()->get("text_editor/navigation/show_minimap")); - text_editor->set_minimap_width(EditorSettings::get_singleton()->get("text_editor/navigation/minimap_width")); + text_editor->set_minimap_width((int)EditorSettings::get_singleton()->get("text_editor/navigation/minimap_width") * EDSCALE); text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_numbers")); text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/appearance/line_numbers_zero_padded")); text_editor->set_bookmark_gutter_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/show_bookmark_gutter")); diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp index e5b2ac3808..0f50d31611 100644 --- a/modules/bullet/space_bullet.cpp +++ b/modules/bullet/space_bullet.cpp @@ -945,7 +945,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f btVector3 motion; G_TO_B(p_motion, motion); - if (!motion.fuzzyZero()) { + { // Phase two - sweep test, from a secure position without margin const int shape_count(p_body->get_shape_count()); @@ -960,7 +960,7 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f motionVec->end(); #endif - for (int shIndex = 0; shIndex < shape_count; ++shIndex) { + for (int shIndex = 0; shIndex < shape_count && !motion.fuzzyZero(); ++shIndex) { if (p_body->is_shape_disabled(shIndex)) { continue; } diff --git a/modules/gdscript/language_server/gdscript_language_server.cpp b/modules/gdscript/language_server/gdscript_language_server.cpp index 9675c07c00..19bb3ed1ee 100644 --- a/modules/gdscript/language_server/gdscript_language_server.cpp +++ b/modules/gdscript/language_server/gdscript_language_server.cpp @@ -36,10 +36,15 @@ GDScriptLanguageServer::GDScriptLanguageServer() { thread = NULL; - thread_exit = false; - _EDITOR_DEF("network/language_server/remote_port", 6008); + thread_running = false; + started = false; + + use_thread = false; + port = 6008; + _EDITOR_DEF("network/language_server/remote_port", port); _EDITOR_DEF("network/language_server/enable_smart_resolve", true); _EDITOR_DEF("network/language_server/show_native_symbols_in_editor", false); + _EDITOR_DEF("network/language_server/use_thread", use_thread); } void GDScriptLanguageServer::_notification(int p_what) { @@ -51,12 +56,25 @@ void GDScriptLanguageServer::_notification(int p_what) { case NOTIFICATION_EXIT_TREE: stop(); break; + case NOTIFICATION_INTERNAL_PROCESS: { + if (started && !use_thread) { + protocol.poll(); + } + } break; + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { + int port = (int)_EDITOR_GET("network/language_server/remote_port"); + bool use_thread = (bool)_EDITOR_GET("network/language_server/use_thread"); + if (port != this->port || use_thread != this->use_thread) { + this->stop(); + this->start(); + } + } break; } } void GDScriptLanguageServer::thread_main(void *p_userdata) { GDScriptLanguageServer *self = static_cast<GDScriptLanguageServer *>(p_userdata); - while (!self->thread_exit) { + while (self->thread_running) { // Poll 20 times per second self->protocol.poll(); OS::get_singleton()->delay_usec(50000); @@ -64,22 +82,30 @@ void GDScriptLanguageServer::thread_main(void *p_userdata) { } void GDScriptLanguageServer::start() { - int port = (int)_EDITOR_GET("network/language_server/remote_port"); + port = (int)_EDITOR_GET("network/language_server/remote_port"); + use_thread = (bool)_EDITOR_GET("network/language_server/use_thread"); if (protocol.start(port) == OK) { EditorNode::get_log()->add_message("--- GDScript language server started ---", EditorLog::MSG_TYPE_EDITOR); - ERR_FAIL_COND(thread != NULL || thread_exit); - thread_exit = false; - thread = Thread::create(GDScriptLanguageServer::thread_main, this); + if (use_thread) { + ERR_FAIL_COND(thread != NULL); + thread_running = true; + thread = Thread::create(GDScriptLanguageServer::thread_main, this); + } + set_process_internal(!use_thread); + started = true; } } void GDScriptLanguageServer::stop() { - ERR_FAIL_COND(NULL == thread || thread_exit); - thread_exit = true; - Thread::wait_to_finish(thread); - memdelete(thread); - thread = NULL; + if (use_thread) { + ERR_FAIL_COND(NULL == thread); + thread_running = false; + Thread::wait_to_finish(thread); + memdelete(thread); + thread = NULL; + } protocol.stop(); + started = false; EditorNode::get_log()->add_message("--- GDScript language server stopped ---", EditorLog::MSG_TYPE_EDITOR); } diff --git a/modules/gdscript/language_server/gdscript_language_server.h b/modules/gdscript/language_server/gdscript_language_server.h index 191b8bfa85..228d29bf42 100644 --- a/modules/gdscript/language_server/gdscript_language_server.h +++ b/modules/gdscript/language_server/gdscript_language_server.h @@ -41,7 +41,10 @@ class GDScriptLanguageServer : public EditorPlugin { GDScriptLanguageProtocol protocol; Thread *thread; - bool thread_exit; + bool thread_running; + bool started; + bool use_thread; + int port; static void thread_main(void *p_userdata); private: diff --git a/modules/gdscript/language_server/lsp.hpp b/modules/gdscript/language_server/lsp.hpp index 379024844e..a2dcc48820 100644 --- a/modules/gdscript/language_server/lsp.hpp +++ b/modules/gdscript/language_server/lsp.hpp @@ -330,8 +330,6 @@ struct CompletionOptions { triggerCharacters.push_back("$"); triggerCharacters.push_back("'"); triggerCharacters.push_back("\""); - triggerCharacters.push_back("("); - triggerCharacters.push_back(","); } Dictionary to_json() const { diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 5351b6cadc..a6cd9a0665 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -1193,7 +1193,7 @@ void LineEdit::delete_char() { set_cursor_position(get_cursor_position() - 1); if (align == ALIGN_CENTER || align == ALIGN_RIGHT) { - window_pos = CLAMP(window_pos - 1, 0, text.length() - 1); + window_pos = CLAMP(window_pos - 1, 0, MAX(text.length() - 1, 0)); } _text_changed(); @@ -1224,7 +1224,7 @@ void LineEdit::delete_text(int p_from_column, int p_to_column) { } if (align == ALIGN_CENTER || align == ALIGN_RIGHT) { - window_pos = CLAMP(window_pos - (p_to_column - p_from_column), 0, text.length() - 1); + window_pos = CLAMP(window_pos - (p_to_column - p_from_column), 0, MAX(text.length() - 1, 0)); } if (!text_changed_dirty) { |