-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
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.
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.