diff --git a/docs/en_US/release_notes_5_1.rst b/docs/en_US/release_notes_5_1.rst index 7b96683c2..003dfde48 100644 --- a/docs/en_US/release_notes_5_1.rst +++ b/docs/en_US/release_notes_5_1.rst @@ -36,11 +36,13 @@ Bug fixes | `Issue #5467 `_ - Allow underscores in the Windows installation path. | `Issue #5628 `_ - Remove the "launch now" option in the Windows installer, as UAC could cause it to run as an elevated user. | `Issue #5810 `_ - Ensure that cell content being auto selected when editing the cell data. +| `Issue #5869 `_ - Ensure that SQL formatter should not add extra tabs and format the SQL correctly. | `Issue #6018 `_ - Fixed encoding issue when database encoding set to SQL_ASCII and name of the column is in ASCII character. | `Issue #6159 `_ - Ensure that the user should be able to kill the session from Dashboard if the user has a 'pg_signal_backend' role. | `Issue #6206 `_ - Ensure that the view/edit data panel should not be opened for unsupported nodes using the keyboard shortcut. | `Issue #6227 `_ - Ensure PGADMIN_DEFAULT_EMAIL looks sane when initialising a container deployment. | `Issue #6228 `_ - Improve the web setup script for Linux to make the platform detection more robust and overrideable. +| `Issue #6233 `_ - Ensure that SQL formatter should not use tab size if 'Use spaces?' set to false. | `Issue #6253 `_ - Fixed an issue where the user is unable to create a subscription if the host/IP address for connection is 127.0.0.1. | `Issue #6259 `_ - Ensure that proper error message should be shown on the properties and statistics tab in case of insufficient privileges for a subscription. | `Issue #6260 `_ - Fixed an issue where the 'Create Slot' option is disabled in case of the same IP/host provided but the port is different. @@ -56,3 +58,4 @@ Bug fixes | `Issue #6316 `_ - Ensure that the primary key should be visible properly in the table dialog. | `Issue #6317 `_ - Ensure that toggle buttons are accessible by most screen readers. | `Issue #6322 `_ - Fixed an issue where the top menu disappears when entering into the full screen for minimum screen resolution. +| `Issue #6323 `_ - Ensure that the grantor name should be visible properly for the security tab in the table dialog. diff --git a/web/pgadmin/misc/sql/__init__.py b/web/pgadmin/misc/sql/__init__.py index f1145c94b..037698b6c 100644 --- a/web/pgadmin/misc/sql/__init__.py +++ b/web/pgadmin/misc/sql/__init__.py @@ -46,6 +46,7 @@ def sql_format(sql): This function takes a SQL statement, formats it, and returns it """ p = Preferences.module('sqleditor') + use_spaces = p.preference('use_spaces').get() output = sqlparse.format(sql, keyword_case=p.preference( 'keyword_case').get(), @@ -63,10 +64,9 @@ def sql_format(sql): 'comma_first').get(), wrap_after=p.preference( 'wrap_after').get(), - indent_tabs=not p.preference( - 'use_spaces').get(), + indent_tabs=not use_spaces, indent_width=p.preference( - 'tab_size').get()) + 'tab_size').get() if use_spaces else 1) return output diff --git a/web/pgadmin/static/js/sqleditor/query_tool_preferences.js b/web/pgadmin/static/js/sqleditor/query_tool_preferences.js index 723e7478a..a563a730c 100644 --- a/web/pgadmin/static/js/sqleditor/query_tool_preferences.js +++ b/web/pgadmin/static/js/sqleditor/query_tool_preferences.js @@ -225,8 +225,8 @@ function updateUIPreferences(sqlEditor) { } sqlEditor.query_tool_obj.setOption('foldGutter', preferences.code_folding); sqlEditor.query_tool_obj.setOption('indentWithTabs', !preferences.use_spaces); - sqlEditor.query_tool_obj.setOption('indentUnit', preferences.tab_size); - sqlEditor.query_tool_obj.setOption('tabSize', preferences.tab_size); + sqlEditor.query_tool_obj.setOption('indentUnit', preferences.use_spaces ? preferences.tab_size : 4); + sqlEditor.query_tool_obj.setOption('tabSize', preferences.use_spaces ? preferences.tab_size : 4); sqlEditor.query_tool_obj.setOption('lineWrapping', preferences.wrap_code); sqlEditor.query_tool_obj.setOption('autoCloseBrackets', preferences.insert_pair_brackets); sqlEditor.query_tool_obj.setOption('matchBrackets', preferences.brace_matching);