Skip to content

Terminal does not show anything for tab #10319

@FoamyGuy

Description

@FoamyGuy

Currently the builtin Terminal does not show any visual representation for the tab character. If you run print("\thello") in the REPL it will show the visible tab in the serial console in tio, but visually on the display there is nothing shown where the tab would be.

tio:
Image

Display:
Image

This poses a challenge for the code editor because python code files that contain tabs do not get rendered properly, their indention will look off due to the tabs not being shown visually at all.

I have found that the circuitpython interpreter itself does support tabs in the code, and even mixing tabs with spaces. The following code file was used to test variations of tabs and different amounts of spaces:

from displayio import Group
import supervisor
import terminalio
from adafruit_display_text.bitmap_label import Label

main_group = Group()
display = supervisor.runtime.display

lbl = Label(terminalio.FONT, text='Hello World!', color=0xffff00, scale=8)
lbl.anchor_point = (0.5, 0.5)
lbl.anchored_position = (display.width//2, display.height//2)
main_group.append(lbl)

display.root_group = main_group

def testfunc():
        print(123)

while True:
    pass

Where the testfunc body was indented with tab, and the while True main loop was indented with spaces, I tried 1,2,3, and 4 spaces and all worked successfully even while the testfunc was indented with tab.

@tannewt do you know of any way that we could make Terminal show something visual for tab? Even if it it had to be a single character width instead of multiple it would make the editor much more usable on code that contains tabs for indention.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy