public inbox for [email protected]  
help / color / mirror / Atom feed
From: Pradip Parkale <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM6233]:SQL Formatter Uses Tab Size Even When Use Spaces is Set to False
Date: Mon, 22 Mar 2021 08:41:57 +0530
Message-ID: <CAJ9T6SuCXKL-rW6kVo2Rvw-ioAH+sT0atrTU9iwVMaFDo2nZ4A@mail.gmail.com> (raw)

Hi Hackers,
Please find the attached patch for #6233.
If the 'Use spaces?' is false then the default tab size will be 4.

-- 
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation


Attachments:

  [application/octet-stream] RM6233.patch (1.4K, 3-RM6233.patch)
  download | inline diff:
diff --git a/web/pgadmin/static/js/sqleditor/query_tool_preferences.js b/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
index 723e7478a..d4d0c78f9 100644
--- a/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
+++ b/web/pgadmin/static/js/sqleditor/query_tool_preferences.js
@@ -213,6 +213,13 @@ function updateUIPreferences(sqlEditor) {
 
   /* Code Mirror Preferences */
   let sql_font_size = SqlEditorUtils.calcFontSize(preferences.sql_font_size);
+  let tab_size;
+  // Set tab size to default(which is 4) when 'Use spaces?' is set to false.
+  if (preferences.use_spaces){
+    tab_size = preferences.tab_size;
+  }else{
+    tab_size = 4;
+  }
   $(sqlEditor.query_tool_obj.getWrapperElement()).css('font-size', sql_font_size);
 
   if(preferences.plain_editor_mode) {
@@ -226,7 +233,7 @@ 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('tabSize', tab_size);
   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);


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin][RM6233]:SQL Formatter Uses Tab Size Even When Use Spaces is Set to False
  In-Reply-To: <CAJ9T6SuCXKL-rW6kVo2Rvw-ioAH+sT0atrTU9iwVMaFDo2nZ4A@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox