Skip to content

Commit

Permalink
Merge pull request #589 from FalkorDB/remove-line-numbers-when-there-…
Browse files Browse the repository at this point in the history
…is-only-one-line

Fix #582 remove line number if there is only on line
  • Loading branch information
AviAvni authored Dec 16, 2024
2 parents ec9a81b + 85fbf67 commit 099e2df
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/components/EditorComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const monacoOptions: monaco.editor.IStandaloneEditorConstructionOptions = {
fontWeight: "200",
wordWrap: "off",
lineHeight: 38,
lineNumbers: "on",
lineNumbersMinChars: 2,
overviewRulerLanes: 0,
overviewRulerBorder: false,
Expand Down Expand Up @@ -526,7 +525,7 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre

if (graph.Id) {
getSuggestions(monacoI)
}else {
} else {
addSuggestions(monacoI)
}
};
Expand All @@ -546,7 +545,7 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre
})

const isFirstLine = e.createContextKey('isFirstLine', false as boolean);

// Update the context key value based on the cursor position
e.onDidChangeCursorPosition(() => {
const position = e.getPosition();
Expand Down Expand Up @@ -619,7 +618,10 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre
height={blur ? LINE_HEIGHT : lineNumber * LINE_HEIGHT > document.body.clientHeight / 100 * MAX_HEIGHT ? document.body.clientHeight / 100 * MAX_HEIGHT : lineNumber * LINE_HEIGHT}
className="Editor"
language="custom-language"
options={monacoOptions}
options={{
...monacoOptions,
lineNumbers: lineNumber > 1 ? "on" : "off",
}}
value={blur ? query.replace(/\s+/g, ' ').trim() : query}
onChange={(val) => historyRef.current.historyCounter ? setQuery(val || "") : setCurrentQuery(val || "")}
theme="custom-theme"
Expand Down

0 comments on commit 099e2df

Please sign in to comment.