While working on updating the TE UI with @billrey , I made some notes on the Text Editor functions:
Bugs and Inconsistencies:
The “Find Set Selected” functions could work in the context menu, but it needs to open the Find panel(like the Find function), so additional options like “Wrap” would become available. Also it needs a shortcut, so the operation can be repeated without accessing the menu. Needs a poll to greyout the function when there is no selection.
(Un)comment needs to work on current line too, as it is it only works on the selection. Comment is missing a shortcut.
The TE undo history is mixing with ex. 3d View undo history making a mess of undoing the TE.
Cut, copy and paste needs polls to grey them out when no selection or empty clipboard.
In Find panel, the All setting will find/replace throughout all texts in the TE. Normally “All” means all in the current document - maybe this should be split into two functions: “All in current text” and “All in all texts”.
Drag-select scrolls like CRAZY if you just barely go over the window edge. Written by Snu.
When you press ctrl-f when something is selected, it should be pasted into the find text. Written by Snu.
nBurn writes: In windows (and I think mac os as well) once your cursor goes just over the left side of character’s center ( 50% of the glyph’s width), selections will start on the left side of that character. in blender’s text editor you have to have your cursor positioned somewhere around 90% to the left of a glyph’s width before you can start your selection on the left side of a character
Nice to have:
A floatproperty example among the Templates.
The Python Templates could use some sub-menus, and maybe a search function in templates could be useful. Or even better an API manual including working example of the function in question(autoitscript has this).
Use the Autocomplete on the API functions(or like the python console), not only limited the used words in current document.
Option to mirror all messages in System Console in Python Console, or a print to python console function ex. printpc(“Hello Python Console”)
Option to show whitespace(tabs and spaces) and indentation markings.
Trying to awake some love for the Text Editor here:
There is currently no elegant way of setting the cursor in the text editor. There exists region_location_from_cursor() and bpy.ops.text.cursor_set() , both which operate on pixel coordinates and aren’t reliable for getting and setting arbitrary positions, especially when the cursor or destination is off-screen.
A cursor RNA prop definition with both read/write capabilities or a function to set cursor position by line/column is what we need.
Getting the selected text should be made easier, either by having a function like text.get_selection() or accessing a property like text.selection . As of now it takes around 20-25 lines of code just to get multi-line selection as a raw string.
Campbell not too long ago added a feature to make an input field active when a menu or panel was called, which is what the new Rename Active Item does. In python we can now utilize this by setting activate_init to True before defining the UILayout prop.
The operator bpy.ops.text.jump() , CTRL J, should utilize this behavior, too, and have its line property compatible with the new activate_init so we don’t have to click the input field. activate_init currently only appears to work for StringProperty types so it needs to be made compatible with other kinds of properties like ints and floats.
Minor Text Editor things, which needs to be fixed in C:
In the Header, next to the text drop down menu, is a copy icon. This should be changed to FILE_NEW since, pressing the button will add a new text-block.
Ctrl+F for Find should auto-add selected text to the Find search box(like Find Set Selected).
Ctrl+H for Replace should open the sidebar, and add current selection to the replace box, before doing replace, so it is possible so read what will be replaced with what, before doing it.
Add search direction: Up & down.
Add replace all(in current document). (The current All button is for continuing search over all text blocks)
Text Auto Complete: Always use the Python API lib, even though the current text block do not have .py extension(yet). Could be added to Properties to unselect Python API for auto complete.
‘Find Set Selected’ should have a shortcut key - this function is much more valuable with a hot key function.
Register, Live Edit and Make Internal are missing proper documentation, since it is very hard to understand what these functions are for.
Add: Remove Trailing Whitespace, since it’s annoying to use an external editor for this simple thing.
Organize templates in sub-menus when there are several entries in the same categories ex: Gizmo, Operator and UI.
Comment operator is missing a tooltip.
The Info Editor:
The Replay function is not working(most of the time), because the commands are not re-run in the right context. Maybe the Undo History could be used to detect what context the commands where originally run in or the context should be stored with the command when it was originally executed, so it can be re-executed in the right context.
The Python Console:
Some problem here, that most commands fail because of the wrong context. Either the commands could be tried executed in the various areas until a area with an succeful area was found. Or an enum in the header could allow the user to change the context manually(selection: visible areas).