mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-3975 fix: selection out of boundaries (#2173)
Co-authored-by: Daria Marutkina <125263541+dariamarutkina@users.noreply.github.com>
This commit is contained in:
co-authored by
Daria Marutkina
parent
76a440c482
commit
c3d6490efb
+2
-2
@@ -43,10 +43,10 @@ export const SQLCodeEditorPanel: TabContainerPanelComponent<ISqlEditorModeProps>
|
||||
|
||||
useEffect(() => {
|
||||
editorRef?.view?.dispatch({
|
||||
selection: { anchor: localState.selection.from, head: localState.selection.to },
|
||||
selection: { anchor: Math.min(localState.selection.to, data.value.length), head: Math.min(localState.selection.to, data.value.length) },
|
||||
scrollIntoView: true,
|
||||
});
|
||||
}, [editorRef?.view, localState]);
|
||||
}, [editorRef?.view, localState, data]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!editorRef?.selection) {
|
||||
|
||||
@@ -26,7 +26,6 @@ import { SqlEditorService } from '../SqlEditorService';
|
||||
import { ISQLScriptSegment, SQLParser } from '../SQLParser';
|
||||
import { SqlExecutionPlanService } from '../SqlResultTabs/ExecutionPlan/SqlExecutionPlanService';
|
||||
import { OUTPUT_LOGS_TAB_ID } from '../SqlResultTabs/OutputLogs/OUTPUT_LOGS_TAB_ID';
|
||||
import { OutputLogsService } from '../SqlResultTabs/OutputLogs/OutputLogsService';
|
||||
import { SqlQueryService } from '../SqlResultTabs/SqlQueryService';
|
||||
import { SqlResultTabsService } from '../SqlResultTabs/SqlResultTabsService';
|
||||
import type { ICursor, ISQLEditorData } from './ISQLEditorData';
|
||||
@@ -69,7 +68,6 @@ export function useSqlEditor(state: ISqlEditorTabState): ISQLEditorData {
|
||||
const sqlResultTabsService = useService(SqlResultTabsService);
|
||||
const commonDialogService = useService(CommonDialogService);
|
||||
const sqlDataSourceService = useService(SqlDataSourceService);
|
||||
const sqlOutputLogsService = useService(OutputLogsService);
|
||||
|
||||
const data = useObservableRef<ISQLEditorDataPrivate>(
|
||||
() => ({
|
||||
|
||||
Reference in New Issue
Block a user