Переглянути джерело

Fix goto2 script and remoteTool opendomkit never focusing the code

Leonardo Jeanteur 5 місяців тому
батько
коміт
ed6f173518
2 змінених файлів з 14 додано та 3 видалено
  1. 4 1
      hide/view/CdbTable.hx
  2. 10 2
      hrt/impl/RemoteConsole.hx

+ 4 - 1
hide/view/CdbTable.hx

@@ -102,7 +102,10 @@ class CdbTable extends hide.ui.View<{}> {
 						if (scr != null) {
 							haxe.Timer.delay(function() {
 								@:privateAccess scr.script.editor.setPosition({column:0, lineNumber: line+1});
-								haxe.Timer.delay(() ->@:privateAccess scr.script.editor.revealLineInCenter(line+1), 1);
+								haxe.Timer.delay(function() {
+									scr.setCursor();
+									@:privateAccess scr.script.editor.revealLineInCenter(line+1);
+								}, 1);
 							}, 1);
 						}
 						#end

+ 10 - 2
hrt/impl/RemoteConsole.hx

@@ -354,8 +354,16 @@ class RemoteConsoleConnection {
 				hide.Ide.inst.focus();
 				var domkitView = Std.downcast(view, hide.view.Domkit);
 				if( domkitView != null ) {
-					@:privateAccess domkitView.cssEditor.focus();
-					@:privateAccess domkitView.cssEditor.editor.setPosition({column: args.column??0, lineNumber: (args.line??0)+1});
+					var col = args.column ?? 0;
+					var line = (args.line ?? 0) + 1;
+					haxe.Timer.delay(function() {
+						var cssEditor = @:privateAccess domkitView.cssEditor;
+						if (cssEditor != null) {
+							cssEditor.focus();
+							@:privateAccess cssEditor.editor.revealLineInCenter(line);
+							@:privateAccess cssEditor.editor.setPosition({ column: col, lineNumber: line });
+						}
+					}, 1);
 				}
 				if( args.selectExpr != null ) {
 					var sceneEditor : hide.comp.SceneEditor = null;