From 2e33482032df9211c5e07ac3003517b53fdb8c54 Mon Sep 17 00:00:00 2001 From: mechatroner Date: Tue, 14 Jul 2020 20:23:47 -0400 Subject: [PATCH] #27 - improve UX: handle empty separator case --- main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.py b/main.py index e81dff6..3720209 100644 --- a/main.py +++ b/main.py @@ -31,6 +31,8 @@ # FIXME add special handling of whitespace-separated grammar. Treat consecutive whitespaces as a single separator +# FIXME merge Enable Standard and Enable Simple into Enable [Auto] button. leave simple/standard as commands and update the docs, document Standard/Simple as Commands + def get_table_index_path(): global table_index_path_cached @@ -371,6 +373,8 @@ def dbg_log(logging_enabled, msg): def do_enable_rainbow(view, delim, policy, store_settings): + if not delim or not len(delim): + return file_path = view.file_name() logging_enabled = get_setting(view, 'enable_debug_logging', False) dbg_log(logging_enabled, '=======================================') @@ -443,6 +447,9 @@ def enable_generic_command(view, policy): return region = selection[0] selection_text = view.substr(region) + if not selection_text or not len(selection_text): + sublime.error_message('Error: Unable to use an empty string as a separator') + return if policy == 'quoted' and selection_text not in [';', ',']: sublime.error_message('Error: Standard dialect is supported only with comma [,] and semicolon [;] separators') return