""" Debug script for add_icons_to_sky_btn - simplified """ import sys sys.path.insert(0, 'd:/ClaudeCode/frontend/src') import add_icons_to_sky_btn as fixer import re filepath = 'd:/ClaudeCode/frontend/src/views/app/SettingsView.vue' with open(filepath, 'r', encoding='utf-8') as f: content = f.read() template_start, template_end = fixer.find_template_section(content) template_text = content[template_start:template_end] # Test: iterate over ALL NButton tags and print diagnostics count = 0 for match in re.finditer(r'<[Nn][-]?[Bb]utton\b', template_text): tag_start = match.start() if fixer.is_inside_quotes(template_text, tag_start): continue pos = match.end() in_dq = False in_sq = False tag_end = -1 while pos < len(template_text): ch = template_text[pos] if ch == '\\': pos += 2 continue if ch == '"' and not in_sq: in_dq = not in_dq elif ch == "'" and not in_dq: in_sq = not in_sq elif ch == '>' and not in_dq and not in_sq: tag_end = pos + 1 break pos += 1 if tag_end < 0: continue tag_text = template_text[tag_start:tag_end] if 'sky-btn' not in tag_text: continue has_text = fixer.has_text_prop(tag_text) size_tiny = bool(re.search(r'\bsize\s*=\s*"(tiny|mini)"', tag_text)) quart_m = re.search(r'\bquaternary\b', tag_text) is_quart = bool(quart_m and (quart_m.start() == 0 or tag_text[quart_m.start()-1] != ':')) icon_tmpl = fixer.has_icon_template(tag_text, template_text, tag_end) btn_text = fixer.extract_button_text(tag_text, template_text, tag_end) has_emoj = fixer.has_emoji_content(btn_text) count += 1 btn_text_repr = btn_text.encode('utf-8', errors='replace')[:60] print(f'Button #{count}: text_bytes={btn_text_repr}') print(f' has_text={has_text} size_tiny={size_tiny} is_quart={is_quart}') print(f' icon_tmpl={icon_tmpl} has_emoji={has_emoj}') print(f' text_len={len(btn_text)} text_empty={not btn_text.strip()}') print(f'\nTotal: {count}')